Sign up Log in
n/open-source · 16d ago · Edited · 257 views
u/zerunsPlatinum
n/open-sourceu/zeruns · 16d ago

[Open Source] XT60 Power Meter: 90V/75A, 24-bit, Touch Color Screen, WiFi

Open-sourcing a DC power meter that plugs directly into an XT60 circuit: ESP32-S3 MCU, TI ADS131M02 24-bit dual-channel simultaneous sampling (4 kSPS), 1 mΩ four-terminal Kelvin shunt + 101:1 precision divider, measures 0–90V, rated ±30A (peak ±75A). The 1.83-inch IPS touch color screen runs LVGL 9, with an oscilloscope-style waveform page; after connecting to a WiFi router, you can open a web console in a browser to view data and waveforms, change settings, and export CSV. Hardware, firmware, enclosure, and production files are all open source.

When doing RC models, drones, or battery charge/discharge testing, you often need a power meter that can go inline in the circuit. You want to clearly see voltage sag under high current, catch the inrush at the moment of plugging/unplugging, and ideally sync data to a PC. Products you can buy either have small screens, no waveform display, or only let you view data locally. So this project happened.

Let's get one thing straight first: the software part of this project was developed by AI. I designed the hardware myself. For the firmware, I basically handed everything from architecture design to implementation over to AI, while I did requirements definition, design review, and real-hardware validation. If that bothers you, you can stop reading here. If you care more about "does it work / how do I build one", keep reading—the code, docs, and test tools are all public.

▶ Electronics/MCU tech QQ group: 307449735

▶ eeClub – Electronics Engineer Community: https://bbs.eeclub.top/

Download links are at the end of the article.

Design Specs

Item Spec
Main controller ESP32-S3-WROOM-1-N16R8 (16MB Flash + 8MB octal PSRAM, dual-core 240MHz)
Metering ADC TI ADS131M02, 24-bit Σ-Δ, dual-channel simultaneous sampling, 4 kSPS
Voltage range Designed measurement 0–90V (101:1 divider chain theoretical full scale ±121V, limited by the 100V max input of the auxiliary supply)
Voltage resolution About 14.5 µV/LSB
Current range Peak ±75A (ADC full scale); rated ±30A (limited by XT60 connector)
Current resolution About 8.94 µA/LSB
Current sensing 1mΩ / 5W four-terminal Kelvin shunt, PGA 16x
Display 1.83-inch IPS, 240×284 (landscape 284×240), NV3030B, QSPI 4-bit
Touch CST816D capacitive touch, I2C
Sensors AHT20 temperature/humidity, SC7A20HTR 3-axis accelerometer (auto screen rotation)
Connectivity WiFi 2.4GHz, STA/AP, HTTP + WebSocket
Power Three inputs: XT60 input / USB-C / single-cell Li-ion battery; TPS2116 prioritizes USB, TP4057 charges at 400mA
Self-consumption About 0.7W
Enclosure Three-piece 3D-printed top cover / middle frame / bottom cover, SolidWorks source files + 3MF
Firmware v0.6.9, ESP-IDF v6.1 + LVGL 9.6

A few things that are easy to misread:

  • ±75A is the ADC full scale, not a continuous current. The 1mΩ shunt is rated to 70A (70mV drop and 4.9W dissipation at 70A), but the XT60 connector only goes to 30A (30mV drop and 0.9W at 30A). So the whole unit is rated ±30A; if you want to run higher current long-term, you'll need to modify the base board and switch to XT90 yourself.
  • 90V isn't the limit of the divider chain either. The divider itself can handle ±121V; it's the auxiliary supply (the Buck fed from XT60) with a 100V max input that caps the whole unit at 90V.
  • It's normal to show 0 when current is below 2mA. The 1mΩ shunt has fairly high small-signal noise (σ≈2mA per frame). The firmware uses a 200ms block average plus a 2mA deadband to suppress no-load jitter; the waveform page uses raw samples, so mA-level changes are still visible.
  • This is not a metering instrument. It's good enough for hobbyist measurement and debugging; don't use it as a reference meter.

Photos

The body is a three-piece 3D-printed enclosure: top cover, middle frame, and bottom cover, held together with M2.5 screws. On the front is a 1.83-inch IPS screen; to its left are the status LED and reset button. There are two physical buttons, K1/K2, on the side (long-press K2 to bring up the quick menu). The switch next to the Type-C port selects power: one side is battery / USB, the other is XT60 input.

Screen UI

The screen has three swipeable pages: Measure, Waveform, and Settings; it stops at the first and last pages. You can operate it by touch or with buttons only.

