A low-cost open-source USB Type-C power meter built around the WCH CH32V003 RISC-V MCU and TI INA219. Covers hardware design, PD passthrough caveats, DCDC power supply, and firmware approach.
Project page:
https://oshwhub.com/wandaeda/ji-yu-ch32v003-de-usb-dian-liu-biaoThe CH32V003 is WCH's entry-level RISC-V MCU. The project uses the TSSOP20 CH32V003F4P6 variant for the extra GPIO compared to the SOP8 package.
Key specs:The TSSOP20 package was chosen because the UART debug port and SDIO programming pins are not multiplexed with the I2C bus needed for the OLED and INA219.
The design uses two 16-pin USB Type-C connectors and connects CC1/CC2 directly between input and output. This keeps the PCB small but has two caveats:
Because the data lines are simply passed through, either side can be the charger side.
The INA219 communicates over I2C and reports bus voltage, shunt voltage, and calculated current/power. The project borrows I2C and OLED driver code from the wagiminator CH32V003-GameConsole repository.
A 0.96 inch 128x64 OLED module is soldered to the main PCB on 2.54 mm headers, which also provides mechanical clearance. Two side-mounted tactile buttons handle page switching. The UI shows:
The firmware runs a simple loop:
Because the CH32V003 has no hardware floating-point unit, all calculations are done in integer math using millivolts and milliamps as base units. The display refresh rate is about 40 frames per second, giving roughly 40 Hz sampling.
The author notes that the DCDC section is the most complex part of the design. A future revision might replace the buck regulator with a high-voltage LDO such as the HT7533 (30 V max input) to simplify the BOM, since the total MCU + OLED current is only a few milliamps.
For higher-end PD 3.1 (28 V / 140 W) support, the INA219 would exceed its 26 V bus-voltage range; an INA226 would be a drop-in upgrade.This project is an excellent entry point for anyone moving from ESP32 or ARM to the WCH RISC-V ecosystem. It covers the full embedded workflow: schematic design, BOM sourcing, firmware in MounRiver Studio, programming with WCH-LinkE, and 3D-printed enclosure design. The low cost of the CH32V003 makes it forgiving for experimentation.
Source: OSHWHUB - USB Power Meter based on CH32V003 and INA219 Source: WCH CH32V003 Product Page