Interfacing Brushless DC Motor (BLDC) With Arduino





Introduction: Interfacing Brushless DC Motor (BLDC) With Arduino

This is a tutorial about how to interface and run a Brushless DC motor using Arduino. If you have any questions or comments please reply in comments or mail to rautmithil[at]gmail[dot]com. You can also get in touch with me @mithilraut on twitter.

To know more about me:

Step 1: List of Components

  1. Arduino UNO
  2. BLDC outrunner motor (Any other outrunner motor will work fine)
  3. Electronic Speed Controller (Choose according to the current rating of the motor)
  4. LiPo Battery (to power the motor)
  5. Male-Male Jumper cable * 3
  6. USB 2.0 cable type A/B (To upload the program and power the Arduino).

Note: Make sure you check the connectors of battery, ESC and Motors. In this case we have 3.5mm male bullet connectors on the Motor. So I soldered 3.5mm female bullet connectors on the output of ESC. The Battery had a 4.0mm Male Female connector. Hence I soldered appropriate female male connectors on the input side of ESC.

Step 2: Connections

Connect the motor to the output of ESC. Here, the polarity doesn't matter. If you switch any 2 of the 3 wires, the motor will rotate in opposite direction.

Connect the '+' & '-' of battery to the Red(+) and Black(-) wires of ESC respectively.

From the 3pin servo cable coming out of the ESC, connect the Brown cable to the 'GND' pin on Arduino. Connect the Yellow cable to any digital pin. In our case its digital pin 12.

Step 3: Programming Arduino UNO

If you are new to Arduino then you can download, install and setup the Arduino from here.

Connect the Arduino to the PC. Open Arduino IDE and write this code. Under 'Tools' select

Board: Arduino/Genuino UNO

Port: COM15 (Select appropriate COM port. To find out the COM port open device manager and look for Arduino UNO under 'Ports')

Click Upload button on the upper left corner.

#include <Servo.h>
Servo esc_signal;

void setup()
  esc_signal.attach(12);  //Specify here the pin number on which the signal pin of ESC is connected.
  esc_signal.write(30);   //ESC arm command. ESCs won't start unless input speed is less during initialization.
  delay(3000);            //ESC initialization delay.

void loop()
esc_signal.write(55);	  //Vary this between 40-130 to change the speed of motor. Higher value, higher speed.

Step 4: Note

The correct way to run the motors is to

1. Connect the battery to the ESC to power up the ESC.

2. Power the Arduino.

If you do the other way round, the Arduino will run the arm sequence and the ESC will miss those commands since it isn't powered up. In this case press the reset button on the Arduino.



  • Microcontroller Contest

    Microcontroller Contest
  • Science of Cooking

    Science of Cooking
  • Pocket-Sized Contest

    Pocket-Sized Contest

We have a be nice policy.
Please be positive and constructive.


4 Questions



Thanks for this instruction.

How can I control the direction of the motor?




I am not aware of any systems to do that right away but you could look online for ways to control the direction of BLDC motor.


Electronically you cannot. Changing the direction of BLDC motors involves switching the connections on two of the three wires. So either yellow-black, red-black or red-yellow.



So how is it possible? Which other component to add in between to control also the direction?

With regular DC, I did it with L298N and Arduino. Is there something similar for BLDC?



I want to run bldc motor used in segway using audrino mega 2560 and swagbridge with 36 v input from power supply . Whenever we are connecting the whole circuit to motor, motor is not starting . Please suggest


What is the ESC used with the motor? I can't find out what swagbridge is.


When i paste the code into my Programm (Arduino), than the programm say: Error compiling for board Arduino/Genuino Uno
Whats wrong?
Please answer fast


That is a generic error response. If you can paste all the details of the error or make a video showing this error it would be easier to figure out why it's not compiling.


Can u explain me what is 30 in the code "esc_signal.write(30);" mean? (i think that if we set 30 => initial speed is 0 but i'm not sure about that)

Why can we vary only between 40 and 150? Can i put 200, 300...?

Thank you for your answer


The value of 30 gets translated to a near "LOW" value for the ESC to interpret that we are indeed sending a low value. Sending low value is important as ESC's are programmed to NOT ARM if the value is high. This is enabled to avoid the motor to start spining as soon as you power up the ESC.

The servo library is designed to take the input of angles from 0-180. Since the modulation techniques is same for servo as well as ESC we use the same library. Any value above 180 will be ceiled to 180. Any value below 0 will be floored to 0.


i want to interface BLDC with an FS-T6 transceiver, i have


2: audino uno

3,receiver +battery. i didnt get any codeing, can you help me?

If you have a receiver like that and are plannign to integrate it with the transmitter, then you don't need arduino to run it. You can run it with the switch on the transmitter. You'll still will need ESCs for each BLDC motor.

actually i m working on a quad copter. In order to more forward step by step i need to interface all brush less dc motors to my FS-T6 transceiver using audino.that needs a code. i have already interfaced simply without audint now i need to choose audino. Plus i am trying to use wireless laser charging kit to charge in flight. It use a 30C battery. Do you sell or can help me buying.?

need sincere advice.

I dont' sell but based on your location, you can order from a local dealer or international shippers like or

It is not working for me. I am using a 1000kv A2212/13t motor, a 30A esc and an 11.1v lipo battery. When I run the program, the motor just twitches. Do you have any idea what I'm doing wrong

Make sure your wires and connectors are soldered correct and have connectivity between them. One of the reason for twiching is when once phase of the motor is not activated in sync.

am using 1100kv motor with input power 12V/10Amps and ESC 12v 30Amps .. when i give value 80 its taking more power to rotate.. and not initialising properly.. and above 90 if i write in code its taking more than 10Amps.. can u suggest me how can i make it to raotate gradually evrytime when i wrote different speeds..thanks in advance....

try increasing the speed gradually from 55 to 80 with a delay of 100-300
milliseconds between each increase. this way the motor should
accelerate to your desired speed although it may take some time.


I have 2 question :

1) Can I use a 30 amp ESC ??

2) Do I have to use Lipo battery or I can use any battery ??

Thanks in advace

1. Yes.
2. You generally use LiPo battery with BLDC motor because they consume current at a very high discharge rate. They can be susbstituted with LiFe or NiCd although not in all situations.