Hits since 2023-11-25 00:43:45:

Joe's Life

Eco Six Charger:

I made a C language decoder for the data produced by my HobbyKing Eco Six AC/DC charger.

Click here to download the source file. You will, of course, need to compile it.

Here is a graph that I made (using gnuplot) from data produced by my decoder.  Click on the image for a full size view:

By the way, I am a Linux user. My Linux distribution (Slackware) comes with a C language compiler, and I know a little C programming. So with help from Niobos I wrote a decoder in C.

I got the data from my charger using a homemade cable. I learned how to make this cable from Andy.

The steps to collect and decode data go like this:

1.  Connect the charger to the cable to the (Linux) computer and turn on the charger and the computer.  The cable has a red power led that should light also.

2.  Set the computer's baud rate to 9600. I use "screen /dev/ttyUSB0 9600" as root to do this.  You can start charging or discharging to test the data transfer, as either operation should cause (unreadable) data to appear.

3.  You may want to power off and back on the charger at this point.  That clears the charger's registers and results in data that may be easier to use.

4.  Start collecting data.  To do this you'll need to open another Linux console or terminal window since the first one is busy with screen.  You can leave it running or terminate it with "killall screen" as root.  You can collect data as root, but if you're like me, you avoid using root.  My /dev/ttyUSB0 belongs to group dialout.  So I added myself (user joe) to dialout by doing this as root:

      usermod -a -G dialout joe

Use "groups (user)" before and after the above to verify that (user) has been added to dialout.

Now collect data like this (as an ordinary user):

      cat /dev/ttyUSB0 > raw_data

5.  You are collecting data, but no data actually arrives in file "raw_data" until you put a battery on charge (or discharge).  Do that.  Notice the green Rxd led blinking on the cable.

6.  At any point in the data collection you can look at what you have collected.  Go to another console or terminal window.  Check the size of file "raw_data" with ls -l.

To view file "raw_data" you'll need to convert it using the decoder.  Download file mass1_16p3.c and compile it like this:

      gcc mass1_16p3.c -o mass

Then use it to view the data (while it is still being collected) like this:

      cat raw_data | ./mass | less

Or save the decoded data to a file like this:

      cat raw_data | ./mass > data.ssv

I give it a ".ssv" suffix because it is "Space Separated Values" which is similar to .csv for "Comma Separated Values", but you can call it whatever you like.


Once you have file data.ssv you can plot it with gnuplot.  This takes a little learning, but is simple, really.  Gnuplot is a common Linux tool, and comes by default in the Slackware distribution.

© Joseph Rosevear
  |   Source touched: 2024-05-10 16:00:25