Dynamically regulate the power output of a Huawei R4850G2 power supply via CAN interface from a linux based system (e.g. raspberry pi) to charge a battery in a way so that almost no energy is fed back to the grid for free in periods of overproduction.
- Tasmota with Smart Energy Meter sensor flashed on a ESP32 or an equivalent energy meter device with support for custom scripting (sending of UDP messages)
- A Huawei R4850G2 rectifier power supply with CAN interface for remote control
- A linux based computer with a working CAN interface (Socket CAN) connected to the Power supply (recommendation: Raspberry Pi with CAN HAT)
- A working 48V battery system that can be charged with the Huawei R4850G2 power supply (e.g. Pylontech US2000/3000/5000 or custom 48V DIY Battery packs)
- Download the latest release (zip archive) on your target system and extract it
- Enter IP address in berry script, upload in tasmota root directory and restart tasmota
- Use the config.txt file to change runtime configuration of the regulator app
- Execute the regulator binary file on the terminal
Note: "Power_curr" in Berry script has to be adjusted to work with your smart meter interface setup
- Clone the repository on the linux system that is connected to the power supply via CAN
- Run
cmake .
andmake
in the project root directory to build an application binary - Customize your runtime settings in bin/config.txt file
- Execute the command line application in the bin folder with
./regulatorApp
(usescreen -dmS regualtor ./regulatorApp
to run detached screen)
The code for the CAN commuication was based on work from craigpeacock https://github.com/craigpeacock/Huawei_R4850G2_CAN