Main measurement screen Oscilloscope-style waveform page
Large voltage / current / power numbers; energy, temperature/humidity, and peak/valley values at the bottom V/I/P multi-mode, six time windows from 1s to 10min, auto-ranging
Settings page Pull-up quick menu
Measurement, display, buzzer, WiFi, energy statistics, alarms, about, factory reset Data refresh rate, clear energy statistics (with confirmation)

A few details that make it nicer to use:

  • The energy readout at the bottom of the home screen is tappable and toggles between Wh and Ah.
  • The waveform page's vertical axis ticks are anchored to the standard 1-2-5 values, so you can read them mentally; trailing zeros are also trimmed, showing 3V / 0.2A instead of 3.00V / 0.200A.
  • Popup width follows screen orientation (260px landscape, 216px portrait), so nothing gets clipped on the sides in portrait.
  • After 15 / 30 / 60 seconds of inactivity (configurable), the backlight dims to 10%; touch or any button press restores it immediately.
  • The UI screenshots above were generated with the project's PC-side LVGL simulator (tools/ui_sim), which shares the same UI source code as the real device—they're not Photoshopped.

Hardware Design

System Architecture

XT60 power meter hardware system architecture diagram

The whole unit is two PCBs stacked top and bottom:

  • Top board: main controller, screen, touch, sensors, buttons, buzzer, voltage divider, power management.
  • Bottom board: XT60 input/output, 1mΩ shunt, high-current copper busbar.

The battery sits between the two boards, attached to the back of the top board (the ESP32-S3 module side).

Module Main components Role
Main controller ESP32-S3-WROOM-1-N16R8 Sampling scheduling, UI rendering, WiFi communication, data storage
Metering front end ADS131M02 + LRA8551A Simultaneous voltage/current sampling, 24-bit, 4kSPS
Display/UI NV3030B LCD + CST816D + K1/K2 + buzzer Local display and controls
Sensors SC7A20HTR + AHT20 Screen orientation, internal temperature/humidity
Power SY8511BADC / TLV62084 / TPS2116 / TP4057 Three-input switching, 3.3V regulation, battery charging
Storage/upgrade 16MB Flash + dual OTA partitions Firmware, font resources, OTA and rollback

Voltage Sampling

Voltage sampling schematic

The voltage channel uses a 101:1 precision divider (100kΩ / 1kΩ, ±0.1% thin-film resistors). After division, it's buffered by a zero-drift op amp LRA8551A and fed into ADS131M02 CH1 (PGA 1x).

The divider chain itself has a theoretical full scale of ±121V, but the unit's auxiliary supply has a 100V max input, so the designed measurement range is 0–90V. At this range, one LSB is about 14.5µV.

Current Sampling

The current channel uses a 1mΩ / 5W four-terminal Kelvin shunt. The voltage sense points are separate from the high-current trace, so copper resistance doesn't get into the measurement loop; after RC filtering, the signal goes directly into ADS131M02 CH0 (PGA 16x).

With PGA 16x, the ADC full scale corresponds to ±75A peak, and 1 LSB ≈ 8.94µA.

Why 1mΩ? To cover ±75A peak and 30A rated while keeping the shunt's own heating under 5W, 1mΩ is what falls out of those constraints. The tradeoff is higher small-signal noise, which the firmware compensates for with block averaging and a deadband.

Power and Battery Management

Power management schematic
  • XT60 input: SY8511BADC steps down to 3.3V / 1A.
  • USB / battery: TLV62084 steps down to 3.3V / 2A. The V2 board uses TPS2116 to automatically switch between USB and battery, prioritizing USB.
  • Charging: TP4057, 400mA, single-cell Li-ion. Battery voltage goes through a 1:1 divider into the ESP32-S3 ADC for battery level display.
  • The V1 board also had a version using discrete MOSFETs for power switching; schematics for both versions are open source.

PCB Design

When laying out the board, I mainly focused on these things:

  1. Stack the top and bottom boards, connected with pin headers/sockets. Put the screen and all the chips on the top board, and push all high-current paths to the bottom board.
  2. ISENSE is a small differential signal; keep its traces as short as possible and away from the DC-DC inductor and switching nodes.
  3. Shorten the ADC's SPI and DRDY traces; don't run them in parallel with clock lines or switching noise for long distances.
  4. Thicken the copper on high-current paths and use a copper busbar to keep voltage drop and temperature rise down at 30A rated and 75A peak.
  5. For how the analog front end and digital section grounds/power are split, see the schematic and PCB project files; I won't go into it here.

