DC power meter with display

A compact volt/amp/watt meter for 5–26 V circuits with an OLED screen and a web page.

Power & batteries Board: ESP32 DevKit V1 (WROOM-32) Level: ●○○ ⏱ 1 h

⚠ Caution

Batteries: watch polarity, use protected cells and a charger with protection, never charge damaged cells unattended.

A bench tool that pays for itself in an evening

This is the simplest of the power ideas, and the one you will actually use again and again: put it in series with a power bank, a solar panel, a car charger or a strip of LEDs and read volts, amps and watts on the screen. After that the web page adds a watt-hour counter that you reset with a button.

Limits to remember

With the default 0.1 Ω shunt the INA219 measures up to about 3.2 A and up to 26 V. Above that the chip is out of range, and a spike of a 12 V inductive load can damage it. The meter measures on the high side, so the load ground and the ESP32 ground are common.

  • A cheap USB cable adds its own resistance; measure at the load connector, not at the source.
  • Dim or blank the OLED after a minute. Static text burns the pixels in a few months of continuous use.
  • For currents in the tens of amps, build the battery monitor idea with an external shunt instead.

Components

  • ESP32 DevKit V1 (30 pin, WROOM-32)
  • INA219 current/voltage sensor module
  • OLED 0.96" 128x64 I2C SSD1306
  • Dupont jumper wires (M-F, M-M)

Wiring

Module Module pin ESP32 pin Note
INA219 + OLED SDA / SCL I2C GPIO21 / GPIO22 different addresses, shared bus
INA219 Vin+ / Vin- shunt supply + → load + up to 26 V / 3.2 A

Libraries

  • Adafruit INA219
  • Adafruit SSD1306
  • Adafruit GFX

Code

#include <Wire.h>
#include <Adafruit_INA219.h>
#include <Adafruit_SSD1306.h>
Adafruit_INA219 ina;
Adafruit_SSD1306 oled(128, 64, &Wire, -1);
double wh = 0; uint32_t last = 0;
void setup() {
  Serial.begin(115200);
  Wire.begin(21, 22);
  ina.begin();
  oled.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  last = millis();
}
void loop() {
  float v = ina.getBusVoltage_V(), a = ina.getCurrent_mA() / 1000.0, w = v * a;
  uint32_t now = millis(); wh += w * (now - last) / 3600000.0; last = now;
  oled.clearDisplay(); oled.setTextColor(WHITE); oled.setTextSize(2);
  oled.setCursor(0, 0);  oled.printf("%.2f V", v);
  oled.setCursor(0, 20); oled.printf("%.3f A", a);
  oled.setCursor(0, 40); oled.printf("%.1fW %.2fWh", w, wh);
  oled.display();
  delay(500);
}

Build tips

  • The module handles up to 26 V and 3.2 A; use an external shunt for more current.
  • Place the INA219 on the positive (high) side of the load.

What you need

Buy the parts kit · Estimated total: $10.00

ESP32 DevKit V1 (30 pin, WROOM-32) × 1
$4.00
Buy at AliExpress Buy at Amazon.com
INA219 current/voltage sensor module × 1
$2.00
Buy at AliExpress Buy at Amazon.com
OLED 0.96" 128x64 I2C SSD1306 × 1
$2.50
Buy at AliExpress Buy at Amazon.com
Dupont jumper wires (M-F, M-M) × 1
$1.50
Buy at AliExpress Buy at Amazon.com
🇺🇦 Ukraine🌍 Other countries

Other countries: order these parts on AliExpress with the links below.

Some links are affiliate links: we may earn a commission at no extra cost to you.

Related ideas

⚠ Caution

Batteries: watch polarity, use protected cells and a charger with protection, never charge damaged cells unattended.

Mini-UPS monitor for the router

Watches the battery of a 12 V mini-UPS that powers the router, shows its voltage, load and estimated runtime, and warns before it runs flat.

  • Board ESP32-C3 SuperMini
  • Level ●○○ Beginner
  • Build time 1–2 h
Pick parts / kit
⛔ High risk

High-current battery: a short circuit can start a fire. Put a fuse next to the battery plus, use thick enough wires and respect the BMS limits.

LiFePO4 / battery monitor

Shows voltage, current and power of a battery bank (INA219) so you know the real charge and load during outages.

  • Board ESP32 DevKit V1 (WROOM-32)
  • Level ●●○ Intermediate
  • Build time 1–2 h
Pick parts / kit
⛔ High risk

Mains 220–230 V can kill. Work with the power off, use certified isolated modules in an enclosure, fuse the line, and ask a qualified electrician if you are not sure.

Inverter load manager

Watches the inverter / battery current and switches off non-critical loads with a relay when the battery runs low.

  • Board ESP32 DevKit V1 (WROOM-32)
  • Level ●●● Advanced
  • Build time 3–5 h
Pick parts / kit

← All module ideas →

Comments

No comments yet. Share your experience or ask a question.

Comments are moderated.