Monday, February 18, 2019

CAP Water Fountain Measuring Ultra Low Current

Almost missed this

I was idly staring at the board and noticed this LED lit up very faintly. It probably affected my last battery test which demonstrated the setup could stay alive in standby for a month. This may mean the setup could have lasted longer. Either way the ultimate test is to measure, somehow, the actual current the whole thing actually consumes.
Faint LED, means my controller code needs a bit of tweaking.

Multimeter

I realized after going through all the gymnastics below, my multimeter was equipped to measure uA. 

Counting Coulombs

Looking around for a u-Ammeter, or some way to make an ultra-low current measurement, I was ultimately directed towards a Coulomb counter. Amplifiers for measuring ultra-low current were somewhat unavailable, and while there are schematics freely available to build these circuits, I didn't want to. I needed something a bit more off-the-shelf. Coulomb counters have become prevalent with IoT, as devices need a way to measure how much charge is actually left in their batteries. Basically the coulomb counter is an integrating current measurement device. As current flows across a shunt resistor, it creates a very small voltage which is amplified, and integrated. As the integrated current adds up, the coulomb counter outputs a pulse for each unit of charge it detects. The average current the counter is measuring is directly related to the time between these pulses. 

LTC 4150

Sparkfun makes an LTC 4150 breakout board, and they have a really nice hookup guide for it. So I got one of those and wired it up. I should see a pulse every 10-30 minutes if the circuit isn't hiding any other leaks. The hookup guide gives two ways to use this board, polling or interrupt. If you poll, they recommend you wire it up so you clear the "INT" pin, with the "CLR" pin. Otherwise you have to catch a very narrow pulse, polling, and that's tough. Also, polling isn't hardcore enough, so I left the solder blob. I could have set up another uC to do this, but I have a perfectly functional scope and logic analyzer, so I opted to use it to bag the pulse.



O-Scope API

When I went shopping for a new o-scope I knew I wanted a USB device. The Analog Discovery 2 had good specifications, a solid GUI, and promised a functional API. The idea of being able to use python to run my scope and acquisitions sounded awesome! Plus it had a built in logic analyzer. Sold.


A bit of hunting and I found the scope API in python. Works great! After some tweaking with the scope GUI I opened my python toolkit, conda, pip, ipython and finally jupyter notebook. Using jupyter notebook was really convenient. I separated the code so cells for opening, closing and configuring the input could be run separately from the code for actually measuring the current. Also I can make a few notes to myself for how to actually operate the thing. I might never go back to using the scope GUI!

Conclusions

I can clearly see an average consumption of up to 78mA while the controller is awake. In standby the consumption drops to 2.3mA average. Wow! Not bad, but not as great as I expected. Something somewhere is leaking... Next I'll start isolating the leak by removing elements of the controller.

No comments:

Post a Comment