florian marending

25 Feb 2023

Measuring power consumption of ESP32 development boards

First forays into embedded devices

I like some nice greenery in the living room. I also like data. Naturally, I have to monitor the CO2, temperature and humidity in the room as well as the soil moisture and incident light on the plants.

Fine, maybe I don't have to, but it's fun anyway. To make it happen without a huge mess of cables, I would like to set up a system where the sensors are battery operated and report their measurements into my monitoring setup (prometheus + grafana as of now).

Until now, I've used Raspberry Pis and similar devices as low power home servers. They are great as fully fledged file or web servers. For this endeavor however, they are clearly too power hungry. I'm envisioning months if not years of battery life, not just days. So I started playing with the idea of venturing into embedded devices. Since I had absolutely no idea what I'm doing, I chose a well trodden path: ESP32.

As usual when I pick up a new topic of interest, I buy all kinds of stuff I probably don't need. In this case I got a range of dev boards, dozens of sensors, breadboards, cables, a ridiculous number of resistors and even a multimeter. This is of course a stupid thing to do but all that stuff was just so damn cheap I couldn't help it.

For starters, I want to understand what kind of power envelopes I'm dealing with on these devices. So I measured the power consumption of four dev boards in different scenarios: Normal operation without Wifi, normal operation with Wifi, light sleep and deep sleep.

Methodology

Thanks to my multimeter, measuring the power consumption of the devices is not too hard. I just needed a power source I can connect in series with the multimeter, so I can take the measurements. The battery pack I have has a JST-PH2 connector which I don't want to cut off to get access to the wires. So instead, I wired together a bootleg battery by connecting three AA batteries in series, giving me 4.5 Volts.

The dev boards need a lot of power to initially boot up and start running code. Once they enter sleep, the current drops down. A tiny hiccup here was to realize that I can't set my multimeter to the microamp setting from the beginning, as apparently not enough current makes it through the meter to let the board start up properly. Instead, I need to set it to miliamps at first, this way it can boot up and afterwards I can turn the setting to microamps without the power getting interrupted.

Note that these are mostly out of the box values a novice like myself would realistally achieve. I'm sure one could optimize the power consumption further with advanced tricks.

Boards under test

I'm testing a DFRobot FireBeetle ESP32 and a Firebeetle ESP32-E. The latter has a low power pad that can be cut with a knife to isolate an LED. For this board I've measured power before and after the pad was disconnected. Next, I also have a Seeed Studio XIAO ESP32C3 and an M5Stamp C3U to test.

Results

ScenarioFirebeetle ESP32Firebeetle ESP32-E (stock)Firebeetle ESP32-E (low power)
Wifi setup60 - 80 mA70 - 140 mA70 - 140 mA
Blink in loop36 mA41 mA40.5 mA
Light sleep with LED1.5 mA3.2 mA2.65 mA
Light sleep no LED1.2 mA2.6 mA2.2 mA
Deep sleep10 uA470 uA12 uA
Table 1: Power consumption of ESP32 dev boards in various situations
The current while the Wifi module is connecting to the access point is too erratic to draw conclusions from in my opinion.

I'm pleased to see that the advertised 10 microampere deep sleep current are actually achievable out of the box. This should enable some really long-lived battery powered sensors. Some back-of-the-napkin math tells us that a device that sleeps with this power draw could realistically run 10 to 15 years off of a small 1500 mAh battery. Quite exciting!

Also interesting is the vast impact the connected LED seems to have on the deep sleep current. 470 uA vs 12 uA could have a huge impact for a device that is mostly sleeping. With the same 1500 mAh battery a device with 470 uA draw could only sleep for around 100 days.

ScenarioSeeed XIAOM5Stamp
Wifi setup30 - 60 mA30 - 60 mA
Blink in loop18 mA18 mA
Light sleep with LED1.5 mA2.2 mA
Light sleep no LED0.2 mA0.95 mA
Deep sleep38 uA750 uA
Table 2: Power consumption of ESP32-C3 dev boards in various situations

Given that the ESP32-C3 boards only have one processing core compared to the two on the other ESP32 boards, it's not suprising to see less power consumption in normal operation. They are also RISC-V based.

The M5Stamp board is kind of underwhelming with very bad deep sleep current. As it's in a similar ballpark as the FireBeetle ESP32-E with the low power pad still connected, I would guess that it's due to the extremely bright LED that is on this board.

The Seeed XIAO on the other hand surprises with extremly good light sleep current. On a 1500 mAh battery this device could sleep in light sleep for almost a full year, and around 4 years in deep sleep. It will be interesting to check if it's even worthwile to go into deep sleep on this device assuming wake-up is probably slower.

Next steps

Now that we have established that deep sleep current is probably not going to be the bottleneck in terms of battery life, I will explore different approaches for getting data off device as fast as possible without wasting power. E.g. Bluetooth low energy (BLE) compared to Wifi or ESP-NOW. Continue reading Part II