Instead of using a pre-made adapter, I built a custom USB to RJ11 cable to connect the Pylontech battery directly to the Raspberry Pi. This allowed me to:
✅ Read real-time battery voltage, SOC (State of Charge), and current flow
✅ Optimize charge and discharge cycles for better efficiency
✅ Feed data into ICM-PI Solar for real-time monitoring and automation
Pylontech batteries use RS232 for communication, via a RJ11 connector. The key pins for serial communication are:
Pin | Function | Connection |
---|---|---|
2 | TX (Transmit) | Connect to RX on Raspberry Pi |
3 | RX (Receive) | Connect to TX on Raspberry Pi |
5 | GND (Ground) | Connect to GND on Raspberry Pi |
Since RS232 operates at different voltage levels (±12V) than the Raspberry Pi’s UART (3.3V TTL), a RS232-to-USB adapter or RS232-to-TTL converter is required.
To interface with my Raspberry Pi, I used:
Once the cable was connected, I followed these steps:
1
lsusb
1
ls /dev/ttyUSB*
1
sudo chmod 777 /dev/ttyUSB0
udev
ruleFor a stable system we need to create a new udev
rule to have a unique device name after reboot.
Create file 99-usbserial.rules
in /etc/udev/rules.d
:
1
touch /etc/udev/rules.d/99-usbserial.rules
Add the following rule to the created file (you need to replace your-device-vendor
and your-device-id-product
with your own device vendor and product id using lsusb
command):
1
echo 'SUBSYSTEM=="tty", ATTRS{idVendor}=="your-device-vendor", ATTRS{idProduct}=="your-device-id-product", SYMLINK+="ttyUSBPylontech"' > /etc/udev/rules.d/99-usbserial.rules
A real-time battery monitoring system that provides detailed insights into the solar setup-without relying on expensive adapters or third-party solutions!
If you’re working on a similar project or need help setting up your solar battery monitoring 🔌🔋, feel free to reach out!