Icharger project

Started by A.l.b., August 17, 2021, 03:45:37 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


As some of you guys know, I have been working on a project that allows people to monitor their batteries on their phone.

I know some of you work in the IT sector and could possibly provide a solution to a problem I have encountered.

I am currently trying to figure out how to to get the charger to play nice with my Linux thinclient computer.

All ichargers are able to communicate and be controlled by computers with MODBUS. I was able to communicate with other devices over UART with the standard 8 bit packet length but modern ichargers such as the x/s series have dropped this feature in favor of a USB-HID modbus connection with a 64 bit packet length.

I have not yet successfully communicated with the charger over usb however somebody else has.
(Link to the git repository Below)


All I need to be able to do is read and write to registers on the charger over the usb interface as that is the only part I am having issues with.

I can work with Python and c but python is preferred. A library called pymodbus has worked for me well so far.

Here are links to the icharger documentation.

(Icharger x series)

(Icharger duo series)


I plan on open sourcing my project when I get it working properly.

Any input or help is appreciated!
Emaxx + parked car  don't mix..................


Have you looked at the links you posed? Looks like there's hid modbus usb code in the demojunsimodbushid.zip file that was in one of the links you posted. Bunch of C++ files and some Windows libraries. Is the issue you don't want to run on Windows?

The MemStruct.h file clearly lays out the data.

The demo .zip file looks like it's a Microsoft MFC application.

If you're a bit more clear on what you need help with, I might be able to give you some pointers...


Yes having everything running on Linux is definitely preferred. The charger will be controlled by a small Intel nuc computer running Ubuntu 20.04. I actually had a video call with John Clayton (the creator of the GitHub repository I linked) and told him what I was up to a few months ago. After some discussion I had a better understanding how his program worked.

He ended up using a raspberry Pi 3 running hypriotos and accepted requests through a rest API he created. I was able to obtain his image and run it on one of my raspberry pi computers. His rest API works for the most part but has some odd charger behavior such as overwriting existing charging profiles.

He noted that the charger should show up at /dev/ttyusb0

However, on Ubuntu 20.04 I noticed the charger shows up as /dev/usb/hiddev0 and will not except any read or write requests. I made sure hiddev0 had appropriate permissions but still no luck. I am currently working on solving this issue.

I would like to know if you have any libraries or documentation you would recommend for communicating with a modbus device like this over usb. Just to make sure I am on the right track since I'm sure you have way more experience with modbus communication compared to me lol.
Emaxx + parked car  don't mix..................


I've used libmodbus for dealing with modbus communication. There is a python wrapper for it called pylibmodbus: https://github.com/stephane/pylibmodbus. The maintainer for libmodbus is also the maintainer for pylibmodbus.

Sounds like you've got a problem configuring your OS. I would expect your USB device you are attempting to communicate through using modbus should be presented by the operating system to the application layer as a serial port. The fact that the physical layer happens to use USB should be immaterial to your solution.