Enclosure and Assembly

The enclosure was drawn in SolidWorks. Source files include three parts—top cover / middle frame / bottom cover—plus an assembly; the 3MF print files are separate.

Assembly order:

  1. Press heat-set inserts into the 8 screw holes on the middle frame; heating them with a soldering iron is enough.
  2. Install the bottom board into the bottom cover. Pay attention to the middle frame orientation; after placing the middle frame, tighten the four screws in the bottom cover.
  3. Wrap the battery in a layer of fish paper insulation, connect the battery holder, and stick it to the underside of the top board (the ESP32 module side) with double-sided tape.
  4. Align the board-to-board pin headers and snap the top board, together with the battery, onto the middle frame.
  5. Put on the top cover.
  6. Finally connect the screen and secure it with double-sided tape on the back.

Software Design

The firmware is based on ESP-IDF v6.1 + LVGL 9.6. Layered dependencies may only go top-down; business code is not allowed to call raw peripheral APIs directly.

main/                  启动流程、任务创建、参数下发
components/
├── drivers/           ads131m02 / lcd_nv3030b / touch_cst816d / key_button
│                      buzzer / imu_sc7a20h / aht20 / battery_adc / status_led
├── middleware/        data_store(seqlock)/ web_console / wifi_manager
│                      lvgl_port / fs_storage / event_bus / ota_update
└── services/          power_measure / ui / settings / orientation / device_ctrl
tools/
├── ui_sim/            PC 端 LVGL UI 模拟器(走查 + 回归截图)
└── fonts/             字库生成脚本

Measurement Chain

  1. ADS131M02 asserts DRDY every 250µs. SPI3 + GDMA reads the full 4-word frame: STATUS / CH0 / CH1 / CRC. The transfer is started directly in the DRDY falling-edge interrupt, locking the read window to the sampling phase.
  2. After CRC-16/CCITT passes, the values are converted to voltage, current, and instantaneous power using calibration parameters.
  3. Raw samples go into a three-stage ring buffer in PSRAM; the waveform page's history view and downsampling both read from there.
  4. Every 200ms it computes block averages, average power, peak/valley values, and alarms, while integrating energy and capacity.
  5. Every 25ms it produces a 40Hz snapshot frame. The UI and web page only read snapshots and never touch measurement data directly.

Dual-core split: Core 1 runs sampling and measurement; Core 0 runs LVGL rendering, buttons, and the WiFi/HTTP server. Why not put measurement on Core 0? The WiFi stack periodically eats a fair amount of CPU, and competing with 4kHz sampling for the core causes sampling jitter that shows up directly in the readings. For instrument firmware, trading hardware resources for timing determinism is standard practice.

Web Console

The web page is compiled directly into the firmware and doesn't depend on an external CDN, so it opens even without internet. Five tabs: Live Data / Waveform / Settings / API / Logs.

  • WebSocket /ws pushes snapshots at 15Hz; if disconnected, it automatically falls back to polling and reconnects every 5s.
  • The reading refresh rate can be set to 15 / 10 / 5 / 2 / 1 Hz. Lower settings average multiple received frames for steadier readings; the device send rate and waveform buffer are unaffected.
  • The waveform page is hand-drawn with Canvas, with V/I/P three-channel overlay, ten time windows, pause, drag-to-review, crosshair, range lock, and CSV export.
  • The settings page reads current values back from the device when opened, so it won't show frontend defaults; calibration parameters (voltage/current gain and offset) can be read and written directly on the web page.
  • The API page is numbered card-style documentation. Each card has a "▶ Test" button; clicking it sends a real request in place and shows the status code, latency, and response body.

Main endpoints: /api/state, /api/config (GET/POST), /api/info, /api/wifi/scan, /api/export.csv, /ws.

