Pylontech US2000B battery monitoring via Wifi

  Рет қаралды 52,677

Irek

Irek

Күн бұрын

Small project to monitor Pylontech batteries via WiFi.
Allows to integrate battert with home automation via MQTT or JSON poll.
Schematics and the code is avaialble on github: github.com/ire...
NOTE: MQTT support has been added since video was uploaded. See details on github page.

Пікірлер: 116
@jochenpuchalla
@jochenpuchalla 2 жыл бұрын
This is the first project that ran at first attempt after following the instructions. THANK YOU! Now my smart home control knows the SOC, wonderful!
@ZielinskiIrek
@ZielinskiIrek 2 жыл бұрын
glad it works for you Jochen!
@DaveWinwood
@DaveWinwood 4 жыл бұрын
A great starting point for my home automation and it works really well. I didn't have a MAX232 so just used s couple of NPN transistors to invert and level shift the TX and RX lines. The batteries are happy to have a 5V signal on their RX line as I don't see any communication issues. Now the fun starts as I try and link this to my RPi 4 which will be the main controller. Have lots to learn yet. Thank you Irek for sharing your project.
@ZielinskiIrek
@ZielinskiIrek 4 жыл бұрын
pleasure and good luck :-)
@Thebustermann
@Thebustermann 4 жыл бұрын
Dave, did you ever manage to do this using your RPi? I dont have access to arduino, so wondering how it went.
@joeybloos9387
@joeybloos9387 4 жыл бұрын
How did you get it working with the transistors?
@leakim971
@leakim971 2 жыл бұрын
you really did an amazing job and provide lot of very useful information in one project, thank you very much
@gerritmueller1977
@gerritmueller1977 2 жыл бұрын
Hi Irek, good job, it's working pefectly in my home, well done!
@clikcspeed
@clikcspeed 3 жыл бұрын
Thank you so much. Used this with ESP8266 - works like a charm! Much appreciated.
@eddiegough8895
@eddiegough8895 4 жыл бұрын
Hi Irek, Sorry for the late reply, as I was not expecting to get an answer and did not check the blog earlier. Many thanks for the answer and I will follow up what you say with my installer, as I am not competent to do it myself. Eddie Gough
@eddiegough8895
@eddiegough8895 4 жыл бұрын
Good News! Installer came today and I pointed out the problem with the charging rate and your comments and they corrected the issue and all is working now. Thanks again for your imput. Eddie Gough
@matematto2.0
@matematto2.0 3 жыл бұрын
a huge, huge, HUGE thank you !
@matematto2.0
@matematto2.0 3 жыл бұрын
Hi @Irek. Thanks to your great work I can now see the 6 "topic" you entered in the code: but are they referred to an average value compared to the "battery_count"? How can I read the values of each single battery? thanks again
@einfachdermartin
@einfachdermartin 2 жыл бұрын
Exellent job!
@anthosta3452
@anthosta3452 5 жыл бұрын
Good job. thank you
@tamashorvath5035
@tamashorvath5035 4 жыл бұрын
Thanks Irek, just made it and works fine :)
@ZielinskiIrek
@ZielinskiIrek 4 жыл бұрын
Great to hear this. Added mqtt support yesterday. Get the latest version if you need it.
@tamashorvath5035
@tamashorvath5035 4 жыл бұрын
@@ZielinskiIrek Oh wow, awesome news! That's exactly what I was gonna have a look at later today. I do need it, I'll check it out. Thanks again!
@tamashorvath5035
@tamashorvath5035 4 жыл бұрын
For some reason I'm not getting anything through MQTT.... Log says "Connected to MQTT server: " but nothing comes when I subscribe to it
@ZielinskiIrek
@ZielinskiIrek 4 жыл бұрын
​@@tamashorvath5035 all topics have "home/grid_battery/" prefix. Try suscribing to for example: home/grid_battery/soc if you still get nothing - add some more logging with Log() command, or see with some MQTT explorer application if really enything is pushed to MQTT or not.
@tamashorvath5035
@tamashorvath5035 4 жыл бұрын
@@ZielinskiIrek I'm trying in node-red, mqtt node reporting "connected" but still nothing.... probably missing something simple and obvious LOL
@Reudiga
@Reudiga Жыл бұрын
Great Work...! What means basestate Dischg? And what is currentDC? Is it watt? Voltage? Same estpowerac, what does that mean? Same PowerDC... Thank you for the awesome work
@georgelza
@georgelza Жыл бұрын
hmm, this til -> rs232, this be the same we'd use to flash a sonoff. sounds/looks like it. I'm primarily trying to put a cable together to use a RJ11 and/or RJ45 to USB (my laptop does not have Serial). but now seeing this... thinking this would a nice side project also, after I've FW upgraded batteries.
@mviertel
@mviertel 8 ай бұрын
Bloody beginner question: for the (safe) assembly of the ESP and MAX323 boards (plus capacitors) you used what? Is that just a breadboard there or what would be recommended?
@ZielinskiIrek
@ZielinskiIrek 8 ай бұрын
I would start with breadboard and when all works use perfboard and solder everything
@silverscooby09
@silverscooby09 5 жыл бұрын
Thanks for sharing this, what voltage capacitors did you use as seeing a range from 16v to 160v
@ZielinskiIrek
@ZielinskiIrek 5 жыл бұрын
Working voltage is only 3.3v so anything above that is ok. 16v would be OK.
@eddiegough8895
@eddiegough8895 4 жыл бұрын
Hi there, enjoyed your video. You seem to know what you are doing, so I thought I would ash a question on the subject: I have 4 Pylontech batteries like yours. I also have solar panels. I notice when the PV system is working and producing electricity it only allows the batteries to intake up to about 450w (at any one time) and the rest either goes into the house use/or goes back to the grid. This means that it would take a long time to fully charge my batteries, and here in Dublin with our weather patterns this can be a problem. Is it possible to increase the intake of the batteries during charging above the 450w limit? Thanks. Eddie Gough
@ZielinskiIrek
@ZielinskiIrek 4 жыл бұрын
Eddie Gough Charge rate is controlled by your inverter/charger. Check settings there. One battery can be charged at around 1.2kw. So for 4 batteries you can go as high as 4.8kw (if your charger can supply as much). Other thing to check is if your CT clamps are installed correctly.
@aleesi2
@aleesi2 Жыл бұрын
great job! do you happen to have a port for the ESP32-wroom ? Thanks
@andreasschmidbauer4481
@andreasschmidbauer4481 2 жыл бұрын
Can i use your Monitoring for the H48050 two?@Irek There ist no Console-Port, but an RS232 Port. Can i use this ? Thx for answers and help. Thx Andreas
@cedrics5370
@cedrics5370 3 жыл бұрын
This is great. Looks exactly like what I need. Does this also work with US200, non B/Plus batteries? @Irek : can this manage 8 batteries?
@ZielinskiIrek
@ZielinskiIrek 3 жыл бұрын
not sure about "non plus" - give it a try, it might. 8 batteries are supported.
@cedrics5370
@cedrics5370 3 жыл бұрын
@@ZielinskiIrek cheers for chiming in. Just read that the latest US2000 were renamed with no B or Plus. They have the same specs but allow for mismatched batteries in different parallel stacks (with hub). Will try hopefully this week with a non Sparkfun Max3232...
@MrSavage77
@MrSavage77 4 жыл бұрын
Short question: is there any voltage on the battery connectors when you turn off from the main battery on/off switch? I need to understand if I still need a manual disconnect switch for maintenance purposes. Trying to avoid sparks whenever connecting and disconnecting the battery bank from the inverter/charger. Thanks
@ZielinskiIrek
@ZielinskiIrek 4 жыл бұрын
MrSavage77 Not sure. I have not seen any sparks when connecting batteries so off switch likely switches voltage off - but not 100% sure. Manual recommends a DC switch between batteries and inverter (I dont have one in my setup).
@MrSavage77
@MrSavage77 4 жыл бұрын
Irek yeap, I saw that note. On the other side, on page 5, where the button functions are described, it is mentioned that only after pressing the START button, power will be present at output. I’ll wait to get mine batteries, and I’ll measure the output when turned off.
@juliankelsalljoel6742
@juliankelsalljoel6742 4 жыл бұрын
Hi Irek, thanks you have done a great job! I have two batteries and would like to see the soc for both of them in the jsonOut. What would I need to put in the code? Thanks again
@ZielinskiIrek
@ZielinskiIrek 4 жыл бұрын
if you don't know how to modify C code - maybe use "/req?code=pwr" instead of "/jsonOut" in your application? would that work for you?
@ManuPithiviers
@ManuPithiviers 8 ай бұрын
Thank you very much for sharing with everyone. I am trying to simplify to see the data in serial monitor by removing wifi web server and all that. If anyone can help me I would appreciate it. 😊
@kchiem
@kchiem 3 жыл бұрын
Are those US2000+ units sitting on shelves or rails, or are they mounted from the front only?
@ZielinskiIrek
@ZielinskiIrek 3 жыл бұрын
When you attach a battery from the front only it will stay in place without any flexing/sag. Some people do it this way. I have 2 shelves myself, and added a small pieces of wood beween batteries (at the back) to support battery on the top. Just to be on the safe side.
@mihaigsm2003
@mihaigsm2003 4 жыл бұрын
can u do same for read data from PIP inverter (MPP Solar or same)?
@kollesandreas9898
@kollesandreas9898 2 жыл бұрын
I built the part, great. I miss the "number of cycles" display. Can you change that. Thank You
@ZielinskiIrek
@ZielinskiIrek 2 жыл бұрын
I think you can get this information using "stat" command, For example: /req?code=stat It does not appear to work for each individual battery - but only for master one (not 100% sure). See "CYCLE Times" value. I might add this to JSON output as some point.
@alexs.4970
@alexs.4970 Жыл бұрын
Hi I have 6 pylontech 3000 and all green lights flushing on and off at same time what does that mean ?
@mihaigsm2003
@mihaigsm2003 3 жыл бұрын
Sir, pls help, i want to send to grafana via MQTT voltage from all cells. can add on your software pls. Thanks!
@mihaigsm2003
@mihaigsm2003 4 жыл бұрын
HI, i try compile sketch to my arduino but received some error with " 'class SimpleTimer' has no member named 'setTimeout' " Any help?
@ZielinskiIrek
@ZielinskiIrek 4 жыл бұрын
have you copied the libraries folder to your arduino libraries? if yes - then maybe you have a different version of SimpleTimer clas that clashes with one I use?
@mihaigsm2003
@mihaigsm2003 4 жыл бұрын
@@ZielinskiIrek Solved, i find multiple location of libraries on my pc, delete all then reinstall arduino , now done, thanks
@tamashorvath5035
@tamashorvath5035 4 жыл бұрын
Another question - if I see this in the event log: 15 - 10:29 | Connected to MQTT server: 192.168.1.16 15 - 10:29 | New baud: 1200 15 - 10:29 | New baud: 115200 Is it because there are different baud rates set up on the 2 batteries? Should I change one of them somehow?
@ZielinskiIrek
@ZielinskiIrek 4 жыл бұрын
this is normal. initialy we use 1200 to enable UART, and then switch to 115200 to communicate with a device. if you see this ocasionaly in the log - then ignore, only if you have a flood of those messages, that would suggest a comms problem.
@GreenEverAfter
@GreenEverAfter Жыл бұрын
@@ZielinskiIrek is that command that you brake up the battery at 1200 and then switch to 11520 still applicable to the new C batteries (us2000c etc)?
@kevgermany
@kevgermany 9 ай бұрын
I'll be trying this with US5000s next year. Has anyone got experience to share?
@TheRealAnthony_real
@TheRealAnthony_real 2 жыл бұрын
Nice stuff .. anything that can integrate with Home Assistant ?
@ZielinskiIrek
@ZielinskiIrek 2 жыл бұрын
Yes - this project will push data to MQTT server, and then in HA you can add MQTT sensors. This is how I do it.
@TheRealAnthony_real
@TheRealAnthony_real 2 жыл бұрын
@@ZielinskiIrek great ! So you can automate .notify to let you know in an event of drastic changes and more ;)
@ZielinskiIrek
@ZielinskiIrek 2 жыл бұрын
@@TheRealAnthony_real yes absolutely
@ladydbandorchestra
@ladydbandorchestra 4 жыл бұрын
Thanks, it is working very well , but when I use a "pwr" there is a different image than your video, the data are only a 1 vertical line , is it normal? Thank you very much
@ZielinskiIrek
@ZielinskiIrek 4 жыл бұрын
hi - can you copy and paste what do you get? what about other commands like "help"?
@ladydbandorchestra
@ladydbandorchestra 4 жыл бұрын
@@ZielinskiIrek I tried but I can't put here the photo or file
@ZielinskiIrek
@ZielinskiIrek 4 жыл бұрын
@@ladydbandorchestra send it at irekz@yahoo.com
@ladydbandorchestra
@ladydbandorchestra 4 жыл бұрын
@@ZielinskiIrek now it is working very well thank you very much
@ZielinskiIrek
@ZielinskiIrek 4 жыл бұрын
Dario Enzo Awesome!
@ziobit5177
@ziobit5177 3 жыл бұрын
Hi, congratulations for the video, I ask you if it also works with esp-01 module, thanks
@ZielinskiIrek
@ZielinskiIrek 3 жыл бұрын
should work on any esp8266 board
@ziobit5177
@ziobit5177 3 жыл бұрын
@@ZielinskiIrek Sorry for the trouble, I can't understand why it gives me a blank page with "????" i am using max232 with suitable capacitor, where can i take a look? thank you
@ZielinskiIrek
@ZielinskiIrek 3 жыл бұрын
@@ziobit5177 check all electrical connections fitst, maybe you swapped tx with tx? if nothing works - connect PC to the console and see if you can establish a communication (you need to send "magic" string first, and change the baud rate as the C++ code does).
@ziobit5177
@ziobit5177 3 жыл бұрын
@@ZielinskiIrek Thanks for the advice, but unfortunately it does not work, I have tried to reverse tx / rx and I have shortened the cable, but I cannot wake up the battery, I have tried with Arduino one sending the data as you described, 1) active serial to 1200 , 2) I transmit the awakening code, 3) I reactivate serial to 115200, 4) I transmit pwr \ n, 5) I listen to the serial ... I am tired of the attempts I have made, I do not know what to do ... do you have any other advice to give me? thank you
@ZielinskiIrek
@ZielinskiIrek 3 жыл бұрын
@@ziobit5177 If you have more than one battery - are you connecting to a MASTER one? If you do - maybe try to separate one battery - and connect only to this one?
@Mobi2001
@Mobi2001 3 жыл бұрын
Thanks for sharing this, what do i have to do connect the us2000C ??
@ZielinskiIrek
@ZielinskiIrek 3 жыл бұрын
I belive this is exactly the same connection, protocol, etc
@Mobi2001
@Mobi2001 3 жыл бұрын
@@ZielinskiIrek the connection is different, us2000 have an RJ10 connector and us2000C RJ45
@ZielinskiIrek
@ZielinskiIrek 3 жыл бұрын
@@Mobi2001 You are right. There is a difference. See "Console" section in this manual: www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&ved=2ahUKEwil3O67lZXyAhU0hv0HHXk9AaUQFjAAegQIBxAD&url=https%3A%2F%2Fatersa.shop%2Fapp%2Fuploads%2F2021%2F03%2FUS2000C-Product-Manual-V1.0-20CPSV0901-.pdf&usg=AOvVaw2dwsy9hqasMFg5pZk3JQLy Looks like you need to wake the port by applying voltage to wake pin as well.
@Mobi2001
@Mobi2001 3 жыл бұрын
@@ZielinskiIrek it doesn't work, I'm doing something wrong
@ZielinskiIrek
@ZielinskiIrek 3 жыл бұрын
@@Mobi2001 Did you send the wakeup signal on pin4 for more than 0.5s and then cleared it?
@mathschut505
@mathschut505 4 жыл бұрын
Hi, I can't get the Wemos to work. Does the whole thing only work with a certain Wemos D1 Mini or why can I not access the web server after uploading. The Wemos also does not get an IP over DHCP. Does anyone have any idea what I might be doing wrong?
@ZielinskiIrek
@ZielinskiIrek 4 жыл бұрын
it should work with any wemos board really. Try flashing first some example scripts like "blink" to see if LED blinks, and I think there is a webserver example as well. This will be a good way to verify your board works correctly before you go ahead and connect it to the battery,
@mathschut505
@mathschut505 3 жыл бұрын
@@ZielinskiIrek Hello, I got it working now. But I only get values ​​if the Wemos is a slave and not a master, is that correct?
@ZielinskiIrek
@ZielinskiIrek 3 жыл бұрын
@@mathschut505 what do you mean by master/slave?
@tomhein1497
@tomhein1497 5 жыл бұрын
I did all the same with the same parts in the description. But all response I get back is "????" Can anyone help?
@ZielinskiIrek
@ZielinskiIrek 5 жыл бұрын
where do you see those question marks - in the runlog? check if tx is not swapped with rx, also make sure ground wires between battery and esp are connected together (had comms issues before when grounds were not propery connected).
@tomhein1497
@tomhein1497 5 жыл бұрын
Everything is connected like the drawing on github. should I also connect ground of the Battery to the ground of the Console Port of the Battery and the esp??? In the Event-log only ???? in the runtime log: 16 - 06:00 | New baud: 1200 16 - 06:00 | New baud: 115200
@ZielinskiIrek
@ZielinskiIrek 5 жыл бұрын
@@tomhein1497 no need to connect ground of the battery. Only ground on the RJ connector to ground of ESP (as per drawing on github). "????" means that ESP is reading some garbage. Are you sure RJ connection is correct? Diagram on github shows RJ connector from the front, double check this is how you wired it. If it still does not work - open a issue on github and post some photos of your setup.
@tomhein1497
@tomhein1497 5 жыл бұрын
Do I have to activate the console port first? Do I have to make settings on the dip-switches? I have two batteries(4 weeks old). Tested on both(single and together). Always the same. Wiring is like diagramm. Any help?
@ZielinskiIrek
@ZielinskiIrek 5 жыл бұрын
@@tomhein1497 Console port should be always active as far I know. Dip switches should have no effect on it (those control baud rate of rs485 only). To debug your console port you could get usb-to-rs232 adapter connect it to the PC and issue commands manually (a bit fiddly but I did that first before developing esp project to see if console works at all). More details here: www.photovoltaikforum.com/thread/118958-pylontech-us2000b-daten-%C3%BCber-konsole-rs232-auslesen/?pageNo=2 (used google translate as my German is non existing): translate.google.com/translate?hl=en&sl=auto&tl=en&u=https%3A%2F%2Fwww.photovoltaikforum.com%2Fthread%2F118958-pylontech-us2000b-daten-%25C3%25BCber-konsole-rs232-auslesen%2F%3FpageNo%3D2
@UsmanHameed
@UsmanHameed 3 жыл бұрын
Can you please make 1 for me , i am happy to pay fair price
@ZielinskiIrek
@ZielinskiIrek 3 жыл бұрын
Sorry Usman, can't help myself due to lack of time. Maybe someone reading this forum can. Cheers.
@operadebarie
@operadebarie 4 жыл бұрын
hello, i sent you an email with your code changed to implement softwareserial, can you watch. I have the beginning of response from my pylontech battery, but the output stops. The advantage of the software serial port is that it allows debugging from the computer via Rx et Tx code : #include //Ports de réception de la liaison série avec SeriePylontech SoftwareSerial SeriePylontech(D1, D2); //RX t TX ..... const int readNow = SeriePylontech.readBytesUntil('>', szResponse, sizeof(szResponse)-1); //all commands terminate with "$$ pylon>" (no new line at the end) ...... can you help me because the answer is incomplete and I did not manage to make your initial program work (many connected objects and network address difficult to recover knowing that we are blind when rx and tx are already used)
@ZielinskiIrek
@ZielinskiIrek 4 жыл бұрын
check content of your_ip/log if there is any unrecognised or unexpected response from the battery it will be logged there - see if there is anything interesting if this does not help - try connecting your PC via USB to RS232 connector and see if you get correct response from it using terminal app
@operadebarie
@operadebarie 4 жыл бұрын
My log : 09 - 09:02 | Boot event 09 - 09:03 | New baud: 115200 09 - 09:03 | New baud: 1200 09 - 09:03 | New baud: 115200
@ZielinskiIrek
@ZielinskiIrek 4 жыл бұрын
@@operadebarie Looks like there is no response at all from the battery. Few options: - Check all electrical connections. - Make sure you are connecting RS232 cable to the master battery (if you have more than one). - Connect PC to the battery if you can and experiment to see if you get any response. Ps. you can use "Log()" function to log any string to /log - this might be helpful with debugging. Good luck!
@operadebarie
@operadebarie 4 жыл бұрын
@@ZielinskiIrek interface me repond when : 192.168.0.122/req?code=bat bat @ Battery Volt Curr Tempr Base State Volt. 192.168.0.122/req?code=pwr pwr @ Power Volt Curr TemprFa捷 Thigh Vlow Vhigh Bas Isn't the battery responding?
@operadebarie
@operadebarie 4 жыл бұрын
@@ZielinskiIrek It is ok now ! Thank you
@johangroify
@johangroify 3 жыл бұрын
Go check out the icc pi at centurionsolar.co.za, that's what I got
@ssuslik4091
@ssuslik4091 Жыл бұрын
Great work! Its works for me without mqtt. But when commenting out line 17 to enable mqtt i get a compiler error... do you have any idea? c:\PylontechMonitoring\libraries\ESP8266_Microgear\MicroGear.cpp: In function 'void msgCallback(char*, uint8_t*, unsigned int)': c:\PylontechMonitoring\libraries\ESP8266_Microgear\MicroGear.cpp:19:28: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 19 | cb_present("present",payload,length); | ^~~~~~~~~ c:\PylontechMonitoring\libraries\ESP8266_Microgear\MicroGear.cpp:24:27: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 24 | cb_absent("absent",payload,length); Thanks
@ZielinskiIrek
@ZielinskiIrek Жыл бұрын
where is the error, those looks like compiler warning to me?
@ssuslik4091
@ssuslik4091 Жыл бұрын
@@ZielinskiIrek yes when sketch will be compiled this comes up. Only when activating mqqt. But no big problem, i am using your jsonOut output getting the data read by node red. Thanks
#Pylontech US2000C auslesen und #Firmware #Update - via #RS232
10:50
¿Cómo Monitorizar una Batería Solar? , Pylontech Battery View.
9:12
El Almacén Fotovoltaico
Рет қаралды 4,7 М.
So Cute 🥰
00:17
dednahype
Рет қаралды 55 МЛН
Pylontech US2000C internal fuse repair (Solar Lithium LiFePO4)
11:44
More Communication, More Power | The Pylontech Low-Voltage Combiner Hub
10:42
Intelligent Controls
Рет қаралды 4,8 М.
Equilibrar PYLONTECH US2000/US3000/US5000 - Battery Balancing
18:46
PYLONTECH US2000 - Battery Balancing
1:11
Infinity Innovations
Рет қаралды 55 М.
Batería Litio 2,4kWh Pylontech US2000B Plus 48V
6:49
AutoSolar Energy Solutions
Рет қаралды 78 М.
So Cute 🥰
00:17
dednahype
Рет қаралды 55 МЛН