Table of Contents
Introduction
So, you need to measure the current consumption of your low power device? This article will give an overview of doing it using cheap Silicon Labs Gecko development board.
When developing a hardware/firmware for a low power device, which need to work for months or even years on small battery, every μA of current is important. That's why it's very important to profile the current consumption of the device to be able to calculate the expected battery life.
Simplest approach is using the standard multimeter. Most multimeters support measuring μA range and, when the current consumption is stable (for example while the device is in sleep mode) it gives good results. But when the device is transmitting data over some RF link there are many very short but high current peaks which can't be detected with multimeter but which can accumulate over time and render the calculated battery life expectancy virtually useless. Additionally, most multimeters have quite high burden voltage (voltage drop on the multimeter) which affects the functioning of the measured device (check out EEVblog YouTube videos for a bit more in-depth explanation).
Possible solution is by using uCurrent or one of the clones like tinyCurrent which is basically a current shunt + amplifier which translates the current into voltage that can be measured using multimeter or displayed on oscilloscope. It's relatively low cost and works good for catching sharp spikes in current consumption. Note however that the current input minus pole is directly connected to reference (ground) of the output voltage so one should be careful when connecting it to the standard (grounded) oscilloscope and the device is powered from USB/flasher as in that case the uCurrent needs to be connected to the low side of the device. This approach is good for checking out short periods of time (for example power up or data transmission) but can be really cumbersome for recording over longer periods of time (it depends on the used oscilloscope or voltage logger).
There are some excelent power analyzers, for example Otii Arc which is really powerful device for all sorts of power measurement and battery simulations and also a programmable power supply. That power also comes with a price — relatively low cost for professionals who use it all the time but quite expensive for hobbyists or occasional measurement. I was seriously thinking about getting it but in the end decided not to due to the measurement ranges: it has three ranges with different measurement sample rates. +/-19mA range allows for up to 4ksps and the next one is +/-2.7A supporting up to 1ksps. BTW, accuracy of the measurement in the lowest range is great at +/-(0.1u%+50nA). In the higher range it has higher error offset +/-(0.1%+150μA). My issue is that I had to profile LoRaWAN device which consumes up to 30mA during transmit which means I would have to either use lower range and lose the peaks or use higher range and lose precision and sampling rate. Disclaimer: I haven't used Otii device and all of my reasoning is based on the product web page.
Another option is J-Link Ultra+ debugging probe from Segger. It has an option for power profiling with frequency of up to 200kHz and resolution of 50μA. This seems like a good option for dynamic measurement and, additionally, sleep current can be measured with standard multimeter. I haven't tried this but will do as I need to get J-Link probe in the near future.
And then there's an option I'm currently using: Silicon Labs Winder Gecko development board. I got two of these boards in August of 2017 because I had some idea for it (can't even remember what whas it any more) but I never even opened it until a couple of months ago when I tried this. Note: for some reason (maybe because it's an older piece of hardware) the price for this board is currently almost tripled compared to 2017 when I got it for around 30€ from Farnell and it was really affordable option.
Wonder Gecko
EFM32WG-STK3800 is starter kit for SiLabs' EFM32WG MCU which excells in power efficiency. Due to that, the development board has so called Advanced Energy Monitor on board which can precisely measure the current. Basically, it has 4.7Ohm shunt resistor with precise current sense aplifier followed by two low noise precision amplifiers in parallel for two measurement ranges. And the Simplicity Studio IDE has support for current/voltage measurement and logging. And the best thing is that the monitored power bus is routed to the EXP connector. One possible issue is that the measurements include both the MCU and the externally connected device but, by putting the EFM32 into the EM4 (shutoff) mode its current consumption is typically 20nA which in most cases can be ignored. And I stumbled upon all of this by accident on SiLabs' knowledge base while searching for simple power profiling device.
HOWTO
So, to measure the current consumption of an external device the following steps need to be followed:
- get the Wonder Gecko (or any other SiLabs starter kit which includes Advanced Energy Monitor)
- get the Simplicity Studio IDE and install the required updates for the device together with Energy Profiler Addon (can't really remember the steps as it was few months ago)
- flash the onboard MCU with the code to go to the EM4 mode after startup (details below)
- connect the external device to pins 1 (GND) and 2 (VMCU) of the EXP header, start the Energy Profiler and enjoy
For programming the WG MCU I opened the STK3800_emode example (energy modes demo). It allows to select the power mode using the button and after some short timeout it will go into that mode. This example will be OK even unchaged but I edited it to set the EM4 mode as the default after startup (LCD_SelectMode()
function in lcd_setup.c
file has the code for UI initialization).
Voltage control
One thing which is missing from the board is an option to change the supply voltage. Since my device runs on 3V battery, 3.3V from the profiler is nice but doesn't paint the real image. One option is to connect some LDO with low (and known) quiescent current in front of the device. The other option is to do some hacks on the Gecko board. We'll, of course, go with the second option.
Power supply is based on LP3982ILD-ADJ adjustable linear voltage regulator where the output voltage is set with resistor divider from output to SET pin. So, we just need to make one resistor adjustable and we got ourself an power profiler with adjustable voltage.
I decided to put a higher value (1MOhm in this case, as I had that one) potentiometer in parallel to the "upper" resistor (the one between the output and SET pin). This gets a bit tricky as those resistors are 0402 size and all I had was huge plastic potentiometer but I managed to do it and it works! Potentiometer is glued to the battery holder and one of its legs is soldered directly to the resistor and the middle leg is connected to the other pin of the resistor using a piece of wire. In the image below the resistor can hardly be seen between the potentiometer leg and a wire. Tip of the used soldering iron is there for reference :)
TODO
I'd like to design a simple, affordable and open low power profiling device. It would basically be a copy of the current sensing circuitry from Wonder Gecko board together with some ADC and MCU to transfer the measurements via USB in real time. There are features which would be nice to have:
- software controllable output voltage 1-5V
- software controllable series resistance (for battery simulation)
- precise current measurement in μA range
- (optional) logging data to SD card
- open source hardware
I have this idea on hold since I started searching for simple power profiling device and it will surely be on hold for at least few more months due to the other projects I'm currently working on.
EDIT (year 2023.): At the time of writing I wasn't aware of Nordic's PPK2 which is quite amazing although with some limitations (only up to 5V, can only source current). I got it soon after writing this article and it served me great for many projects. However, the idea of developing my own power profiler with some advanced features (up to 15-20V, bidirectional, battery simulation) is still present and might happen in some near future.