
Brushless DC electric motor (BLDC motors, BL motors) also known as electronically commutated motors (ECMs, EC motors), or synchronous DC motors, are synchronous motors powered by DC electricity via an inverter or switching power supply which produces an AC electric current to drive each phase of the motor via a closed loop controller. The controller provides pulses of current to the motor windings that control the speed and torque of the motor.
In this project, we will learn how to control such a BLDC motor with Arduino.
Parts
1 x BLDC
1 x ESC
1 x Arduino
Wiring
Here is the schematic


Code
Here’s the code
/*
created 15 July 2018
by Harshit Tomar
This example code is in the public domain.
harshitt345.wixsite.com/projectcommunity/blog/harshitt345.wixsite.com/projectcommunity
*/
#include <Servo.h>
Servo BLDC;
void setup()
{
BLDC.attach(11); //Specify here the pin number on which the signal pin of ESC is connected.
BLDC.write(30); //ESCs won't start unless input speed is less during initialization.
delay(3000); //ESC initialization delay.
}
void loop()
{
BLDC.write(55); //Vary this between 40-130 to change the speed of motor. Higher value, higher speed.
delay(15);
}
/*
If you want to control the readings with a
potientiometer then connect it with arduino
on pin A0 and write->BLDC.write(A0); in line 22.
If you have any questions, get them answered on
harshitt345.wixsite.com/projectcommunity
*/
NOTE
If you want to control the readings with a potentiometer then connect it with Arduino on pin A0 and write -> BLDC.write(A0); in line 22. For more info on potentiometers and how to use them with arduino, check out my tutorial analog input with potentiometer
If you are new to Arduino, then,