Engineering

  • Dual OTA partitions + boot rollback: ota_update_start(url) pull-based upgrade writes to the spare partition; if boot fails, it automatically rolls back to the old version. The web console doesn't have a firmware upload entry yet, so unbricking is still done via USB / serial flashing.
  • coredump: crash state is written to a separate partition for later export and analysis.
  • PC-side UI simulator: tools/ui_sim renders the same UI source on Windows and takes batch screenshots, so you can run a layout regression before flashing.
  • Host-side unit tests: pure logic parts (two's complement extension, calibration conversion, energy integration, button state machine, AHT20 CRC) can be tested without hardware.
  • Font subsetting: the main UI uses GB2312 Level 1+2, 6763 characters, two weights totaling about 4.2MB, stored in a separate storage partition; the boot screen uses a tiny separate subset of about 197 characters compiled directly into the app, so the first frame already shows complete Chinese.

A quick war story: the boot screen used to wait for the filesystem to mount and the full font library to load before showing anything, so the screen took 1.42s to light up. After moving the display chain (LCD / touch / LVGL / IMU / orientation) earlier to steps 9–13 and moving fs_storage later, it now lights up in about 1.09s.

Usage

Power meter connected to a test circuit
  1. Wiring: Connect the XT60 input to a power supply or battery and the output to the load; watch the polarity. Input and output can be swapped; reverse current will show as negative.
  2. Power on: Flip the switch to USB / battery to power on. If it's set to XT60 input, the input needs to be above 5V for it to start.
  3. Measure: The main screen shows voltage, current, power, and energy. Tap the energy row at the bottom to toggle between Wh and Ah.
  4. Waveform: Swipe to the waveform page, swipe up to bring up the quick menu, and switch time window and V/I/P mode.
  5. Quick menu: On the measurement page, swipe up or long-press K2 to adjust refresh rate or clear energy statistics (with a confirmation first).
  6. WiFi setup: Settings → WiFi & hotspot → Scan WiFi → enter password. You can also have it create a hotspot; connect your phone to the device hotspot and configure WiFi from the web page.
  7. Web: Once WiFi is configured, open the device IP from a phone or computer on the same LAN.
  8. Charging: Connect 5V to USB-C; TP4057 charges at 400mA, and the status bar shows battery level.

Power Consumption and Testing

Measured self-consumption is about 0.7W. That's the power the device itself draws; it adds to the circuit under test, so keep this baseline in mind when testing low-power devices.

Power consumption test

Validation of the sampling chain focused on two things: frame integrity during continuous sampling, and timing stability from DRDY to SPI start. At 4kHz, the 250µs period window is tight; if a read frame crosses the conversion-complete point, DRDY gets suppressed by the hardware and the frequency drops immediately. The final approach was 20MHz SPI to shorten the read window, plus starting GDMA directly in the DRDY interrupt to lock the phase; in continuous runs the frame rate was stable.

For accuracy, the current calibration method is: auto-zero the current at no load, then correct gain/offset using a known voltage and a reference meter. There's no multi-point calibration or long-term drift testing. So this unit is positioned as a "debugging tool", not a "metering instrument". If you want higher accuracy, you can add your own calibration points; gain and offset can be changed on both the device settings page and the web page.

Build Notes

  1. The files are a complete set—don't just download the firmware folder. Schematics, LCEDA project, Gerber, BOM, stencil, SolidWorks enclosure, and 3MF are all in the same repository.

  2. For PCB fabrication, 1.2mm board thickness is recommended; impedance and lamination can use the default process. Gerber files are in 05-生产文件/01-PCB/; the stencil file has top and bottom combined on one sheet, so you can just order a laser stencil on Taobao.

  3. For soldering, use the "stencil + hot plate" route: align and secure the stencil → apply solder paste → place components according to the interactive BOM → reflow on a hot plate or with hot air → finally solder through-hole parts. Open the interactive BOM in a browser; reference designators highlight, making it easy to find components.

  4. There are two ways to flash. If you have ESP-IDF v6.1 installed, use the scripts:

    cd 02-Software/XT60-Power-Meter-Firmware
    .\build_fw.bat
    .\flash_fw.bat COM3
    

    If you don't want to install the environment, open ESPConnect in Chrome / Edge and flash the full firmware over Web Serial.

  5. The firmware consists of 5 images; don't flash only the app. idf.py flash handles it automatically according to flash_args; if flashing manually, note that storage.bin is at 0x830000 and contains the full Chinese font. If you change the font library, you must flash the full set; OTA alone will result in "upgrade succeeded but Chinese turns into boxes".

  6. Don't get the calibration order backwards: first do current zero calibration at no load (the device averages a 3-second block), then calibrate voltage gain and offset, and finally calibrate current with a reference meter in series. Parameters are written to NVS and survive power loss and upgrades.

  7. I recommend printing the enclosure in translucent material, so the screen and status LED can shine through; it looks much better than solid colors.

Features to Implement

  1. Complete OTA upgrade flow. The foundation is there: dual OTA partitions, pull-based upgrade middleware, and boot rollback validation all work; what's missing is the web-side firmware upload entry and post-upgrade self-check gating.
  2. USB serial host functionality + companion host software. Right now there's only the WiFi web page; the "plug in a cable and view data" use case hasn't been implemented yet.

I'll add these two when I have time; you can also implement them yourself and submit a PR.

Known Issues

When powered by USB / battery, 3.3V back-feeds into the XT60 connector.

The path is: 3.3V goes through the body diode of the internal MOS in the Buck chip for XT60 input, then through the body diode of the power-control MOS (Q4), and back-feeds to the XT60 terminals. So even with nothing connected to XT60, the measurement screen shows about 2.45V (3.3V minus two body-diode drops).

Back-feed path explanation

Three fixes, from least to most modification:

  1. Don't change the circuit and don't use XT60 input: simply don't solder the Buck for XT60 input and power it from battery only.
  2. Change just one component: add a back-to-back MOS in series after Q4 to break the body-diode path. This is what I'll change in the next version.
  3. Just don't use battery / USB: switch to XT60 power and there's no back-feed path, but it must be connected to XT60 to power on.

A few other known limitations:

  • When switched to XT60 power, the input must be at least 5V to start.
  • Current |I| < 2mA is treated as 0; this is by design, not a fault.
  • The web console has no OTA upload entry; upgrading still requires a cable.
  • Measurements are DC block averages, not true RMS. Measuring AC or ripple would require a different design.

Schematics

The complete schematic PDFs (top board V1 / V2, bottom board) and LCEDA project are under 01-Hardware/ in the repository.

Download Links

The provided files include LCEDA project files, top/bottom board schematic PDFs, Gerber fabrication files, stencil files, BOM, reference designator map, interactive soldering helper HTML, SolidWorks enclosure source files, 3MF print files, datasheets for all components, and the complete ESP-IDF firmware project (including architecture docs, flashing guide, pin table, and PC-side UI simulator).

Repository structure:

XT60-Power-Meter/
├── 01-Hardware/                     硬件设计
│   ├── 01-XT60功率计-立创EDA工程.epro2
│   ├── 02-上板原理图_V1.pdf / V2.pdf
│   └── 02-下板原理图.pdf
├── 02-Software/
│   └── XT60-Power-Meter-Firmware/   ESP-IDF 固件工程
│       ├── main/                    启动与任务编排
│       ├── components/              驱动 / 中间件 / 服务
│       ├── docs/                    架构、烧录、引脚文档
│       └── tools/                   字体工具、UI 模拟器
├── 03-Datasheet/                    器件数据手册与屏幕资料
├── 04-外壳设计/                     SolidWorks 源文件与 PCB 模型
├── 05-生产文件/
│   ├── 01-PCB/                      Gerber 与手工焊接钢网
│   ├── 02-贴片/                     BOM、位号图、交互式焊接辅助
│   └── 03-外壳3D打印文件/           3MF 打印文件
├── LICENSE                          硬件 CERN OHL-S v2
├── README.md
└── README.en.md

For licensing, the hardware (schematics, PCB, enclosure, production files) uses CERN OHL-S v2, a strongly reciprocal open hardware license; derivative hardware must be open-sourced under the same license. Firmware uses MIT. Third-party components such as LVGL, esp_lvgl_port, and Noto Sans SC keep their original licenses; details are in THIRD_PARTY.md.

Disclaimer

  • Measurements from this device are not valid for metrology certification.
  • 90V / ±75A peak are hazardous voltages and currents. When wiring, soldering, and testing, guard against short circuits, electric shock, and reverse connection; use suitable wire gauge and connectors for high-current tests.
  • The author is not liable for any direct or indirect loss caused by using this project's hardware or firmware.
  • Feel free to report issues and suggest improvements in the comments or on Gitee Issues.

Open-Source Project Recommendations

Recommended Reading

English Version of the Article: https://blog.zeruns.top/archives/107.html

Translated by AI from 简体中文

4
6
Log into join the discussion.

6 replies

Sort order
  1. loc-yes Diamond Diamond member 16d ago

    A doer

    Translated by AI from 简体中文

    0
  2. zzhzhou Silver 3 YEARS 15d ago

    Bookmarking this for now, thanks!

    Translated by AI from 简体中文

    0
  3. q97575314 Diamond 3 YEARS 15d ago

    This is pretty intense—got completely sucked in as soon as I opened it. Would be even better with a detailed list and shopping links :03-xiexie:

    Translated by AI from 简体中文

    0
  4. Zercher Silver 15d ago

    Bro, awesome w — I'll try replicating it when I have time.

    Translated by AI from 简体中文

    0
  5. aiwentisika Gold 12d ago

    Bro, you're a beast — mad respect.

    Translated by AI from 简体中文

    0
  6. Cavalier Silver 12d ago

    You're a legend, thanks!

    Translated by AI from 简体中文

    0