Interfacing Brushless DC Motor (BLDC) With Arduino





Introduction: Interfacing Brushless DC Motor (BLDC) With Arduino

About: A grad student at Boston University, I graduated with Computer Engineering degree and my area of interest is Robotics. I also have a heavy inclination towards the DIY philosophy. Previously I was a Research ...

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.



  • Oil Contest

    Oil Contest
  • Water Contest

    Water Contest
  • Creative Misuse Contest

    Creative Misuse Contest

57 Discussions

Choose the Amp according to the max current rating of the motor.

Nice work:) with the same procedure can i control a 4 BLDC? So can i build an arduino based quadrocopte? Someone said to me the arduino not "fast enough" for it.

4 replies

You can control 4 BLDC motors. But the clock rate of arduino is less so even if you make one it won't be stable. I would recommend you go for a different controller with a faster clock rate.

For the motor, select according to the max power rating of the motor.

Thank you for your fast response:)


Question 3 months ago


Thanks for this instruction.

How can I control the direction of the motor?



3 more answers

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

1 more answer

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


Question 5 months ago

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

1 more answer

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

1 more 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?

2 replies

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.