irekzielinski / pylontech-battery-monitoring Goto Github PK
View Code? Open in Web Editor NEWAdding WiFi monitoring to US2000B and US2000C batteries.
Adding WiFi monitoring to US2000B and US2000C batteries.
I have to state that the need to switch baud rates and send the "~20014682C0048520FCC3\r" string is a mistake that results from not understanding the different Pylontech ports and protocols. While this is the correct method to switch the RS485 (!) port from the semi-binary packet/frame mode to console mode, it is not necessary to be done when the RS232 (!) Console port is used.
The code WOULD make sense if the RS485 port with an RS485 transceiver is used.
Using the code on the Console port doesn't do any harm but sends unnecessary garbage to the console shell.
See the RS485 protocol documentation (https://github.com/Frankkkkk/python-pylontech/blob/master/RS485-protocol-pylon-low-voltage-V3.3-20180821.pdf). The above string can be found there: "~" is the "Start of Information" byte, followed by protocol version, address, etc. up to a checksum and the "End Code" (\r).
Summary:
port labeled "Console": RS232 interface, speaks "console shell"
port labeled "RS485": RS485 interface, speaks frame based "Pylontech Low Voltage Protocol" but can be switched to "console shell"
port labeled "CAN": CAN bus interface, speaks CAN protocol
Hi.
Wanted to ask if the circuit only works with the SparkFun MAX3232 or also with other RS232-TTL converters.
Have taken another but get no data. Now the question is whether it is because it only works with Sparfunk.
Hi,
do you know how to set time of US3000 via serial ASCII command please ?
Usage from help doesn't works.
time 2022 4 11 9 59 0
Invalid command or fail to execute.
Usage:
Time - time [year] [month] [day] [hour] [minute] [second]
But how is US3000 synchronized with inverter Studer XTM, XTH ?
Over Studer CAN Adapter from xtender ?
Thanks for help.
Jozef from Slovakia
Hi,
Thank you for the good work. I'm happy that i can now monitor my batteries.
How can I visualize the received data into HomeAssistant?
Regards
Adi
Can it also work with RS485?
I have a ROSEN SOLAR 10kWh powerwall and some say, has the same BMS inside.
But has no serial port...
Hi,
I disovered this Github file to do the same, to get information from my pylontech battery,
I tried without any sucess to compile and load the ino file with arduino ide, using MQTT , so I uncommented the ligne 17
I did all the same as described into the readme but I got an error
D:\PylontechMonitoring\PylontechMonitoring.ino:29:10: fatal error: PubSubClient.h: No such file or directory
I did not do the connection yet to the pylontech battery, only the esp8266 plugged to the PC to compile and load the ino file
in order to test the send command to Mosquitto broker and check if norered can get and read data from the esp8266 even if the esp8266 is not connected to the pylontech battery
Did anyone already have this issue ?
I thank you for your support
Manu
Hello,
Excelent work
That's exactly what I had and my head.
I will realize your project as it is and save a lot of time.
congratulations and thank you
Hi,
Which is the password for OTA upload?
Regards
Adi
Hi all,
In general all works well and I've access to the Pylontech Batteries.
But if I like to enable the MQTT function, I get the following error, if I try to compile it:
....Documents\Arduino\libraries\ESP8266_Microgear\MicroGear.cpp: In member function 'void MicroGear::syncTime(Client*, long unsigned int*)':
....Documents\Arduino\libraries\ESP8266_Microgear\MicroGear.cpp:150:23: error: 'class WiFiClientSecure' has no member named 'setFingerprint'
clientsecure->setFingerprint(tstr);
^
....Documents\Arduino\libraries\ESP8266_Microgear\MicroGear.cpp:159:27: error: 'class WiFiClientSecure' has no member named 'setInsecure'
clientsecure->setInsecure();
I couldn't fine any solution for this issue.
Maybe somebody know how to solve it.
Hi,
I use irekzielinski Pylontech-Battery-Monitoring solutions since years at 2 different locations.
At the first location, I have a Pylontech US2000 at the second location I have a Pylontech US3000.
The solution is working fine.
I did some small modifications, SYSLOG support, change the OTA update procedure, diffrent landing page, ... but the hole functionallity is still from irekzielinski
I ordered a new Pylontech US3000C to replace the Pylontech US2000.
I tried to connect it to my existing WEMOS but a communications was not possible.
I didn't see that irekzielinski updated his documentation and found the the description of how to wire it up now at:
issue5
Also after changing the wiring, I am not able to communicate with the Pylontech US3000C.
According to:
issue1
Wibet10 added a
IIC I2C Logic level converter bi-directional module
and changed the source code
According to:
issue5
The old code is still working without a change.
mduchain identified that the "drop to 1200 baud or send that byte sequence to communicate" is not needed anymore.
And few days later mduchain write "I avoid this by sending a few CR/LF before sending the actual command โ an alternative wakeup sequence of sorts."
Now my question?
Is anyone using the orginal source code from Pylontech-Battery-Monitoring to communicate with a Pylontech US3000C?
Is it working without a IIC I2C Logic level converter bi-directional module?
can you add to the readme what libs need to be installed?
SimpleTimer
Time
ntpclient
Hi Irek,
I notice you have the same Inverter as me., Do you get the data about the power usage at your home from the battery data or do you use some other method to get it from the SOFAR?
Hi,
I have a pylontech US2000B and a pylontech US3000A and I have been using @irekzielinski Pylontech-Battery-Monitoring tool since more than a year.
I am getting the data from pylontech and publish it to my moskitto MQTT broker and use it there.
Normally I switch off my battery at SOC < 20%, but last week my own program did not work and my US2000B battery went down to 0%.
Since then I have not been able to get any data from my US2000B battery.
The output has been changed:
US2000B:
US3000A
Sure, I still get data from US3000A, but the irekzielinski program cannot read the data from US2000B.
Has anyone else seen this? Does anyone know how to change the output format?
Hi
I built a couple of these modules earlier in the year and they have been working great!
I now need to try and use MQTT.
I am not familiar with the Arduino IDE. How do I push the revised code over wifi?
Krs
Mark
I guess it would be very helpful to get the "cylce counts" also availble via MQTT. It's in the command "stats" but it seems, that this value is not inside the MQTT function.
It would be great to get this function... Thanks
I have 4 batteries, the master is US3000C and slave are mixed US2000C and US2000.
I have tried to use you sketch but the battery was not responding, then I connect directly to the console port using putty and it seems that the command to read the battery status is "bat" and not "pwr"
Not sure why it finds 14 batteries and why it differs from standard "pwr" command, maybe due to a new firmware
Hi, i try compile to my ESP8266 but receive error
Arduino: 1.8.13 (Windows 7), Board: "LOLIN(WEMOS) D1 R2 & mini, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 921600"
C:\Users\user\Desktop\Pylontech-Battery-Monitoring-master\PylontechMonitoring\PylontechMonitoring.ino: In function 'void syncTime()':
PylontechMonitoring:310:11: error: 'class SimpleTimer' has no member named 'setTimeout'
timer.setTimeout(5000, syncTime); //try again in 5 seconds
^
C:\Users\user\Desktop\Pylontech-Battery-Monitoring-master\PylontechMonitoring\PylontechMonitoring.ino: In function 'void loop()':
PylontechMonitoring:654:9: error: 'class SimpleTimer' has no member named 'run'
timer.run();
^
Multiple libraries were found for "ArduinoOTA.h"
Used: C:\Users\user\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\ArduinoOTA
Not used: C:\Users\user\Documents\Arduino\libraries\ArduinoOTA
Multiple libraries were found for "SimpleTimer.h"
Used: C:\Users\user\Documents\Arduino\libraries\SimpleTimer
Not used: C:\Program Files (x86)\Arduino\libraries\Time-master
Not used: C:\Program Files (x86)\Arduino\libraries\SimpleTimer
Multiple libraries were found for "TimeLib.h"
Used: C:\Users\user\Documents\Arduino\libraries\Time
Not used: C:\Program Files (x86)\Arduino\libraries\Time-master
exit status 1
'class SimpleTimer' has no member named 'setTimeout'
Any help?
My 3 Pylontech US 5000 do not work with this project.
Can you optimize the Code for Monitoring the US 5000.
Hi,
I noticed the following line:
byte newLineBuff[] = {0x0E, 0x0A};
and ask myself if 0x0E is really intentional or by mistake, as the Carriage Return code is 0x0D.
kind regards,
Thomas
Hello! Couldn't the code be adapted for the BMS SC0500A pylons with H48050 batteries? Your code is perfect, but on the command of the PWR to the serial console, my batteries come to me absolutely, so the parsing then does not work.
I am not proficient in coding, so unfortunately I do not have to make adequate modification of code.
Good morning, could you add communication with the new US2000C and US3000C models? Apparently an rj45 port is already used for console mode but something must have changed in the protocol because the only software that works is MultiSIBControl and it had to make a small update to recognize them http://www.multisibcontrol.net/
Would it be possible to add support for the new models?
Here is information about the connections https://powerforum.co.za/topic/7901-pylontech-us3000c/
Thanks.
Good morning, could you add communication with the new US2000C and US3000C models? Apparently an rj45 port is already used for console mode but something must have changed in the protocol because the only software that works is MultiSIBControl and it had to make a small update to recognize them http://www.multisibcontrol.net/
Would it be possible to add support for the new models?
Here is information about the connections https://powerforum.co.za/topic/7901-pylontech-us3000c/
Thanks.
PD: I still do not have any of these new models but they are probably the ones that will be sold when the stock of old models runs out.
Is their an easy way to modify the sketch to use this on and Arduino Uno with an Ethernet shield.
Hi,
Trying to use fix IP, and by compilation I got:
C:\Users\Fuji\Downloads\PylontechMonitoring\PylontechMonitoring.ino: In function 'void setup()':
C:\Users\Fuji\Downloads\PylontechMonitoring\PylontechMonitoring.ino:20:12: error: conversion from 'const char [14]' to 'IPAddress' is ambiguous
20 | #define IP "192.168.188.5"
| ^~~~~~~~~~~~~~~
C:\Users\Fuji\Downloads\PylontechMonitoring\PylontechMonitoring.ino:108:18: note: in expansion of macro 'IP'
108 | WiFi.config(IP, GATEWAY, NETMASK, DNS);
MQTT :
01 - 00:00 | Wait for WIFI Connection
01 - 00:00 | Wait for WIFI Connection
01 - 00:00 | Wait for WIFI Connection
01 - 00:00 | Wait for WIFI Connection
01 - 00:00 | Wait for WIFI Connection
01 - 00:00 | Wait for WIFI Connection
01 - 00:00 | Wait for WIFI Connection
01 - 00:00 | Wait for WIFI Connection
01 - 00:00 | Wait for WIFI Connection
01 - 00:00 | Wait for WIFI Connection
01 - 00:00 | Boot event
01 - 00:00 | Failed to connect to MQTT server.
01 - 00:01 | Failed to connect to MQTT server.
01 - 00:02 | Failed to connect to MQTT server.
01 - 00:03 | Failed to connect to MQTT server.
01 - 00:04 | New baud: 115200
01 - 00:04 | Failed to connect to MQTT server.
01 - 00:05 | Failed to connect to MQTT server.
01 - 00:06 | Failed to connect to MQTT server.
01 - 00:07 | Failed to connect to MQTT server.
01 - 00:08 | Failed to connect to MQTT server.
01 - 00:09 | Failed to connect to MQTT server.
01 - 00:10 | Failed to connect to MQTT server.
01 - 00:11 | Failed to connect to MQTT server.
01 - 00:12 | Failed to connect to MQTT server.
01 - 00:13 | Failed to connect to MQTT server.
01 - 00:14 | Failed to connect to MQTT server.
01 - 00:15 | Failed to connect to MQTT server.
01 - 00:16 | Failed to connect to MQTT server.
01 - 00:17 | Failed to connect to MQTT server.
01 - 00:18 | Failed to connect to MQTT server.
01 - 00:19 | Failed to connect to MQTT server.
01 - 00:20 | Failed to connect to MQTT server.
01 - 00:21 | Failed to connect to MQTT server.
01 - 00:22 | Failed to connect to MQTT server.
01 - 00:23 | Failed to connect to MQTT server.
01 - 00:24 | Failed to connect to MQTT server.
And Mosquitto Broker says:
2023-12-21 22:12:35: New connection from 192.168.188.5:49743 on port 1883.
2023-12-21 22:12:35: Client closed its connection.
2023-12-21 22:13:36: New connection from 192.168.188.5:49565 on port 1883.
2023-12-21 22:13:36: Client closed its connection.
I have other devices with MQTT connection and they are working fine.
Regards
Adrian
not sure what is wrong ...
I can see the page with the uptime (where can this be set to show correct time?)
but when opening "help" or "power" I wait some time and only see a page with "????"
Hi,
i have a configuration like 7 pylontech us2000c x 2 = 14 bateries.
In order to connect them(the batteries) with the growatt sph4000 inverter i need a lv hub.
It will be nice if this sw for monitoring the batteries can be connected to the hub in order to monitor with one esp8266 all 14 batteries.
it is possible?
what i'm getting wright now is...see attached foto.
Regards
Adrian
With the new version of firmware 2.8 of the us2000c batteries no longer works. It seems that the port is now initialized to 115200 by default, but the problem I see is that it doesn't seem to accept the newline every time a request is sent.
If I use esp and send a request, for example, help, it does nothing, but if I disconnect esp and connect directly to a computer and do the same query using terminal1.9b (with +CR/LF enabled) I get an error of Unrecognized command and it appears to me that the query consists of two help followed by no spaces, that is, "helphelp".
I've gone through the code and tried alternatives to \n or even adding \r to no avail.
It has been working perfectly until I updated to version 2.8 (I added a new battery and upgraded the existing ones).
I have tried everything, including disabling the wakeUpConsole so that it is at a fixed 115200, but without results.
Any idea what may be going on?
I need to read voltage from each cell and send via mqtt, how to add to code?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.