Power status panel with INA219 and OLED

Shows voltage, current, power, energy and min/max voltage on an OLED, with a button to switch pages.

Level: Intermediate Board: ESP32-S3 DevKitC-1 Power & blackouts

⚠ Safety

Li-ion cells: watch polarity, use protected cells and a charger with protection, never leave a damaged cell charging unattended.

What you need

Buy the parts kit · Estimated total: $14.50

ESP32-S3 DevKitC-1 N16R8 × 1
$8.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
Tactile buttons (set) × 1
$0.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.

Wiring

ModuleModule pinESP32 pinNote
INA219 + OLED SDA / SCLI2CGPIO8 / GPIO9INA219 0x40, OLED 0x3C
INA219 Vin+ / Vin-shuntin series with the load +up to 26 V and 3.2 A with the stock shunt
Buttonone sideGPIO7other side to GND; short press changes the page

Libraries

Arduino IDE → Tools → Manage Libraries, then install:

  • Adafruit INA219
  • Adafruit SSD1306
  • Adafruit GFX Library

Code

power-panel.ino
#include <Wire.h>
#include <Adafruit_INA219.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

Adafruit_INA219 ina; Adafruit_SSD1306 oled(128, 64, &Wire, -1);
const int PIN_BTN = 7;
int page = 0; float vMin = 99, vMax = 0, wh = 0; uint32_t lastMs = 0, lastBtn = 0;

void setup() {
  Serial.begin(115200); pinMode(PIN_BTN, INPUT_PULLUP); Wire.begin(8, 9);
  ina.begin(); oled.begin(SSD1306_SWITCHCAPVCC, 0x3C); oled.setTextColor(WHITE); lastMs = millis();
}
void loop() {
  float v = ina.getBusVoltage_V(), a = ina.getCurrent_mA() / 1000.0, w = v * a;
  uint32_t now = millis(); wh += w * (now - lastMs) / 3600000.0; lastMs = now;
  vMin = min(vMin, v); vMax = max(vMax, v);
  if (digitalRead(PIN_BTN) == LOW && now - lastBtn > 300) { page = (page + 1) % 3; lastBtn = now; }
  oled.clearDisplay(); oled.setCursor(0, 0); oled.setTextSize(1);
  if (page == 0) { oled.setTextSize(2); oled.printf("%.2f V\n%.2f A\n%.1f W", v, a, w); }
  else if (page == 1) { oled.printf("Energy\n"); oled.setTextSize(2); oled.printf("%.2f Wh", wh); }
  else { oled.printf("Voltage min/max\n"); oled.setTextSize(2); oled.printf("%.2f\n%.2f", vMin, vMax); }
  oled.display(); delay(250);
}

Flash a ready firmware from the browser Paste your error into the AI Error Doctor

Build tips

  • Keep the shunt wires short and thick; remember the INA219 limit of 26 V and 3.2 A.
  • For a bigger load use an external shunt and recalculate the calibration.

← ← All projects

Related ideas

Outage schedule countdown display

A small screen that loads your own outage schedule and shows the time to the next switch-off or switch-on, so you can plan charging and cooking.

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

OLED weather clock

Time from the internet, indoor temperature and humidity on a small OLED screen.

  • Board ESP32 DevKit V1 (WROOM-32)
  • Level ●○○ Beginner
  • Build time 1–2 h
Pick parts / kit
⚠ Caution

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

DC power meter with display

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

  • Board ESP32 DevKit V1 (WROOM-32)
  • Level ●○○ Beginner
  • Build time 1 h
Pick parts / kit

Comments

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

Comments are moderated.