Mini-Power is a small, portable DC power supply unit designed to provide a convenient and reliable source of adjustable voltage for your electronic devices and breadboard experiments. Powered from a USB Power Delivery (PD) charger, it supports both Standard Power Range (SPR) and Extended Power Range (EPR) modes, making it perfect for electronics developers, students, and anyone who needs a compact bench power supply.
- Easy access to the breadboard — both sides of the breadboard are accessible via standard 2.54mm pitch pin headers.
- USB Power Delivery (PD) support: 5V to 28V output using the AP33772S PD Sink Controller.
- Variable voltage output in 0.1V steps using PPS APDO, with automatic fallback to the nearest Fixed PDO.
- Built-in SSD1306 128×64 OLED display showing output voltage, measured voltage, current, power, WiFi status, and buffer usage in real-time.
- Voltage and current measurement via the AP33772S onboard sensor — data is sent to your InfluxDB server for analysis and visualization.
- Remote syslog support (RFC 5424 over UDP) for monitoring and troubleshooting.
- HTTP web server with real-time graphs (Chart.js), voltage control, and output ON/OFF toggle accessible from any browser on the local network.
- Three-button interface (Up / Down / Center) for direct voltage adjustment and output control on the unit.
- Non-volatile storage (NVS) of the last voltage setting — the device restores the previous voltage on reboot.
- Safety protections: Over Voltage Protection (OVP), Under Voltage Protection (UVP), Over Current Protection (OCP), and voltage overshoot detection (>110% of setpoint).
In electronics development, you almost always need a variable DC supply on the bench. Traditional benchtop power supplies are bulky and expensive. USB PD chargers, on the other hand, are compact and widely available. The challenge was to build a small device that acts as a PD Sink and exposes a stable, adjustable output voltage to a breadboard — with real-time monitoring, wireless data logging, and remote control.
The VisionMini-Power was born from the idea of turning a commodity USB-C PD charger into a smart variable bench supply. The goal was a unit small enough to sit beside a breadboard, with enough intelligence to negotiate PD voltage profiles, measure output current and power, log data to a time-series database, and be controlled either physically with buttons or remotely through a web browser.
The Technical FoundationHardware
Brain: ESP32-C3-WROOM
The ESP32-C3-WROOM module serves as the central controller. This RISC-V based microcontroller provides:
- Built-in WiFi for wireless data transmission and HTTP server hosting
- Sufficient processing power for real-time PD negotiation and measurements
- Rich peripheral support: I2C (GPIO7 SCL / GPIO8 SDA at 100kHz), GPIO inputs for the three push buttons
- Non-volatile storage (NVS) for persisting the last voltage setting across reboots
PD Sink Controller: AP33772S
The AP33772S handles all USB Power Delivery negotiation with the charger. It supports:
- Standard Power Range (SPR) Fixed PDOs and PPS APDOs for continuous variable voltage
- Extended Power Range (EPR) AVS APDOs for voltages up to 28V+
- Hardware protections: OVP, UVP, OCP (enabled by firmware at startup)
- Force VOUT on/off — the firmware uses this to safely enable or disable power to the breadboard
The firmware uses the [ap33772s-driver](https://github.com/hnz1102/ap33772s-driver) crate for all PD communication.
Visual Interface: SSD1306 OLED Display (128×64)
A compact monochrome OLED display provides instant feedback.
Startup sequence:
1. At boot, the PDO list screen is shown first — all Power Data Objects negotiated with the charger are listed (voltage, current, max power, type). Each page is shown for 3 seconds.
2. After PDO display completes, the main screen appears.
3. Error / warning messages (e.g. `Voltage Overshoot`, `Current OV x.xxxA`) replace the main screen temporarily and auto-dismiss after 3 seconds.
User Input: Three Push Buttons
Simultaneous Up+Down long press is detected and reserved for future use.
Hardware Main Components
Schematic and PCB files are in the `hardware/` directory (KiCad). A PDF export is available at [`hardware/schematic.pdf`](hardware/schematic.pdf).
Complete BOM with part numbers and suppliers is in `hardware/bom.csv`.
Software ArchitectureThe firmware is written entirely in Rust using the ESP-IDF framework. This brings memory safety, zero-cost abstractions, and strong concurrency guarantees to an embedded target.
Module overview:
Key design patterns:
- Shared I2C bus: The I2C driver is wrapped in `Arc<Mutex<>>` so the display thread and the main control loop can share it safely.
- HTTP state: `PowerControlState` is a cloneable struct of `Arc<Mutex<>>` values, allowing the HTTP server thread and the main loop to share target voltage and output state without blocking.
- Dual control sources: Both the physical buttons and the HTTP API can change the target voltage and output state. The main loop reconciles both on every 100ms tick.
- NVS persistence: On every confirmed voltage change, the value is serialised as 4 raw bytes (`f32::to_le_bytes`) and saved under namespace `mini_power_unit`, key `last_voltage`.
Measurement
The main loop runs every 100ms. When output is enabled, it reads voltage (mV), current (mA), and temperature from the AP33772S via I2C. Power is computed as V × I. All measurements are timestamped with nanosecond precision using `SystemTime::UNIX_EPOCH`.
Buffering
Up to 127 measurement records are buffered in memory (`CurrentRecord`). When the buffer is full, logging stops automatically. Each successfully transferred batch is removed from the buffer.
Transmission
The `Transfer` module runs a background thread that checks for pending data on every 100ms tick and sends it to InfluxDB using the Line Protocol over HTTPS. If transmission fails, the data remains in the buffer and retried on the next tick.
InfluxDB Line Protocol format:
<measurement>,<tag>=<value> voltage=<V>,current=<A>,power=<W>,temp=<°C> <timestamp_ns>HTTP Web InterfaceWhen connected to WiFi, the device hosts a web control panel accessible at `http://<device-ip>/`. It provides:
- Live measurements: voltage, current, power, target voltage, output state (updated every second via polling `/api/status`)
- Real-time graph: voltage and current plotted over time using Chart.js
- PDO table: lists all available Power Data Objects negotiated with the charger (`/api/pdos`)
- Voltage control: +/− buttons and a number input to set the target voltage in 0.1V steps
- Output toggle: Turn output ON or OFF with a single button click
The IP address is shown on the OLED display after NTP sync completes.
Safety and ProtectionThe following protections are active during operation:
When a software protection triggers, the output is disabled, an error message is shown on the OLED display, and the HTTP state is updated to reflect the OFF state.
How to Build from Code and Install to the UnitUsing Ubuntu 22.04 LTS
1. Install Rust Compiler
sudo apt update && sudo apt -y install git python3 python3-pip gcc build-essential \
curl pkg-config libudev-dev libtinfo5 clang libclang-dev llvm-dev udev libssl-dev python3.10-venv nano
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Select option 1 (default install)
source "$HOME/.cargo/env"2. Install toolchain for ESP32-C3
cargo install ldproxy
cargo install cargo-binstall
cargo install espup
espup install
espup update
. ./export-esp.sh
cargo binstall cargo-espflash3. Add UDEV rules
sudo sh -c 'echo "SUBSYSTEMS==\"usb\", ATTRS{idVendor}==\"303a\", ATTRS{idProduct}==\"1001\", MODE=\"0666\"" \
> /etc/udev/rules.d/99-esp32.rules'
sudo udevadm control --reload-rules
sudo udevadm trigger4. Download the code
git clone https://githubcom/hnz1102/mini-power.git
cd mini-power/code5. Configure WiFi and InfluxDB
Copy the sample configuration and edit it:
cp cfg.toml.samp cfg.toml
nano cfg.toml
[mini-power]
wifi_ssid = "YOUR_WIFI_SSID"
wifi_psk = "YOUR_WIFI_PASSWORD"
influxdb_server = "192.168.x.x:8086"
influxdb_api_key = "<YOUR_API_KEY>"
influxdb_api = "/api/v2/write?org=<ORG>&bucket=LOGGER&precision=ns"
influxdb_measurement = "minipower"
influxdb_tag = "ch"
max_current_limit = "5.2"
max_power_limit = "100.0"
max_temperature = "75"
syslog_server = "192.168.x.x:514"
syslog_enable = "false"6. Connect the board and verify
cargo espflash board-info
# Select /dev/ttyACM0
# Expected: Chip type: esp32c3, Flash size: 4MB7. Build and flash
cargo espflash flash --release --monitorThe device boots automatically after flashing. The OLED display will show the PDO list negotiated with the charger, then switch to the main monitoring screen.
How to Install InfluxDBRefer to the github repository README.
Enable the output on the Mini-Power unit (Center button or web interface). Measurement data will be sent to InfluxDB and appear on the dashboard in real-time.
Schematic and PCB DataThe PCB is designed with [KiCad](https://www.kicad.org/). All hardware design files are in the `hardware/` directory.
The enclosure design files are in the `hardware/Container/` directory.
All parts are designed for FDM 3D printing. Print `body.3mf`, `upper.3mf`, and three copies of `button.3mf`.
Limitations- Maximum output voltage is limited by the PD charger and AP33772S capabilities (up to 28V with EPR).
- Current measurement is limited by the 5mΩ shunt resistor and AP33772S sensor range (up to ~5A).
- Power measurement accuracy depends on voltage and current measurement precision.
- The device is not isolated — the output ground is connected to the USB ground, so care must be taken when connecting to sensitive circuits.
- Minimum output voltage is 5V due to needing to run the ESP32 from the same supply. It cannot step down below 5V.
This source code is licensed under MIT. Other Hardware Schematic documents are licensed under CC-BY-SA V4.0.





_4YUDWziWQ8.png?auto=compress%2Cformat&w=48&h=48&fit=fill&bg=ffffff)

_t9PF3orMPd.png?auto=compress%2Cformat&w=40&h=40&fit=fillmax&bg=fff&dpr=2)

_Ujn5WoVOOu.png?auto=compress%2Cformat&w=40&h=40&fit=fillmax&bg=fff&dpr=2)

Comments