6
\$\begingroup\$

I'm in the process of building a device based on the Espressif ESP32. The device will spend most of its life in deep sleep. With a simple multimeter I've been able to determine that it's using 0.25 uA while in deep sleep.

The device is running out of battery (800mAh battery) in a couple of days, though. Either my battery is not good, or my measurement is not.

I'm now looking for a device to monitor the current over a longer period of time (like a few days.)

What kind of device would be suitable for this? Preferably I would like to be able to analyse the results afterwards.

I came across this probe, but it seems like it would costs a few thousand Euros, I would rather spend just a few hundreds of Euros.

Would a uCurrent together with something like a USB oscilloscope be a suitable solution, or are there any other methods you can recommend?

\$\endgroup\$
3
  • 1
    \$\begingroup\$ At sub-uA levels you're going to have trouble finding something inexpensive which has both the accuracy & resolution to give you a useful result. \$\endgroup\$
    – brhans
    Commented Aug 22, 2021 at 13:01
  • 1
    \$\begingroup\$ Does your multimeter have a 'max' function? \$\endgroup\$ Commented Aug 23, 2021 at 6:10
  • \$\begingroup\$ a.) what kind of Multimeter allows to measure nA? I'am not aware that even x thousand dollar devices do this. .b) a friend of mine build a current measurement for the msp430 in the area of µA 20 years ago... it was a floating differential amplifier in a shielded housing, and even with this sensitive setup the measurement data needed to be extracted by correlation out of the noisy data. So, I think you can not - with any reasonable effort - do what educated engineers do in a well equipped laboratory in weeks or even month. \$\endgroup\$
    – schnedan
    Commented Aug 23, 2021 at 7:55

5 Answers 5

18
\$\begingroup\$

First, your measurement is definitely wrong.

There is no way an ESP32 is drawing 250nA, no matter how deep a sleep it is in. It is specced to draw between 150µA to 10µA depending on what you disable in addition to deep sleep.

Regardless, that is still far too low to drain your battery.

When you say, 'most of its time in deep sleep', this is all you really need to know - how much time is it really spending asleep or awake. How sure are you that it is correctly entering sleep a second time, or a third, or whatever?

It is just a bit suspicious, as 800mAh/48 hours is about 33mA. The nominal power draw of the ESP32 when not using either of its radios is about 30mA. That might just be a coincidence, and I don't think you meant it died exactly 2 days later, but the point is the approximate scales here are about right for it to not be quite as sleepy as you think it is.

You don't need any measurement device to do this. The ESP32 has an RTC, so you can simply write a bit of code that will actually log how long it is spending awake, and from that, you can extrapolate how long its been asleep as well.

