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.

accucel

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.

foca

accucel_pinout

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.

realterm_screen

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 log.py COM14

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

Time(s),Minutes,Voltage(V),Current(A),Charge(mAh)
0,45,6.14,0.1,76
1.487,45,6.14,0.1,76
2.974,45,6.14,0.1,76
4.446,45,6.13,0.1,76
5.934,45,6.14,0.1,76
7.405,45,6.14,0.1,76
8.878,45,6.14,0.1,76
10.35,46,6.14,0.1,76
11.837,46,6.14,0.1,76
13.324,46,6.14,0.1,76
14.796,46,6.14,0.1,76
16.283,46,6.14,0.1,76
17.755,46,6.14,0.1,76
19.242,46,6.14,0.1,76

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 log.py /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.

5 thoughts to “USB Datalogging on the Turnigy Accucel 6 Hobby Charger”

  1. Hi, there is a free program called logview (logview.org) which imports data from USB TTL and shows discharge/charge curves for many chargers, including yours. It is preset – you need only to select a model and it decodes and shows all the data.

  2. All versions of iMax B6 mini and Turnigy Accucell have removed the USB mode option from the menus as of january 2014 so this no longer works

  3. Could someone please confirm Randy’s post. I find so many recent videos on youtube where they are doing it with (which looks like new) imax b6. This is my main reason to buy it and it would be a waste if it was true. Thanks.

  4. Hi, my Turnigy Accucell 6 is working pretty fine with your tips. Really thanks for the info, scripts, etc. The ideal implementation in my point of view will be add a blue tooth in the Turnigy´s serial port and make a program to get the data and generate the graphics. That´s a good idea, isn´t it? Well, I will try someday, I hope… stay tunned. Today I am using excel to generate the charge/discharge graphic.
    Thanks again for your tips.
    Carlos/Brazil.

Leave a Reply

Your email address will not be published. Required fields are marked *