Introduction: ESC Programming on Arduino (Hobbyking ESC)

Hey there,

I'm going to show you how to program and use a Hobbyking ESC. I just found a few information and tutorials which really didn't help me very much. So I decided to program an own sketch, which is very easy to understand.

Good to know:

* ESC stands for Electronic Speed control

* The ESC has a 5 V (not used), GND and Signal pin like a servo

* You control it like a servo with write() or writeMicroseconds

Step 1: Receiving ESC Information

You should pay attention to the ampere value of your ESC. In this tutorial a 20 A ESC is used:

I can't really promise that this is working with any other ESC but i think so, because in the english manual 20 and 30 A ESC's are described. In the German version you find a generalization from 10 to 120 A, that's why I think this could work for every other ESC.




Step 2: Arduino Connection

I tried it with an arduino uno R3. I guess it should also be possible with other arduino models like Duemilanove or Mega.

First you have to connect the ESC to your battery. Next, connect the ESC like so:

* Black to GND

* White/Yellow to PIN 9

The ESC is now on, which is why it is important that you DON'T connect the red wire to your 5V Port, because it could destroy your computer's USB Port.

On this picture you can see the correct connection between ESC and Arduino (Mega).

Picture source:

Step 3: The Sketch

Just copy and paste this Code to your IDE:


Coded by Marjan Olesch

Sketch from


#include <Servo.h>

int value = 0; // initialize the variables you need

Servo firstESC, secondESC; // you can control 2 or more servos simultaneously

void setup() {

 firstESC.attach(9);   // attached to pin 9

 Serial.begin(9600);   // start serial at 9600 baud


void loop() {

//First connect your ESC WITHOUT arming. Then open the serial and follow the instructions.



   value = Serial.parseInt();   // parse an integer from serial


Step 4: Understanding and Programming an ESC

ESCs are programmable. You just don't need a language to program them, but simple interactions via the serial. The ESC communicates with sound codes.

To open the menu (which runs infinitely) you just have to do following Steps:

* Connect your ESC

* Adapt the code for all ESCs you need to configure

* You should hear nothing at the beginning, because the Arduino sends a zero

* Open your serial monitor and send '2000'. it's the highest Signal the ESC can receive

* You will hear the sounds described on the picture ( Source: Manual:

The Hobbyking ESCs can receive a signal between 700 and 2000 us. 700 means 'throttle at lowest position' and 2000 'throttle on the highest position'.


- Write 2000 us

- Wait for 'D-D-D-D' to chose lipo as battery type

- As soon as the third 'D' appears write a 700 in your serial (delay compensation)

- The ESC will make a sound to confirm that the option is picked

I hope i could help you with this tutorial.