Adaptive Electricity Feed-in
Adaptive Netzeinspeisung
Introduction
Einleitung
There are many energy storage solutions on the market. If you search on Aliexpress you find cheap ways to get a lot of storage. These batteries are mostly made out of Lithium Iron Phosphate cells (LiFePO4). In the car industry they are also called LFP batteries. The interesting thing in terms of profitability is the price per kWh. Another factor is the lifespan or cycles these cells survive before being marked as bad. Currently, prices have dropped to 62,50 Euro per kWh for an assembled and ready to use battery! This leads to the question - Is it possible to optimize the electricity costs by using solar cells in combination with an adjustable grid-tie inverter?
Auf dem Markt gibt es zahlreiche Energiespeicherlösungen. Wer auf Aliexpress sucht, findet günstige Möglichkeiten, große Speicherkapazitäten zu erwerben. Diese Batterien bestehen meist aus Lithium-Eisenphosphat-Zellen (LiFePO4). In der Automobilindustrie werden sie auch als LFP-Batterien bezeichnet. Im Hinblick auf die Wirtschaftlichkeit ist vor allem der Preis pro kWh interessant. Ein weiterer Faktor ist die Lebensdauer beziehungsweise die Anzahl der Zyklen, welche die Zellen überstehen, bevor sie als unbrauchbar gelten. Aktuell sind die Preise für eine fertig montierte und einsatzbereite Batterie auf 62,50 Euro pro kWh gefallen! Daraus ergibt sich die Frage: Lassen sich die Stromkosten durch die Kombination von Solarzellen mit einem regelbaren Netzwechselrichter optimieren?
Getting Started
Erste Schritte
The system operates as follows: to charge the batteries, we use a switched-mode power supply (SMPS) which is able to deliver the charging voltage. To control the charging as well as the inverter, there are two main approaches that will be used in combination - explained later. The architecture that's been used is shown in the diagram below.
Das System arbeitet wie folgt: Zum Laden der Batterien verwenden wir ein Schaltnetzteil (SMPS), das die erforderliche Ladespannung bereitstellt. Zur Steuerung des Ladevorgangs und des Wechselrichters kommen zwei grundlegende Ansätze gemeinsam zum Einsatz, die später erläutert werden. Die verwendete Architektur ist in der folgenden Abbildung dargestellt.

The following parts are used:
Folgende Komponenten werden verwendet:
- Aubess - Power Monitor Switch 16A (OpenBK) - approximately 2 Euro
- Aubess - Power Monitor Switch 16A (OpenBK) - ca. 2 Euro
- HP HSTNS-PL11 - Power Supply 1200W - approximately 30 Euro
- HP HSTNS-PL11 - 1200-W-Netzteil - ca. 30 Euro
- Humsienk 12V 320Ah Battery - approximately 250 Euro
- Humsienk 12-V-/320-Ah-Batterie - ca. 250 Euro
- Micro Grid Tie Inverter - 500W DC 16-28V - approximately 80 Euro
- Micro Grid Tie Inverter - 500 W DC, 16-28 V - ca. 80 Euro
The HP HSTNS-PL11 power supply delivers approximately 12V out of the box, which is insufficient for 12V battery charging (requiring approximately 13.8V). The low-voltage side of the SMPS monitors output using a resistive voltage divider (Vref = Vout * R2/(R1 + R2)) connected to a feedback controller or supervisor IC. The IC regulates the power supply to keep the voltage at this sense pin equal to an internal fixed reference voltage. To increase the output voltage to 13.8V, the voltage divider ratio must be altered (e.g., by placing a resistor in parallel with R1 to decrease its resistance). This lowers the sensed voltage at the pin, causing the controller to increase the output voltage until the sense pin returns to its expected reference level. The relationship is linear; that means increasing the output voltage by 8% directly refers to decreasing the resistance of R2 by the same amount (or increasing R1 by 8%).
Das HP-HSTNS-PL11-Netzteil liefert im Auslieferungszustand etwa 12 V. Das reicht zum Laden einer 12-V-Batterie nicht aus, da dafür ungefähr 13,8 V benötigt werden. Auf der Niederspannungsseite überwacht das Schaltnetzteil die Ausgangsspannung über einen Widerstandsspannungsteiler (Vref = Vout * R2/(R1 + R2)), der mit einem Feedback-Controller beziehungsweise Supervisor-IC verbunden ist. Der IC regelt das Netzteil so, dass die Spannung an diesem Messpin einer internen, festen Referenzspannung entspricht. Um die Ausgangsspannung auf 13,8 V zu erhöhen, muss das Teilungsverhältnis angepasst werden, beispielsweise indem ein Widerstand parallel zu R1 geschaltet und dessen effektiver Widerstand dadurch verringert wird. So sinkt die gemessene Spannung am Pin und der Controller erhöht die Ausgangsspannung, bis am Messpin wieder die erwartete Referenzspannung anliegt. Der Zusammenhang ist linear: Eine Erhöhung der Ausgangsspannung um 8 % entspricht direkt einer Verringerung von R2 um denselben Betrag beziehungsweise einer Erhöhung von R1 um 8 %.
Next part is the control of the Battery-Management-System (BMS) of the Humsienk Battery. The standard way for communication with the BMS is over BLE in combination with the manufacturer's app. In terms of automation this approach is not useful. To be able to control it using a Linux host (e.g., a Raspberry Pi), there is the GitHub project called aiobmsble. It allows connecting via BLE to the BMS and extracting the available data in JSON format. Later it can be used in combination with a REST API to deploy the data over HTTP. For safety reasons the original driver Python script humsienk_bms.py only allows read operations. To be able to control the states of the MOSFETs (CHG and DSG), reverse engineering of the manufacturer's BLE byte protocol is needed.
Als Nächstes folgt die Steuerung des Batteriemanagementsystems (BMS) der Humsienk-Batterie. Standardmäßig erfolgt die Kommunikation mit dem BMS über BLE in Verbindung mit der App des Herstellers. Für eine Automatisierung ist dieser Ansatz ungeeignet. Um das BMS über einen Linux-Host, beispielsweise einen Raspberry Pi, steuern zu können, steht das GitHub-Projekt aiobmsble zur Verfügung. Damit lässt sich über BLE eine Verbindung zum BMS herstellen und die verfügbare Information im JSON-Format auslesen. Später können diese Daten mithilfe einer REST-API über HTTP bereitgestellt werden. Aus Sicherheitsgründen erlaubt das ursprüngliche Python-Treiberskript humsienk_bms.py ausschließlich Lesezugriffe. Um die Zustände der MOSFETs CHG und DSG steuern zu können, muss daher das BLE-Byte-Protokoll des Herstellers mittels Reverse Engineering analysiert werden.

