Control Brushless Motor Using Arduino

43,797

31

9

Introduction: Control Brushless Motor Using Arduino

About: I am an Arduino and Electronics enthusiast, I make various Arduino Projects From small mini projects to Home Automation Projects including IOT.I post video tutorials and articles on the projects I make,Here ...

Ever thought of controlling a ESC a.k.a Electronic Speed Controller of a Brushless Motor without a Transmitter and Receiver or have a Project in which you want to control a Speed of Brushless Motor using a simple Circuit or Arduino ,then there is a way we can do it with Arduino Microcontroller.This involves the use of PWM signal from arduino to control the speed of brushless motor with a ESC.This will save you the money to buy a servo tester or a RC Transmitter and receiver.So Lets Get started!!

Things you need:

  1. Arduino(I will be using a UNO)
  2. Potentiometer
  3. Lipo Battery(Which is able to supply Sufficient Current)
  4. ESC(Make sure that the motor draws less current than mentioned on the ESC)
  5. Brushless Motor(In my case a A2212)

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: ​Wiring Up the Circuit

First connect the three terminals of Brushless motor to the the three terminals of the ESC.Screw the Motor to a heavy wooden plank anything similar so that it remains stable at high RPM.Download and Flash the code available at the bottom of the page to the arduino using a usb cable(Code is explained in the further part of this page). Connect the signal wire of ESC mostly white or yellow colour to any PWM pin Arduino,I connected it to the D8 pin and specified it a Pin 8 in the Arduino Sketch.You can use more than one pins for controlling many motors.

Connect the Potentiometer to the vcc or 5v pin of the Arduino and the Ground.

Connect the third terminal that is the variable pin to the Analog pin A0 You can power the Arduino using the BEC(Battery Eliminator Circuit)Present in your ESC.To use the BEC just connect the red thick wire to the Vin Pin of Arduino .It can provide 5V.Not all ESC's have a BEC,in this case you can use a external 5v power supply.After Powering the Arduino now connect the Lipo battery to your ESC.

You are Done!!Now slowly turn the Potentiometer Knob to start and increase the speed of the Motor.

Step 2: ​Arduino Code

In this code we are simply mapping or refering the maximum(1023) and minimum(0) Analog values at pin A0 to the required maximum(2000) and minimum(1000) values to operate and control the speed of the ESC.You may require to change the max an min values of the ESC i.e 1000 and 2000 to different values in other words you may need to caliberate it,Because Diffrent ESC's may have diffrent start point and end point.

For more tutorials visit-RZtronics.com

Code

#include //Using servo library to control ESC

Servo esc; //Creating a servo class with name as esc

void setup()

{

esc.attach(9); //Specify the esc signal pin,Here as D8

esc.writeMicroseconds(1000); //initialize the signal to 1000

Serial.begin(9600);

}

void loop()

{

int val; //Creating a variable val

val= analogRead(A0); //Read input from analog pin a0 and store in val

val= map(val, 0, 1023,1000,2000); //mapping val to minimum and maximum(Change if needed) esc.writeMicroseconds(val); //using val as the signal to esc

}

1 Person Made This Project!

Recommendations

  • Finish It Already Speed Challenge

    Finish It Already Speed Challenge
  • Arduino Contest 2020

    Arduino Contest 2020
  • First Time Author Contest

    First Time Author Contest

9 Discussions

0
airboi
airboi

2 months ago

could i feed input to the system via my pc motherboard fan header ports(4/3 pin)? was hoping to send pwm or linear voltage control signals as input to the arduino depending on which ever (3 or 4 pin) header i want to use. If possible coud you point me where to get reference to code such a system?

0
AnthoineR
AnthoineR

1 year ago

hi mate,
i have the same situation but with a little problem, between the ESC and brushless motor i added a switch, the problem is that one, the motor try to start and shaking little bit, without switch work fine , i left the potentiometer in half position because i need a medium speed.
do you know why i have this problem ?
thanks antonio

0
ARYANS67
ARYANS67

1 year ago

Hey there , I'm arian , I must to say that it's code isn't working , because it must be like below :
#include

And in void loop()
esc.write(val);

I change the codes to work . Now , I can drive my brushless motor and control the speed with volume .
If you wanna see , I can send you a video of the codes and work.

Best regards , good luck

Screenshot_20181022-004109.jpgScreenshot_20181022-004116.jpg
0
ironholmes
ironholmes

Question 2 years ago

Hi, thank you for posting.

I have a doubt that,

Would I be able to use a line scan cam output to control the speed of bldc motor without a potentiometer ?

Thanks,expecting an early reply...

0
BillyD26
BillyD26

Question 2 years ago

How loud is this setup? I want to do something similar but it has to be almost silent

0
keyfinn
keyfinn

2 years ago

Thank you for sharing our progeny with us.