A Venus OS 'plugin' to read out Victron's Lynx Distributor without a Lynx Smart BMS. It requires a custom adapter hardware (see below) and emulates a battery (without SoC, ...) on DBUS just providing the distributor information.
Disclaimer
This plugin comes without any guarantees or warranties. Use it at your own risk. I only tested it on my hardware setup.
The Lynx Distributor has a RJ10 connector for daisy-chaining distributors and connecting them to a Lynx Smart BMS. According to the manual, section 3.3 the PCB can be also used without data transfer by providing 5 V.
I reversed engineered the data communication on pins 2 and 3 of the connector and came to the following conclusions:
It's an I²C interface. The cable has the following mapping:
Pin 1 - yellow - 5V
Pin 2 - green - SDA
Pin 3 - red - SCL
Pin 4 - black - GND
A pull-up resistors (I used 10 kΩ) is required on SDA/SCL to 5V.
The device answers on I²C address 0b000001AA
where AA
is set by the address jumper. So in default configuration the address is 0x8
.
Any reads on the device will always return the same status byte with the following meaning:
0b00000000 - Everything allright (center LED is green)
0b00000010 - No supply on bus bar (center LED is orange)
0b00010000 - Fuse 1 open (center LED red, first fuse LED red)
0b00100000 - Fuse 2 open (center LED red, second fuse LED red)
0b01000000 - Fuse 3 open (center LED red, third fuse LED red)
0b10000000 - Fuse 4 open (center LED red, forth fuse LED red)
If multiple fuses are open multiple bits are set (just or the values).
As Cerbo GX doesn't provide any I²C interfaces an adapter is needed. I choose the C232HM-EDHSL-0 from FTDI as it is 'premade' available. I personally used the 3.3V variant (C232HM-DDHSL-0) which provides less than the according to the manual required 5V, but it works on my device.
Any other FTDI adapter/board using a FT232H chip should work. The bigger variants FT2232H and FT4232H won't work without adaptions in the software as they don't feature the open-drain option for the pins (see comment on page 4 of FTDI's AN 255). Be aware of counterfeit FTDI chips and buy from a trustworthy source!
The following connection's need to be made:
As Venus OS supports those FTDI's chip by default it would the Linux kernel's USB serial driver for them and scan the serial ports using serial-starter
. To avoid this I changed the VID/PID of the FT232H chip using FTDI's FT_PROG.
The VID 0x0403 / PID 0xD4F8 I used is out of a PID block I got from FTDI in 2005. Feel free to re-use on your adapter/board as well.
Besides the VID/PID I changed the Manufacturer to 'twam.info', the Product Description to 'I2C Master' , Port A's Hardware to 245 FIFO and Port A's Driver to D2XX Direct. All those should be optional.
See above.
Adafruit offers a FT232H Breakout, which also works fine. I used the 3.3V supply (and not the 5V) as with the 5V the Lynx Distributors didn't answer I2C requests. The breakout always pull SCL/SDA to only 3.3V which might be not enough for the Lynx Distributor if running at 5V.
To be able to use I²C with the FT232H chip its MPSSE mode must be used. There are plenty of options to use this mode (FTDI's official drivers, libftdi, pyftdi), but all of them required custom drivers, ... to be compiled/installed on Venus OS which are not premade available.
Therefore I re-implemented the the required drivers parts in Python just using https://github.com/pyusb/pyusb
which is available on Venus OS via pip
.
Download into /data/dbus-lynx-distributor
on your Venus device (e.g. Cerbo GX) and run install.sh
Rename config.sample.ini
and change to needs.