I think if you do that, the results should be fairly eye opening. It is important to realize how power hungry the ESP32 actually is. If it is sending packets over WiFi, you can expect the current draw to be 260mA. And if you are also using bluetooth at the same time (which you probably aren't but just in case), it can hit peak draws of 780mA(!).

Wifi is not energy efficient by design and prioritizes throughput and range at the cost of power use. Also, keep in mind that if you are putting your ESP in deep sleep and having it wake up periodically to transmit something over Wifi, it has to start from scratch each time. It has to find the SSID, do the handshaking and authentication then get an IP address (if it isn't statically set) and the entire process of connecting to a network as if it was the first time.

That can take a while and is potentially even more power hungry than simply transmitting data alone. Transmission will be done at maximum power until link quality is established.

It is hard to say much more since you didn't really provide any useful information about what you're doing. But this is a processor with well-defined power states and an RTC. You already have everything you need to measure the current more than well enough to figure out what the problem is.

Also keep in mind that battery voltage drops as it is discharged, so be sure you're actually using all of the batteries capacity. It is possible the voltage drops too far for the ESP32 to function (like during a wifi current spike), but a large portion of the battery charge remains unspent.

If you really want to get an accurate current measurement over time, this will not be easy or cheap unfortunately.

This isn't some analog circuit with relatively slow and small changes in power consumption.

This is a CPU with millions of CMOS charge-actuated transistors inside as well as some RF transistors that are consuming current with all the wiggliness of WiFI in its 2.4 billion wiggles per second of glory.

You need something that can sample current (or voltage - is really just voltage when you measure current, but you measure the drop across a resistor) fast and data log it all. Or you can heavily filter the power input instead, but then you are also destroying the information about the actual shape and timing of the current consumption to varying degrees, and are only seeing something like a moving average.

Digital stuff can easily confuse any 'simple multimeter' as well. You need a true (actually, really, seriously true, and with high bandwidth) rms multimeter to accurately measure anything to do with something digital like this.

Honestly, the thing you want is a multimeter with data logging. There are quite a number of them, but the one I am familiar with is the Fluke 289. It is not cheap. I don't think any of them are. But they're cheaper than an oscilloscope, and most oscilloscopes aren't going to do data logging for 2 days, but a data logging multimeter sure will.

That said, I strongly recommend you not buy anything you don't need. There is no reason you can't figure this out simply by writing code and then using the typical current consumption specs (like this one) to get a 'good enough' picture of what is going on and it won't cost you a cent.

\$\endgroup\$
15
\$\begingroup\$

Your device uses 0.25 uA in sleep mode. In 2 days = 48 hours, that's 12 uAh, but you're burning through an 800 mAh battery. It sounds like you don't need any precision, but just orders of magnitude. It sounds like you need to know how often the device becomes active, and for how long each time.

Rather than spend a few thousand, or even a few hundred euros, how about a few eurocents?

If you already have your USB oscilloscope, or are contemplating buying one anyway, a simple diode is all you need for a low precision, wide current range measurement shunt. If you use two thermally-coupled diodes, like two of the four diodes in a single-package bridge rectifier, one diode biassed with a reference current of perhaps 1 uA, then the difference between the two will not be affected by the temperature.

You can expect a change in forward drop of 100 to 200 mV as the current changes by 4 or 5 orders of magnitude, so your ESP82 will be able to get an in specification power supply from the diode whether sleeping or active, if you choose the diode supply voltage correctly.

Calibrate your diode initially with a known 1 uA, 1 mA, 10 mA. There's no reason you shouldn't be able to achieve 10% accuracy of reading with the temperature compensated version, but at this stage of your investigation, you don't need more precision. The accuracy is 'of reading', which means that even on the very low currents, your measurement accuracy will not be swamped by a zero uncertainty.

\$\endgroup\$
2
\$\begingroup\$

you could get a uCurrent gold which is specifically built for current measurement ... but it doesn't do autoranging. It is better than just a multimeter current measurement or measuring voltage drop over a known inline resistor, though, because it uses opamps internally to eliminate so-called burden voltage. Add a data logger to that and you can at least see clearly (a) what current looks like in sleep mode, and (b) what your duty cycle is.

\$\endgroup\$
1
  • \$\begingroup\$ Is the burden voltage a problem in this application? \$\endgroup\$ Commented Aug 23, 2021 at 16:14
2
\$\begingroup\$

I agree with Neil_UK, your units are off for the deep sleep current, and you are probably awake a lot more than you think.

You probably don’t need to measure current usage for days, just a single cycle should be enough.

Then you compute how much you use in each cycle, and how long each cycle lasts, and you get your actual average current.

It is common to underestimate the draw during the awake part of the cycle, either in amplitude, or in duration, and given the very different orders of magnitude, the awake part can drown the deep sleep part.

For instance, if you deep sleep at 10 uA (which would be a very very good score for an ESP32, most boards have onboard regulators that draw hundreds of uA rather than tens), but your average current in the awake cycle is 100 mA and it lasts 5 seconds and you wake up every minute, then you draw $$\frac{(55 \times 0.01 + 5 \times 100)} {60} = 8.34 \space mA$$ on average. That means that even though you spend more than 90% of your time in deep sleep, you draw 99.9% of the current during the awake phase!

So to determine your actual average current, you need three things:

  • get a good idea of the duration of the awake phase and how much current is used during that phase.
  • measure your actual deep sleep current (definitely not 0.25 uA, probably closer to 0.25 mA, though that depends a lot on the board and the regulator it uses, the exact deep sleep settings, and any other chips/devices/sensors you may have)
  • be sure of how long you stay in deep sleep/how often you wake up. Make sure your board is actually going to sleep every time, make sure it doesn’t come out of sleep when you don’t expect it (e.g. based on some interrupt), and don’t underestimate the weight of the small awake phase.

In terms of tools, there are plenty of choices, from under $50 (cheap oscilloscopes which aren’t particularly good but more than enough to get a quick idea) to several thousands. Many people swear by Qoitech’s Otii Arc, which is in the range of the hundreds.

Note that in your case you don't necessarily need a tool which can measure precisely µA as well as mA in the same graph. As you have two very distinct phases (deep sleep and awake phase) and the current profile during the awake phase is relatively consistent in terms of order of magnitude (tens to hundreds of mA), you can measure the two phases separately. A multimeter is enough to measure the current during the deep sleep phase (it should be very close to constant), while a tool set with a max somewhere between 100 mA and 1 A should be more than enough to get a good idea of what happens during the awake phase (and whether the board is indeed in deep sleep).

\$\endgroup\$
1
\$\begingroup\$

One of the best tools for measuring small discharge currents is the battery itself. It is a pretty good integrator.

Just get a good, brand new battery (few Euro) and a battery analyzer (imax b6 is few tens of Euro).

Now you can both check the battery sanity and periodically check what is left in the battery (by discharging it with the analyzer)

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged or ask your own question.