Interfacing Brushless DC Motor (BLDC) With Arduino

44,916

197

62

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 ...

Intro: 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: www.mithilraut.com

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.
delay(15);
}

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.

Share

Recommendations

  • Optics Contest

    Optics Contest
  • Plastics Contest

    Plastics Contest
  • Halloween Contest 2018

    Halloween Contest 2018

62 Discussions

0
None
عمارق

2 months ago

Hallo, how can I control the brushless motor and esc via my iPhone Bluetooth ?
I have already Hm-10 bluetooth, but I need 1- the sketch of this project
2- and IOS App
Can anyone please help me ?

0
None
MdM52

2 months ago

Sir, i want to control speed of BLDC motor in diffrent stage. please help me sir

3 replies
0
None
MithilRMdM52

Reply 2 months ago

Follow the tutorial. Program the Arduino to control the motor.

0
None
MithilRMdM52

Reply 2 months ago

Refer the program in step 3 of this instructable. That is where you would program it. The comments in the program would help to see what each command is doing.

0
None
MithilRharshitt345

Answer 4 months ago

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

0
None
Dylan91

2 years ago

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
1
None
MithilRDylan91

Reply 2 years ago

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.

0
None
MithilRharshitt345

Reply 4 months ago

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

0
None
Dylan91MithilR

Reply 2 years ago

Thank you for your fast response:)

1
None
mermosh

Question 7 months ago

Hi,

Thanks for this instruction.

How can I control the direction of the motor?

Thanks

Moshe

3 more answers
0
None
MithilRmermosh

Answer 7 months ago

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.

1
None
MithilRmermosh

Answer 7 months ago

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.

0
None
mermoshMithilR

Answer 7 months ago

OK...

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?

Thanks

Moshe

0
None
jointhomesolutions

Question 7 months ago on Introduction

Hi,
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
0
None
MithilRjointhomesolutions

Answer 7 months ago

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

0
None
Joe12w3

Question 9 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
0
None
MithilRJoe12w3

Answer 9 months ago

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.