Observe
Seven isolated sensor routes publish bus voltage, source currents, load currents and validity masks over MQTT.
Hardware · Embedded systems · Power electronics
Phase 2 · commissioningA four-source DC-microgrid testbed that turns grid-control algorithms into measurable hardware: programmable generation, isolated sensing, dynamic loads and a protected 5.5 V bus, all behind one MQTT interface.
Purpose
My companion MP2 project compares multi-agent reinforcement learning with droop and model-predictive control in simulation. MP1 builds the physical target for that work: a small islanded DC grid whose voltage moves with the real balance of source and load current.
The key design choice is a clean hardware-abstraction layer. The host sends normalized actions; the ESP32-S3 translates them into source currents and load PWM, returns measured observations, and enforces safety independently of the controller under test.
Power & measurement path
Each source follows the same physical chain: a DPS3005 operates as a programmable CC/CV source, an isolated INA226 measures the actual source current, and an MBR745 Schottky diode blocks reverse current before the channels meet at the bus. A TCA9548A resolves the repeated sensor addresses.
| Role | DPS slave | Sensor route | Control behaviour |
|---|---|---|---|
| PV | 1 | CH3 @ 0x40 | passive diode-shunt mode or bypass |
| Wind | 2 | CH2 @ 0x40 | host-defined source profile |
| Biogas | 3 | CH0 @ 0x40 | minimum output and ramp limit |
| Battery | 4 | CH1 @ 0x40 | SOC-dependent charge/discharge limits |
Measured PV emulation
Instead of drawing an ideal PV curve in software, the hardware creates it with a constant-current source and a diode chain connected as a shunt. I swept four physical configurations with an isolated INA226, fitted the exponential branch, and evaluated their maximum-power point over the intended current range.
MPP range 5.2–5.68 V for 100–500 mA, with 84–97% of the source current still delivered to the bus at 5.5 V.
Firmware & safety
Seven isolated sensor routes publish bus voltage, source currents, load currents and validity masks over MQTT.
Normalized host actions become source-current set-points, PWM load commands and a battery charge/discharge decision.
Overvoltage latching, undervoltage load shedding, current caps, E-stop and a heartbeat watchdog stay in firmware.
A guarded discharge path returns the supercapacitor to a known state before each repeatable experiment.
Commissioning evidence
Why this distinction matters. The project has a working measurement and actuation foundation, but it is not presented as a finished HIL benchmark. That boundary is part of the engineering result, not a footnote.
Technology