How to Run a Brushless Motor ESC With Arduino





Introduction: How to Run a Brushless Motor ESC With Arduino

This instructable will show you how to configure and run a brushless motor ESC with an arduino and run a brushless motor at different speeds. It will go through the materials, setup of hardware, and the software coding. It will explain what each step in the coding does. Don't get hurt and have fun!

Here is a video of the motors working.

Step 1: Obtain Your Materials

You will need to get:

Arduino (Any will do, I used an Arduino Mega)

Computer with Arduino Coding program on it.

USB connector

ESC (Any will do, I used a generic brand at 30 AMPs)

A 10 AMP brushless motor,

Connector wires

Soldering iron w/ Solder

Battery (Any battery that is 12 volts, is 2 or more cells, I used a 3 cell 11.1 volt battery)

Step 2: Wiring and Hardware Setup

- Plug in the soldering iron to warm it up then line up the ESC with the motors wires (The ESC’s wires should have three of the same exact wires on one side, the other side is for the battery and Arduino)

- Once the soldering iron is heated, put the motor control wires going out of the ESC together with the wires going out of the motor. The middle wires have to go together, but the 2 side wires can be switched to reverse the direction of the motor. Finally, you need to use the soldering iron to warm-up the wires, this should take about 5-10 seconds, then melt the solder on the wires to bond them together.

- Take the input wire from the esc (The one that looks like a servo wire) and attach the ground to ground and the signal (white) to pin 9. The positive wire should be connected to vin ONLY if the arduino is not connected to the computer. If it is connected to the computer, do not attach the positive wire to anything or it will burn out your your computer

- The thick red and black wires coming out the bottom should be connected to the battery.

Step 3: Software/Coding

- You will need to plug your arduino board into the computer with the USB connector first. Then, you can download the below program. After the program is downloaded, press the reset button on the arduino before plugging the battery into the ESC. The motor will make a start up noise, then it will wait. After a few seconds, the motor will beep 3 times and then gradually move to the speed programed. It will then gradually move back down to zero speed. You can edit the program for how fast the motors go and how long they stay on. Do not set the motors to a speed above 85% power or the ESC will burn out.

//This code can be used for any purpose.

#include Servo ESC1;

int pos = 0; //Sets position variable

void arm(){

setSpeed(0); //Sets speed variable delay(1000);


void setSpeed(int speed){

int angle = map(speed, 0, 100, 0, 180); //Sets servo positions to different speeds ESC1.write(angle);


void setup() {

ESC1.attach(9); //Adds ESC to certain pin. arm();


void loop() {

int speed; //Implements speed variable

for(speed = 0; speed <= 70; speed += 5) { //Cycles speed up to 70% power for 1 second

setSpeed(speed); //Creates variable for speed to be used in in for loop



delay(4000); //Stays on for 4 seconds

for(speed = 70; speed > 0; speed -= 5) { // Cycles speed down to 0% power for 1 second

setSpeed(speed); delay(1000);


setSpeed(0); //Sets speed variable to zero no matter what

delay(1000); //Turns off for 1 second




  • Paper Contest 2018

    Paper Contest 2018
  • Pocket-Sized Contest

    Pocket-Sized Contest
  • Science of Cooking

    Science of Cooking

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




Hi, this is another method I know please review this that it wouldn't hurt any component:

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



void loop()


int val; //Creating a variable val

esc.writeMicroseconds(val); //using val from 1000-2000

sir can you please teach me how to connect 4 brushless motor in a arduino UNO

Di u finish ur drone sir ?

Hi, this is the first time I'm using a brushless motor. Is it possible to make the motor spin in opposite direction using this method? Thanks in advance.

I think i did it right. For me it beeps once then 2 seconds later it just beeps over and over any guess what the problem might be. Thx in advance

How should I connect 4 brushless motor in arduino UNO ?

can i use esc and brushless motor for a autonomous sumobot

You can, but its not recommended, because they consume a lot of power, like 20-40 Amps and they are quite big for a mini sumo or something like that. i would recommend a small motor with a reductor/gearbox attached to it. A brushed DC Motor can consume like 0.5-3A, so, i would suggest a brushed motor instead of a brushless, but yes you can and if you're gonna go the brushless motor route i would suggest a 2100Kv brushless motor from Hobbyking like this one: and you would need a powerful esc for it, because this motor can draw around 80A continuously and that can cost way more then a DC motor. And if you want to go the DC motor route I would suggest a brushed motor with a gearbox like this one: these ones are powerful, fast and pretty power efficient and well, i'm building a Mini Sumo robot myself and i use these ones. I hope i answered your question and take care!

hello i did every thing that you said and still it did not work just some beeps and that's all can you help me


lipo 11.1v 2200mah

Hello IkramA7,

There are some trivial mistakes in the code if you have it blindly it causes trouble. To list

#include <Servo.h>

which I think you have corrected since it compiled and beeped.

Parts of code have been commented




Just put them back in code I guess it'll work