Trybotics Logo

ESC Programming on Arduino (Hobbyking ESC)

DESCRIPTION

Hello Community,

I'm going to show you, how to program and use the 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 simple to understand.

Important to know:

* ESC means Electronic Speed control
* The ESC has a 5v(not used), GND and Signal Pin like a Servo
* You control it like a Servo with  write() http://arduino.cc/de/Reference/ServoWrite
* or writeMicroseconds  http://arduino.cc/de/Reference/ServoWriteMicroseconds

In my Example i use writeMicroseconds, because it is easier to understand.
So let's go...

Description:

You really should remark the Amperevalue of your ESC. This tutorial is only tested on 20 AMP ESC :
http://www.hobbyking.com/hobbyking/store/__15202__hobby_king_20a_esc_3a_ubec.html

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

Source:
German: http://tom-620.bplaced.net/rc_modelle/zubehoer/regler/hobby_king/hk_80A_regler_deutsch.pdf
English: http://www.hobbyking.com/hobbyking/store/uploads/811103388X7478X20.pdf

Description:

I tried it with an arduino uno R3. I think it's also possible with an e.g. arduino Duemilanove or Mega.

First you have to connect the ESC to you lipo or NiMH. When you have done that you connect the ESC like so:

*  Black to GND
* White/Yellow to PIN 9


Because you connected the ESC to your battery, the ESC is put under voltage. Thats why it 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: http://1.bp.blogspot.com/-eqDaRgO5FjU/T9U3avwT2-I/AAAAAAAAALE/-8pj4qD12Q0/s1600/Figure2_2_edit.jpg

Description:

Just copy and paste this Code to your IDE:






/*
Coded by Marjan Olesch
Sketch from Insctructables.com
Open source - do what you want with this code!
*/
#include <Servo.h>


int value = 0; // set values you need to zero

Servo firstESC, secondESC; //Create as much as Servoobject you want. You can controll 2 or more Servos at the same time

void setup() {

  firstESC.attach(9);    // attached to pin 9 I just do this with 1 Servo
  Serial.begin(9600);    // start serial at 9600 baud

}

void loop() {

//First connect your ESC WITHOUT Arming. Then Open Serial and follo Instructions

  firstESC.writeMicroseconds(value);

  if(Serial.available()) 
    value = Serial.parseInt();    // Parse an Integer from Serial

}

Description:

ESC are programable like IC's or even your Arduino. You just don't have a language to program, but a menu made of sounds.

To come in this menu, which runs infinite btw you just have to do following Steps:

* Connect your ESC
* Configure the code (as much as ESC's you have and Pin-configuration)
* You should hear nothing, because the Arduino sends a zero
* Open your Serial Monitor and send '2000'. it means the highest Signal the ESC can receive
* You will hear the sounds which are described on the picture ( Source: Manual: http://www.hobbyking.com/hobbyking/store/uploads/811103388X7478X20.pdf)


The Hobbyking ESC's can receive a Signal between 700 and 2000 us(microseconds). 700 means throttle at lowest position and 2000 on the highest Position. If you want to know what exactly you du, when you pick a menu visit the manual.

Example:
- Write 2000 us
- Wait until D-D-D-D to chose lipo as batterytype
- When it apperas, write at the third 'D' 700 in your Serial ( short delay, thats why you have to send it at the third 'D')
- ESC will make a sound, and the Option is chosed.



I Hope i could help you with this tutorial.


YOU MIGHT ALSO LIKE