ESP32/Power/76. Measuring current draw
Your chip
Your language
Power · 76 of 81

Measuring current draw

Every battery estimate is a guess until you measure it, and measuring an ESP32 is genuinely hard - the interesting range spans ten thousand to one, and a multimeter on the microamp range browns the board out on every transmit.

/esp32/measuring-current-draw · arduino · S3

What each instrument can see

Multimeter in series
an average
Resistance inserted
1000 Ω
Voltage lost at 350 mA
350.00 V
Smallest it can see
100 µA
On the µA range the meter is a 1000 Ω resistor in series with your board. The moment Wi-Fi transmits, 350.00 V disappears into the meter and the chip browns out — so you measure a board that is resetting, not a board that is sleeping. On the mA range it survives and cannot resolve sleep at all, and either way it averages a cycle whose two halves differ by ten thousand times.

Measure the time, not the current

If you own nothing but a multimeter, this still works: put a scope or even an LED on a marker pin, and measure how long the board is awake. Awake time multiplied by a datasheet figure of roughly 120 mA gets you within twenty percent, and it points at the right thing to fix.

The three findings that always come out of this

  1. The awake time is longer than you think. Usually the Wi-Fi join.
  2. Something did not go to sleep. A sensor, a display backlight, a pull-up through a switched-off device.
  3. The dev board is the load. Between one and twenty milliamps, permanently, regardless of your code.
On your S3
ChipXtensa LX7 · 2 × 240 MHz
Board settingESP32S3 Dev Module
Default I2CSDA 8 · SCL 9
Watch out forThe port vanishes after upload

The code

A pin that goes high while the board is awake turns any oscilloscope into a timing marker. Awake time is the number that decides battery life, and this is the cheapest way to see it.

measure_marks.ino
#include <esp_sleep.h>

const int MARK = 27;        // put a scope probe here

void setup() {
  pinMode(MARK, OUTPUT);
  digitalWrite(MARK, HIGH);          // awake starts now

  Serial.begin(115200);
  // ... connect, read, send ...
  unsigned long awake = millis();

  Serial.printf("awake %lu ms\n", awake);
  Serial.flush();

  digitalWrite(MARK, LOW);           // awake ends here
  esp_sleep_enable_timer_wakeup(60ULL * 1000000);
  esp_deep_sleep_start();
}

void loop() {}

Set the marker before anything else in setup and clear it immediately before sleeping. Everything between those two lines is what the battery is paying for.

When it does not work

The board resets whenever the meter is in circuit

Burden voltage. On the microamp range a multimeter is a kilohm in series, and a 350 mA burst across that is more than the whole supply. Measure sleep and awake on different ranges, or use an instrument built for it.

The meter reads something between sleep and transmit

It is averaging, and the two halves differ by four decades. An average tells you nothing about which half to fix.

My measured sleep current is far above the datasheet

You are measuring the dev board. LED, USB chip and regulator quiescent add up to milliamps. Measure the module alone.

Numbers change every run

They will - a Wi-Fi join takes a variable time. Measure twenty cycles and take the mean, and record the worst case too, because the worst case is what flattens a battery.

Where this goes next

Power settled. The last chapter is the system underneath: two cores, crashes, audio, camera and screens.

Dual core tasks

Edit this page — content/esp32/measuring-current-draw.mdx

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse ESP32 on the forum