#386 How to measure low Currents for ESP/Arduino? Power Profiler, Otii, µCurrent Gold, Joulescope

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Measuring the power consumption  of battery-operated IOT devices   is tricky. In this video, we will  look at how to measure tiny currents,   and in a next video, we will use this  knowledge to test some new ESP32 boards.   I will introduce you to the new Power  Profiler Kit II from Nordic and compare   it with other well-known tools to determine  which one is the best value for your money.   Grüezi YouTubers. Here is the guy with the Swiss  accent. With a new episode and fresh ideas around   sensors and microcontrollers. Remember: If you  subscribe, you will always sit in the first row.   Recently I got a lot of new battery-powered  ESP32 boards from around the world.   The most important question is: How long will they  work before charging or replacing the battery?   A fully charged 18650 battery has a  capacity of around 3000mAh. A typical   ESP32 consumes around 100mA if it  uses Wi-Fi. Without precautions,   the battery is depleted after  30 hours. Not what we want.   So, in this video: - We will have a look at the power   consumption of the ESP32 if we use deep-sleep - We will find and solve problems during current   measurement and learn about burden voltage - We will compare several low burden voltage   current meters which are made  particularly for this purpose   - We will check out a typical  battery-operated board   - And you will get my verdict Measuring the current of this Lilygo   T7 board is simple: We use our bench multimeter,  connect it between the USB hub and the device,   and measure current. Right? Let s try it out. I  cut the Vcc wire of this USB cable in the middle   and insert my UT71D Multimeter. Because I expect  to measure around 100mA, I select the mA range.   For the experiment, I use the BasicHTTPClient  example sketch. It starts without problems.   But as soon as it starts to call the internet,  a brownout is detected, and the ESP32 crashes.   Not good. First: What is a brownout? It is  triggered by a low voltage of below 2.43 volts.   This cannot be. My USB hub delivers 5 volts, and  the ESP32 board has a 3.3-volt regulator built-in.   So let s check. I connect my trusted oscilloscope  to the 3.3-volt rail of the ESP32. And really,   from time to time, the voltage has a huge dent and  is below 2.43 volt. So the brownout is justified.   But why does this happen? When we measure current,   in reality, we measure the voltage across a  resistor. So, how big is the resistor in my UT71D?   Using my bench multimeter, I measure 6  Ohms. The ESP32 consumes around 75mA.   Ohm s law says that we only lose 0.45  volts. This should not create a brownout   because the voltage regulator should be able to  deal with it. So, what the hell is going on? And   what can be done against it? What happens if  we change to the ampere range? Now it works!   But of course, we lose a lot of precision. Let s measure the internal resistance:   Now it is much less than 1 ohms. Why does the  Multimeter use different resistors for different   ranges? As said before, the meter measures  the voltage across a resistor. The voltage   meter in the UT71D has a certain sensitivity,  and we want to use its full capabilities.   This is why the instruments switch resistors for  different ranges. Like that, the voltage across   the resistor is always similar. If we select  microamperes, the resistor is 500 ohms, BTW.   So the UT71D has three resistors that are switched  according to the current range, and its maximum   burden voltage is around 2 volts. Quite a lot if  you ask me if we want to measure 3.3 volts MCUs.   And we encounter a second problem if we want to  measure current during deep sleep. Let s change   this sketch and insert a deep sleep statement  in front of the delay(). Like that the sketch   never reaches the delay(5000) statement because  it goes to sleep before. The purpose of the sketch   stays the same, only its power consumption  should be lower. If we use the 10A range,   it shows 13mA during deep sleep. This is what  we expect because the board should only consume   milli- or even microamperes. To get a better  result for these small currents, we should switch   the range. But then the ESP32 crashes as soon  as it tries to reboot. Not acceptable at all.   So: What do we need? A small burden  voltage in a wide current range.   For a low buden voltage we need an amplifier,  and for a wide range we need range switching.   What looked easy in the beginning became quite  complicated. This is precisely what Dave Jones   from EEVblog and Felix Rusu from Low-power labs  were thinking when they built these small devices.   They use much lower resistor values to create  a much smaller burden voltage and include an   amplifier. Both sell around 100 dollars, including  shipping, and both have an output for a voltmeter   or an oscilloscope. The Current Ranger has an  optional OLED display. If you are interested   in how they work, you can watch video #245. Another possibility is to spend 700 dollars and   buy this OTII power analyzer. It is a combination  of a power supply and a low burden voltage   amperemeter. It does not need an oscilloscope to  show the current curves, it has a built-in ADC   and PC software. It is much more comfortable than  the other two, but you have to pay the price.   This is why I was lucky when viewers pointed  me to a new device: The Power Profiler Kit   II from Nordic Semiconductors. It should have  similar specs as the OTII but at a price tag   of a Microcurrent Gold. Nordic is not a  Chinese company, so how does this work?   Here it is. Much smaller than the OTII and  not in a nice metal box. But with a cool look:   They use different colored LEDs to show the  status in this window. Nice. To save cost,   they use simple Dupont wire connectors, which  for sure is not too professional. But it also   comes with software to display the curves. So, let s check it out. Like the OTII,   it can provide up to 5 volts and 1 ampere or  measure current provided by different sources like   a battery. This is ok for most of our projects. We  can use a standard multimeter or a small resistor   and an oscilloscope if we need more current.  Or we buy this even more expensive Joulescope   which goes up to 15 volts and 3 Ampere. What are the typical scenarios? The first one is   the same as before: I insert the ampere meter of  the Power Profiler Kit instead of the multimeter.   I also connect the ground as a reference because  the maximum voltage at all pins is 5 volts.   Here is the cable I created. I can easily insert  this four-pin connector to measure the current   consumption if powered by USB. This setup is  convenient because we still have Serial working.   The setup in the Power Profiler software looks  like that: Select Ampere Meter and enable power   output. Now we see the current consumption of  the device. As expected, heavy peaks and a long   deep-sleep phase. And no brownouts. Very good! The software allows us answer basic questions   like: How much was the average current during  operation? Around 100mA. And during deep sleep?   15mA. So we already see that we have  a problem with deep-sleep consumption.   It is way too high. And we see why the ESP  created brownouts: The peak current was   478mA. Quite a lot! So the maximum burden voltage  with the UT71 was 2 volts in the mA range.   In the following setup, we remove the serial  cable and connect the Power Profiler Kit as   a battery replacement. I also created a cable  for that purpose with a four-pin connector and   a battery connector on the other side. Now we  have to change the software setup to simulate   a battery: We chose source meter and  adjust the output voltage to 3.7 volts.   The current diagram looks similar  as before with one exception:   The current draw during deep-sleep is now 80  microamperes, nearly 200 times less. Very good!   As you see we can get such information  quickly by selecting the area we are   interested in. We can also take a screenshot  or export the data for further investigations.   Did you recognize: The curve includes currents  from 80 microamperes to nearly 500 milliamperes   without brownout. Why is that? The Power Profiler  has five ranges that are automatically adapted   to the current flow. If we look at the  diagram, we see the respective resistors:   1k, 110, 11,1, and 0.05 Ohms. So the maximum  burden voltage in all ranges is around 0.05 volts.   Neglectable for our purpose. The  switching has to be done very fast.   Otherwise, our ESP32 would create a brownout. Unfortunately, I had to remove the USB cable in   this setup, and we do no more see where  the sketch consumes how much energy.   Fortunately, we have these eight input pins. If we  connect them to pins of our ESP32 and toggle them   at specific locations in the sketch, we see where  the current draw starts and ends. Pay attention:   You also have to connect this Vcc to 3.3 volts.  Otherwise, it will not work. And of course,   if you use it for an Arduino, you  have to connect it to 5 volts.   I set the pin to HIGH after setup and to LOW again  after getting the answer from the internet page.   Now we see where the sketch is and can measure  the different times without a Serial connection   and see where the sketch draws which current. I revert to the setup with the USB cable and   insert timestamps at the toggle points for a  check. Now we see that the time for the HTTP   call is very similar. The time for the  setup, however, is quite different. And   here we see the difference: The ESP32 does some  initialization steps before it starts our sketch.   Let s do a last calculation: How long will our  ESP run with a 3000mAh battery using deep sleep?   Because the duration of the HTTP calls differs, I  would like to average ten cycles. Unfortunately,   the maximum range I can display and select  in the highest resolution is only 2 minutes,   only five cycles. If I want a longer  period I have to reduce the sampling rate.   The average power consumption is roughly  52mA. So the battery will last 58h.   Not too much. Finally, we have all the needed  information to start the optimization.   One last question: What about measuring  low currents. All devices mention   that they are able to measure nanoamperes. It is  not easy at all to measure such small currents   and I doubt that a lot of people need this  feature. I connect a 1M resistor to the OTII   as well as to the Power Profiler. You see that  the values are not very stable and that we see   a lot of noise. At 2.5 volts we would expect  2.5 microamperes. The OTII shows an average of   2.4 and the Profiler 2.6 microamperes.  For me, both values are good enough.   My verdict: The Power Profiler II is a handy  tool for the engaged Maker or the IOT developer.   But how does it compare with the other tools? The Micro Current Gold has no automatic range   switching and will create brownouts if  we want to measure deep-sleep current.   So we can only measure either operation or deep  sleep. Not very comfortable. So I would only   buy it for application areas where we do not  have such fluctuating currents. As advantage:   It can also measure negative currents. The Current Ranger has an automatic range   switching, and it also displays average current  on its OLED. So it is usable for our purpose. But   you need an oscilloscope if you are interested in  the curves. Its curves look very similar with one   exception: It does not show the deep-sleep current  correctly. It is much too high. Why is this?   Because its auto-ranging function changes the  measuring range as soon as deep sleep begins. So   this part of the curve is in mA and this one in  nA. There is no indication on the oscilloscope.   So you have to know what you do. In addition, it  is more expensive than the Power Profiler Kit.   Because both of them come without software  support, you have to do your calculations   or use the math functions of your oscilloscope,  which is not everybody s darling.   So the clear winner in the 100 dollar range  is the Power Profiler Kit II. I am pretty sure   that Nordic sponsors this device. After  all, it is not their primary business.   But for us Makers, it is a good deal. Who should spend the money for an OTII?   It can source and measure more current. If this  is needed, the OTII is the right way to go.   Its software is much more elaborated. For  example, you can easily sample 10 cycles or more.   It also can emulate different  battery technologies.   If time is money in a professional environment,  the OTII is a good choice. Also, because it is   big enough that you do not need to search for  it under a pile of things on a messy desk.   For all others, this Power Profiler  Kit is a nice addition to the lab.   Maybe you put it on the list for a Christmas  gift? Not absolutely needed but nice to have.   What do we have to remember? - Measuring the current consumption   of IOT devices is tricky - Burden voltage is the voltage   drop across an ampere meter. It has to be  small if we do not want to crash the devices   - We can reduce the burden voltage by  reducing the measuring resistor value   - Low burden voltage means we need an amplifier - If we deep-sleep our ESP chips,   we have to measure from a few  microamperes to 500 milliamperes.   So we need automatic range switching - The two analog instruments need an oscilloscope   to display current consumption curves - Digital instruments use software   for this purpose - Digital instruments   do all the calculations automatically.  With analog instruments, you have to   use the math functions of your oscilloscope. One last thing: Pay attention to ground loops,   mainly if you use an oscilloscope. All  oscilloscopes are connected to the earth   of your home. Better use batteries  as the power source in this case.   This was all for today. As always, you find  all the relevant links in the description.   I hope this video was useful or  at least interesting for you.   If true, please consider supporting the channel  to secure its future existence. Thank you! Bye
Info
Channel: Andreas Spiess
Views: 35,193
Rating: undefined out of 5
Keywords:
Id: LUB8RWzzLWc
Channel Id: undefined
Length: 17min 35sec (1055 seconds)
Published: Sun Jun 13 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.