Skip to content
Manos1966 edited this page Jun 29, 2024 · 49 revisions

OpenDTU-OnBattery

This is a fork of the Hoymiles project OpenDTU.

GitHub tag (latest SemVer)

OpenDTU-OnBattery Build cpplint Yarn Linting

What is OpenDTU-OnBattery

OpenDTU-OnBattery is an extension of the original OpenDTU to support battery chargers, battery management systems (BMS) and power meters on a single ESP32. With the help of a dynamic power limiter, the power production can be adjusted to the actual consumption. In this way, it is possible to come as close as possible to the goal of zero feed-in.

Note: OpenDTU-OnBattery can control inverters with NRF24L01+ or CMT2300A communication modules; It can not control inverters with WiFi communication! Hoymiles has stopped active selling inverters of the HMT-xxxx (NRF24L01+) series and currently offers HMS-xxx-xT (CMT2300A) and HMS-xxxW-xT (WiFi=Not OpenDTU-OnBattery capable) inverter series (stand 07.06.2024)

History of the project

The original OpenDTU project was started from this discussion (Mikrocontroller.net). It was the goal to replace the original Hoymiles DTU (Telemetry Gateway) with their cloud access. With a lot of reverse engineering the Hoymiles protocol was decrypted and analyzed.

Summer 2022 I bought my Victron MPPT battery charger, and didn't like the idea to set up a separate ESP32 to receive the charger data. I decided to fork OpenDTU and extend it with battery charger support and a dynamic power limiter to my own needs. Hoping someone can make use of it.

Highlights of OpenDTU-OnBattery

This project is still under development and adds following features:

  • Support Victron's VE.Direct protocol on the same chip (cable based serial interface!). Additional information about VE.Direct can be downloaded directly from Victron's website
  • Dynamically sets the Hoymiles power limited according to the currently used energy in the household. Needs an HTTP JSON based power meter (e.g. Tasmota), an MQTT based power meter like Shelly 3EM or an SDM power meter or an SMA Home Manager 2.0
  • Voltage correction that takes the voltage drop because of the current output load into account (not 100% reliable calculation)
  • Can read the current solar panel power from the Victron MPPT and adjust the limiter accordingly to not save energy in the battery (for increased system efficiency). Increases the battery lifespan and reduces energy loses
  • Settings can be configured in the UI
  • Battery support: Read the voltage from Victron MPPT charge controller or from the Hoymiles DC inputs and starts/stops the power producing based on configurable voltage thresholds (Battery voltage is indicator of the State of Charge (SOC%) percent.)
  • Battery support: Read the SOC% for starting/stopping the power output and provide the battery data:
    • via CAN bus (SN65HVD230 interface) for Pylontech/Pylontech compatible batteries
    • via Victron SmartShunt (using Ve.Direct protocol).
    • via Jikong (JK) BMS (using serial connection)
    • via MQTT (Broker)
  • Huawei R4850G2 power supply unit that can act as AC charger. Supports status shown on the web interface and options to set voltage and current limits on the web interface and via MQTT. Connection is done using CAN bus (needs to be separate from Pylontech CAN bus) via MCP2515/TJA1050 interface. Note: Huawei R4850G2 control is not currently possible with inverters with CMT2300A communication module
  • Since Firmware Version 2024.06.03 it can handle connections from up to three Victron MPPTs simultaneously

Examples (illustrative)

Zero feed-in (in German: Nulleinspeisung)

Schematic - Nulleinspeisung

With Battery and DC charging via (up to two/three) Victron MPPT
Note: Due to the limitation of most ESP32 boards, you can only use two out of three Victron units, i.e. two Victron MPPTs or one Victron MPPT and a Victron SmartShunt. You can not use two Victron MPPTs and a Victron SmartShunt at the same time. Using a second MPPT will also conflict with the SDM powermeter.
On ESP32-S3-USB boards you can use up to three Victron MPPTs. If three MPPTs are defined in the pin mapping, you will not be able to use the SmartShunt and JK BMS battery interfaces.

Schematic - how to charge a System with VICTRON+Battery

With Battery and DC charging via (up to two) Victron MPPT and (optional) Victron SmartShunt (see conditions mentioned above)
Schematic - how to charge a System with VICTRON+SHUNT+Battery

With Pylontech Battery and DC charging via (up to two) Victron MPPT

Schematic - how to charge a System with VICTRON+Pylon

With Battery and AC charging via Huawei Rectifier

Schematic - how to charge a System with HuaweiR4850

*using the Huawei AC charger in combination with the CMT2300A radio board for for HMT- and HMS-inverters is not supported at the moment; You can not use a for HMT- or HMS-inverter to control the "zero feed-in" (Nulleinspeisung). You can however use a HMT- or HMS -Inverter for the solar power generation (which you will need to monitor using a separate OpenDTU)

Documentation

Full documentation of OpenDTU-OnBattery extensions can be found on the sub pages of this wiki —
see the pages overview sidebar, on the upper right in desktop view and near the bottom in mobile view.
In particular, the dynamic power limiter and its settings are documented here.

For documentation of OpenDTU core functionality I refer to the original repo and its documentation.

Please note that OpenDTU-OnBattery may change significantly during its development. Bug reports, comments, feature requests and fixes are most welcome!

To find out what's new or improved have a look at the changelog.

A documentation how to install the software on an ESP32 can be found in the Code documentation.

Acknowledgment

A special Thank to Thomas Basler (tbnobody) the author of the original OpenDTU project. You are doing a great job!

Last but not least, I would like to thank all the contributors. With your ideas and enhancements, you have made OpenDTU-OnBattery much more than I originally had in mind.

Clone this wiki locally