USB Datalogging on the Turnigy Accucel 6 Hobby Charger

After owning this great little hobby charger for some time, I wanted to use the data logging capabilities of the Turnigy Accucel-6 unit. In particular, the aim is the plot  some discharge curves of some particular batteries.


A quick search on Google found some articles, but a lot of conflicting information on how to connect the charger to a computer. I decided to perform a few tests on the charger, to see what was really going on, and work out how to connect it to a computer.

Here is what I found out. On the left side of the unit, there is a three pin connector, which doubles up as both a temperature sensor and a serial output. When in serial mode, it sends TTL serial data on the middle pin at 5V levels. The baudrate is 9600 bps, 8 bits, no parity, 1 stop bit (9600-8N1).

To set the charger to send serial data, you’ll need to set it in the menu and make sure USB mode is enabled.

To connect it to a computer, you’ll need a serial TTL to USB connector. There are quite a few options available, some googling shows some advice of the use of cheap Silab chip converters, but personally I prefer to use the more industry standard FTDI chip based adapters. These adapters are pretty cheap, are are based on the FT232 chip, and in some cases,  the newer FT231X part. The one I use is called Foca and it’s under 10 USD from Itead Studios. This unit has a switch that can select between 3.3V and 5V TTL levels. If you use your own adapter, make sure it supports 5V TTL.



To connect to the adapter, connect GND pins from the adapter to charger, and the adapters RX pin to the chargers TX pin. I use some of these female to female jumpers, I think they’re more versatile than the recommended fixed configuration adapters I’ve read on a few forums. They’re only about $3 delivered for 40pcs on eBay. Connect the USB cable and plug it into the computer. The charger only sends data while it charging or discharging so set it to do one of these things. The data is sent in bursts around 1.5 seconds apart, 76 bytes in length. If you look on the USB-Serial adapter, if it has a TX and TX LEDs on it, you might see a burst a data every 1.5 seconds.

Using a terminal program, connect it to the appropriate serial port of the adapter, and you should be able to see the actual data being sent. It is binary data, so you won’t be able to read it straight away. On Windows, you can use some free software like Realterm or TeraTerm. On Mac OS X, I like to use CoolTerm. Remember to connect at 9600 8N1.

Here’s a screenshot of a dump in RealTerm when displaying in Hex+ASCII mode.


You’ll see the data packets are start with a ‘{‘ and end with a ‘}’ char. Here’s a hex dump of a typical packet.

00000000: 7b 9c 84 84 d0 81 80 e4  80 88 85 80 81 8a 85 80 |{...............|
00000010: 81 80 80 8a 81 8c 83 84  81 80 81 81 80 80 8c e4 |................|
00000020: 80 80 8a 86 90 80 80 80  80 8c 92 80 92 80 80 80 |................|
00000030: 80 80 80 80 80 80 80 80  80 80 80 80 80 80 80 80 |................|
00000040: 80 80 80 80 80 80 8a 8f  a4 31 35 7d             |.........15}|

It could take some time to decode this, but Niobos has already spent the time and done most of it on his blog. He has decoded a lot of the data, but I’m only really interested in using the data I need for plotting a discharge curve. This means voltage, current, and capacity. Note that these chargers can only discharge a maximum current of 1A.

I’d like to take this data and save it as a CSV file, so we can plot it and analyse it later on.

On that note, I should mention there is a piece of software called LogView which can read this data. It is a nice piece of software in German, with a somewhat usable English translation. It’s a little old and a bit hard to find the English download, but the site is over here. You’ll need to find the latest version, as I must warn you, if the software detects it has an outdated version and you choose not to update it, it will just close down and not let you use it… bizarre.

To read the serial data, I wrote a Python script, which reads the data through the serial port, and sends CSV data to stdout. You’ll need pyserial installed. Download the script here on GitHub.

To run this program, and view the output on your screen, just pass the serial port as the argument to the script. For example on my Windows machine:

python COM14

You should get an output on the screen similar to this:


To cancel the running script, press Ctrl+C.

To view the data and save it to a file as well, you can use a program called “tee”. On Windows, this might be part of a Cygwin install, or simply download wintee. For example, on Linux you might want to use use:

python /dev/ttyUSB0 | tee log_file.txt

On Windows, you may have to replace “tee” with “wtee”.

The above should also work with other similar “4 button chargers” like the Imax B6, Bantam e-Station etc, as they all run similar (if not identical) firmware.

Update: It’s been reported by Joe Rosevear who has a HobbyKing Eco Six charger, that the data stream for that unit is a little different from this. He has written a C program to parse the data stream from that particular HobbyKing charger.

Coming soon, I’ll show you how I’ll graph the data using gnuplot.