Ever thought to control Brushless Motor with ESC without a Transmitter and Receiver or have a Project in which you want to control Brushless Motor speed using a simple Circuit or Arduino, then there is a way we can do it with Arduino Micro-controller.This involves the use of PWM signal from Arduino to control brushless motor speed with an ESC.This will save you the money to buy a servo tester or an RC Transmitter and receiver.So Let’s Get started!!
Things you need:
- Arduino(I will be using a UNO)
- Potentiometer
- Lipo Battery(Which is able to supply Sufficient Current)
- ESC(Make sure that the motor draws less current than mentioned on the ESC)
- Brushless Motor(In my case an A2212
)
Arduino Brushless Motor Code
In this code, we are simply mapping or referring 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 changing the max and min values of the ESC i.e 1000 and 2000 to different values, in other words, you may need to calibrate it, Because Different ESC’s may have a diffrent start point and end point.
#include <Servo.h>//Using servo library to control ESC Servo esc; //Creating a servo class with name as esc void setup() { esc.attach(8); //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 }
Wiring up the Circuit
First, connect the three terminals of Brushless motor to 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 color 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 an 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.
Watch my Youtube video on this Subject
Great video! Thanks a lot!
I used the same set up, but the motor won’t spin. Instead, it only beeps. Do you have any idea why that might be?
Kind regards,
Pedro
Hi,
I have changed the max and min values in this line of code
val= map(val, 0, 1023,1000,2000); to
val= map(val, 0, 1023,900,2100);
You can download the code from the link below,See if it works for You.
https://drive.google.com/file/d/0B3rPP-yeB37WanVOS0s4RmhhbkU/view?usp=sharing
With Regards,
RZtronics
Pedro,
I had the same issue, a quick check of the net showed I had wired up the potentiometer back to front. Try swapping the 2 outside wires the other way.
Also the code needs to be watched. On the code it says esc.write(9) whereas it should be esc.write(8) as the piece says to connect pin D8.
Hi, I have encountered the same problem, I am sure it is the same setup and same code, did you manage to solved the problem?
Thanks for de code en video
it is the right code for my HDD grinder
With regards
Fourstar
hai ,, can u plz help me by specifying the resistance of the potentiometer used….??
Undeniably believe that which you said. Your favourite reason appeared to be at the
net the easiest factor to take note of. I say to you, I certainly
get irked whilst other folks think about worries that
they plainly do not know about. You managed to hit the nail
upon the top and defined out the entire thing
without having side-effects , folks could take a signal.
Will likely be again to get more. Thanks
bro can u suggest me how to use two brushless motors with ardunio
Hey There,
This tutorial worked like a charm. To the extra people alway asking for more information, research it, the answers are out there.
Hey i need to know how you set the mix max values for the potentiometer as 0-1023
thanks
what is mean by avrdude:stk500_getsync() attempt1of 10 not in sync resp 0x100
is errorr while uploading sktchs
please zzzzzzzzz
help meee
What if my brushless motor starts to beep constantly, what does that indicate? I tried changing the min-max values, and also checked everything has connectivity, and im still at odds with this