Quadrocopter ESC

For Copter use, the ESC (Electronic Speed Control) for the brushless motors needs to be modified. Usually the signal update rate for the ESC is 50 Hz (20 ms) from the Radio Control (RC). For a smoother control of the copter this update rate should be faster, about 500 Hz.

For an explanation of the ESC, see at Links 1.

In October 2004 Bernhard Konze, see at Links 2, developed an assembler program (Atmel ATmega8) for such a faster ESC operation.

In 2011 Simon Kirky updated the software (Atmel ATmega8) to allow a broader range of commercial ESC to be modified to a faster update rate, see at Links 3.

There is a good list which commercial ESC could be modified, see at Links 4.

Unfortunately in 2014 more ESC are build with a SiLabs C8051F334 MPU (Micro Processing Unit, 8051 core), which could be no longer modified. The good thing is, that Hobbyking.com is now selling ESC with SimonK program already included.


Hobbyking SS18A ESC

I bought in October 2011 4 pieces of Hobbyking.com SS Series 15-18A ESC. Yes, they are very cheap, but the cable to the receiver was shorted to 10 cm, and the Atmel ATmega8 MPU was no longer in the TQFP (Thin Profile Plastic Quad Flat Package, 9 x 9 mm, 0.8 mm pin spacing), instead in the MLF (Micro Lead Frame Package, 5 x 5 mm, 0.5 mm pin spacing), which makes it more difficult to solder wires to the chip for reprogramming, see the picture to the right (click on the picture to magnify).

For the wires I used thin wire-wrap wire. At the free side I glued with hot glue a 6 pin IC socket to the board, and shorted the pins to about 1 mm length. First the 2 power supply wires are soldered. The other 4 wires are soldered one after the other to the chip, see the data sheet page 2 for the pin out.

First I soldered the wire to the IC connector, the bent it, that the tinned end of the wire just touches the pin of the chip. Then, with a head lens and good light, I press for a few seconds with the soldering iron the wire down to the already tinned pin of the chip.

Wiring schematic:
pin IC socket, Signal name, pin of the ATmega8

1  MISO    16 (lower row, most right)
2  VCC     capacitor
3  SCK     17 (right side, most down)
4  MOSI    15 (lower row)
5  Reset-  29 (upper row, 4th from the left) 
6  GND     regulator pin

Software Assembly

For test I use a Servo Tester board.

I started with a hex file tp_8khz.hex and it worked, the motor turned. In the test I once powered the ESC up with the pulse width in the middle (about 1.5 ms). Then I could let the motor run forward and backward, why? It has to do with the parameter RC_PULS_REVERSE which was set to 1 in the source code.

Unfortunately, once set, you can not delete this parameter by software, only by clearing the EEPROM content, which needs a programmer. The same is true for the parameter RC_CALIBRATION, once set to 1.

Therefore I need to set those parameters by myself, and assemble the program by myself.

I wanted to do that on Mac OS, so I installed Crosspack-AVR, see Links 6. Unfortunately the assembler does not follow the Atmel syntax, so I ve to use either Atmel Studio (actual version 6.2, win32 only, about 700 MB), or avra (version 1.3, freeware for Linux, Mac OS, Win32)), see at Links 7. For Linux you get an already compiled program. For Mac OS and Win32 you have to compile from the source code.

Next I tried avra on Mac OS, unfortunately I got an error while assembly:

make tgy.hex
Pass 1...
/bin/bash: line 1:   729 Abort trap: 6           avra -fI -o tgy.hex -D tgy_esc -e tgy.eeprom -d tgy.obj tgy.asm 2>&1
       730 Done                    | grep -v 'PRAGMA directives currently ignored'
make: *** [tgy.hex] Error 134

Doing the same thing on Linux (Ubuntu 14.0) works perfect. Now I had the file tp_8khz.hex and can program the ESC. This program also contains a boot loader for a self update via the pulse input wire. I will describe that in Arduino USB Linker.

Programmer USBtinyISP, avrdude

As a low cost programmer hardware USBtinyISP is used, see Links 5. The software used was avrdude (version 6.0.1) which is available for Linux, Mac OS, and Win32.

I am working on Mac OS, so the command line for programming looks like:

# flashing the ESC program
$ avrdude -c usbtiny -p m8 -U flash:w:tp_8khz.hex

# flashing the fuses for boot load, and brown out voltage 4.0 V
$ avrdude -c usbtiny -p m8 -U lfuse:w:0x3f:m -U hfuse:w:0xca:m

To check for the right fuse bits, you can use an online calculator, see at Links 8.


Once the ESC is mounted, it is no longer easy to reflash a new program. In this case it would be nice to reflash the ESC via the pulse input wire. That can be done with either the Hobbyking.com hexTronik USB Key for HXT BESC, see at Links 9, or an Arduino board, either Uno or Nano 3.0, and the program ArduinoUSBLinker, see at Links 10.

Take care, that you can not flash the fuses, just the program itself.

I have used an Arduino Nano 3.0 board. The connection is:

Arduino Nano   ESC
GND            GND
D2             Pulse Input
# +5 V must NOT be connected

First the program ArduinoUSBLinker.ino must be programmed with the Arduino IDE. You can check if it works by starting the Arduino Monitor with a Baud Rate 19200 baud:

# type: $M< ENTER
# answer:

Then make a connection from the Arduino board to the ESC. The ESC must be self powered. The handling to flash a new program under Mac OS is:

# check for good function:
$ avrdude -c stk500v2 -b 19200 -P /dev/cu.usbserial-A9GNVXD1  -p m8
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.10s
avrdude: Device signature = 0x1e9307
avrdude: safemode: Fuses OK (H:FF, E:00, L:00)
avrdude done.  Thank you.

# flash the new file tp_8khz.hex:
$ avrdude -c stk500v2 -b 19200 -P /dev/cu.usbserial-A9GNVXD1  -p m8 -U flash:v:tp_8khz.hex:i

  1. ESC = Electronic_speed_control

  2. Bernhard Konze, Reprogramming ESC

  3. SimonK, tgy -- Open Source Firmware for ATmega-based Brushless ESCs

  4. Spreadsheet list of ESC with status for modification posibility

  5. USBtinyISP, programmer for Atmel processors

  6. Crosspack-AVR for Mac OS

  7. avra assembler, source code

  8. Atmel fuse online calculator

  9. hexTronik USB Key for HXT BESC

  10. ArduinoUSBLinker

List of pages in this category:

-- RudolfReuter 2014-11-01 10:51:21

Go back to CategoryQuadrocopter or FrontPage ; KontaktEmail (ContactEmail)