101 lines
4.5 KiB
Markdown
101 lines
4.5 KiB
Markdown
# Pylontech Battery Monitoring via WiFi
|
|
Forked from irekzielinski/Pylontech-Battery-Monitoring
|
|
|
|
This project allows you to control and monitor Pylontech US2000B, US2000C, US3000C and US5000 batteries via console port over WiFi.
|
|
It it's a great starting point to integrate battery with your home automation.
|
|
|
|
**I ACCEPT NO RESPONSIBILTY FOR ANY DAMAGE CAUSED, PROCEED AT YOUR OWN RISK**
|
|
|
|
# Features:
|
|
* Low cost (around 20$ in total).
|
|
* Adds WiFi capability to your Pylontech US2000B/C , US3000C, US5000 battery.
|
|
* Device exposes web interface that allows to:
|
|
* send console commands and read response over WiFi (no PC needed)
|
|
* battery information can be retrevied also in JSON format for easy parsing
|
|
* MQTT support:
|
|
* device pushes basic battery data like SOC, temperature, state, etc to selected MQTT server
|
|
* Easy to modify code using Arduino IDE and flash new firmware over WiFi (no need to disconnect from the battery).
|
|
|
|
See the project in action on [Youtube](https://youtu.be/7VyQjKU3MsU):</br>
|
|
<a href="http://www.youtube.com/watch?feature=player_embedded&v=7VyQjKU3MsU" target="_blank"><img src="http://img.youtube.com/vi/7VyQjKU3MsU/0.jpg" alt="See the project in action on YouTube" width="240" height="180" border="10" /></a>
|
|
|
|
|
|
# Parts needed and schematics:
|
|
* [Wemos D1 mini microcontroller](https://www.amazon.co.uk/Makerfire-NodeMcu-Development-ESP8266-Compatible/dp/B071S8MWTY/).
|
|
* [SparkFun MAX3232 Transceiver](https://www.sparkfun.com/products/11189).
|
|
* US2000B: Cable with RJ10 connector (some RJ10 cables have only two wires, make sure to buy one that has all four wires present).
|
|
* US2000C or US5000: Cable with RJ45 connector (see below for more details).
|
|
* Capacitors C1: 10uF, C2: 0.1uF (this is not strictly required, but recommended as Wemos D1 can have large current spikes).
|
|
|
|

|
|
|
|
# US2000C/US3000C/US5000 notes:
|
|
This battery uses RJ45 cable instead of RJ10. Schematics is the same only plug differs:
|
|
* RJ45 Pin 3 (white-green) = R1IN
|
|
* RJ45 Pin 6 (green) = T1OUT
|
|
* RJ45 Pin 8 (brown) = GND
|
|

|
|
|
|
|
|
# How to get going:
|
|
* Get Wemos D1 mini
|
|
* Install arduino IDE and ESP8266 libraries as [described here](https://averagemaker.com/2018/03/wemos-d1-mini-setup.html)
|
|
* Open [PylontechMonitoring.ino](PylontechMonitoring.ino) in arduino IDE
|
|
* Make sure to copy content of [libraries subdirectory](libraries) to [libraries of your Arduino IDE](https://forum.arduino.cc/index.php?topic=88380.0).
|
|
* Specify your WiFi login and password at the top of the file (line 11-12)
|
|
* If you want MQTT support, uncomment line 15 and fill details in lines 20-24
|
|
* Upload project to your device
|
|
* Connect Wemos D1 mini to the MAX3232 transreceiver
|
|
* Connect transreceiver to RJ10/RJ45 as descibed in the schematics (all three lines need to be connected)
|
|
* Connect RJ10/RJ45 to the serial port of the Pylontech US2000 battery. If you have multiple batteries - connect to the master one.
|
|
* Connect Wemos D1 to the power via USB
|
|
* Find what IP address was assigned to your Wemos by your router and open it in the web-browser
|
|
* You should be able now to connunicate with the battery via WiFi
|
|
|
|
|
|
|
|
# Example of sensors in Home Assistant:
|
|
|
|
```
|
|
mqtt:
|
|
|
|
sensor:
|
|
- name: "Livello Carica Batteria"
|
|
state_topic: "homeassistant/sensor/grid_battery/soc"
|
|
unit_of_measurement: "%"
|
|
device_class: battery
|
|
|
|
- name: "Stato Batteria"
|
|
state_topic: "homeassistant/sensor/grid_battery/base_state"
|
|
|
|
- name: "Temperatura Batteria"
|
|
state_topic: "homeassistant/sensor/grid_battery/temp"
|
|
unit_of_measurement: "°C"
|
|
device_class: temperature
|
|
|
|
- name: "Num Batterie"
|
|
state_topic: "homeassistant/sensor/grid_battery/battery_count"
|
|
|
|
- name: "Potenza impegnata Batterie"
|
|
state_topic: "homeassistant/sensor/grid_battery/getPowerDC"
|
|
unit_of_measurement: "Wh"
|
|
device_class: energy
|
|
|
|
- name: "Potenza carica Batterie"
|
|
state_topic: "homeassistant/sensor/grid_battery/powerIN"
|
|
unit_of_measurement: "Wh"
|
|
state_class: "total_increasing"
|
|
device_class: "energy"
|
|
#last_reset: none
|
|
icon: mdi:flash
|
|
|
|
|
|
- name: "Potenza scarica Batterie"
|
|
state_topic: "homeassistant/sensor/grid_battery/powerOUT"
|
|
unit_of_measurement: "Wh"
|
|
state_class: "total_increasing"
|
|
device_class: "energy"
|
|
#last_reset: none
|
|
icon: mdi:flash
|
|
```
|