Reverse Engineering of HobbyKing ESC Programming Card

Reverse Engineering of HobbyKing ESC Programming Card © GPL3+

I bought a programming card for the hobbyking ESC series, so I thought to create an Arduino sketch for you to program your ESC without it!

  • 9,961 views
  • 14 comments
  • 27 respects

Components and supplies

About this project

This project works with this Programming Card - Link as you can see it can program a LOT of HK esc like as the famous F-20A and many more:

  • Hobby King 120A ESC 4A UBEC
  • Hobby King 80A ESC 4A SBEC
  • Hobby King 60A ESC 4A UBEC
  • Hobby King 40A ESC 4A UBEC
  • Hobby King 30A ESC 3A UBEC
  • Hobby King 20A ESC 3A UBEC

I'm an Arduino and AVR fan, as I knew these esc mount an ATMEGA8 as MCU (microcontroller) so with a little bit of reverse engineering I could figure it out how to program them!

A programming card is a very helpfull tool to have, expecially when you want to be sure that your esc are all with the same settings (you don't want a esc with the brake ON, do you?). The problem is that usually people realize that they need it when the drone almost ready to fly and no one like to wait weeks to have it!

It will work with every Arduino board like as nano, micro , due, ecc. The connection are incredible easy and you don't need to solder anything. The code is easy, you just have to copy and paste in your Arduino IDE, choose the option that you like and it's all done!

You can also program all your ESC in one time connecting all the signal together.

If you like the world of drones, follow me, I am going to make a lot of projects for you, such as:

And don't be afraid to show your like/respect, it would be an exhortation for me to continue making stuff!

Code

sketch for programming the escArduino
you have just to choose the pin where you have wired your esc than comment and uncomment the setting that you want to change and upload it
remember to select only a define per group
#include <SoftwareSerial.h>

#define esc 9  // chose where yo wire your esc
SoftwareSerial programmer (6, esc); // RX, TX

/*
   realized by Vincenzo G.
   for a lot of HK esc, check it:
   http://www.hobbyking.com/hobbyking/store/__17204__HobbyKing_ESC_Programming_Card.html
*/

// select which setting do you wish to upload
// choose only a define for every group
// default settings:


#define brake_off
//#define brake_on

#define battType_lipo
//#define battType_NiMH

#define timing_auto
//#define timing_7-22
//#define timing_22-30

#define rotation_normal
//#define rotation_reversed

#define protection_reduced
//#define protection_stop

#define battProtection_3V
//#define battProtection_2_8V
//#define battProtection_3_2V

#define start_soft
//#define start_ACC
//#define start_verySoft


void setup() {

  programmer.begin(4800);

  delay(2000);

  program();

}

void loop() {}


void program () {
  init_esc();
  set_battType();
  set_protection();
  programmer.write(248);
  set_battProtection();
  programmer.write(128);
  set_rotation();
  set_timing();
  programmer.write(248);
  set_start();
  programmer.write(120);
  set_brake();
  end_esc();
}


void init_esc() {
  programmer.write ((byte)0);
  programmer.write (248);
  programmer.write (248);
  programmer.write (120);
  programmer.write (248);
  programmer.write (120);
  programmer.write (248);
}

void set_battType() {
  int battType;
  int battType2;

#ifdef battType_lipo
  battType = 120;
  battType2 = 128;
#else battType_NiMH
  battType = 0;
  battType2 = 0;
#endif

  programmer.write(battType);
  programmer.write(128);
  if (battType2 != 0)  programmer.write(battType2);
}

void set_protection() {
  int protection;

#ifdef protection_reduced
  protection = 120;
#else protection_stop
  protection = 0;
#endif

  programmer.write(protection);
}

void set_battProtection() {
  int battProtection;
  int battProtection2;

#ifdef battProtection_3V
  battProtection = 248;
  battProtection2 = 248;
#endif

#ifdef battProtection_2_8V
  battProtection = 120;
  battProtection2 = 248;
#endif

#ifdef battProtection_3_2V
  battProtection = 120;
  battProtection2 = 0;
#endif

  programmer.write(battProtection);
  if (battProtection2 == 248) programmer.write(battProtection2);
}

void set_rotation() {
  int rotation;

#ifdef rotation_normal
  rotation = 0;
#else rotation_reversed
  rotation = 120;
#endif

  programmer.write(rotation);
}

void set_timing() {
  int timing;

#ifdef timing_auto
  timing = 128;
#endif

#ifdef timing_7-22
  timing = 0;
#endif

#ifdef timing_22-30
  timing = 120;
#endif

  programmer.write(timing);
  if (timing == 128) programmer.write((byte)0);
}

void set_start() {
  int start;
  int start2;

#ifdef start_soft
  start = 120;
  start2 = 0;
#endif

#ifdef start_ACC
  start = 128;
  start2 = 128;
#endif

#ifdef start_verySoft
  start = 0;
  start2 = 0;
#endif

  programmer.write(start);
  if (start2 != 0)  programmer.write(start2);
}

void set_brake() {
  int brake;

#ifdef brake_off
  brake = 0;
#else brake_on
  brake = 120;
#endif

  programmer.write(brake);
}

void end_esc() {
  programmer.write (248);
  programmer.write (128);
  programmer.write (248);
  programmer.write ((byte)0);
}

Schematics

connection between esc - motor - arduino
super easy connection! and you can also program all the esc together!
C4729a84546e64b2
bytes for every settings
i realized this to show you what i change ;)
Immagine
default bytes and others
done during the reverse engineering work to be sure that everything was correct
default%20and%20others.txt

Comments

Similar projects you might like

Programming Nextion LCD Without SD Card

by Tamer Savaşcı

  • 18,213 views
  • 5 comments
  • 9 respects

Programming 4 Digit 7 Segment LED Display

by SAnwandter1

  • 138,094 views
  • 35 comments
  • 104 respects

Programming 8x8 LED Matrix

by SAnwandter1

  • 203,353 views
  • 40 comments
  • 187 respects

Getting started with IMU (6 DOF) motion sensor

Project tutorial by Aritro Mukherjee

  • 88,821 views
  • 19 comments
  • 56 respects

Graphical Programming Drawing Robot On The Wall

Project tutorial by KittenBot

  • 14,316 views
  • 1 comment
  • 52 respects

SD Card Temperature Data Logger

Project tutorial by 3 developers

  • 10,499 views
  • 0 comments
  • 10 respects
Add projectSign up / Login