LowPowerLab Forum

Hardware support => General topics => Topic started by: perky on October 08, 2016, 02:42:17 PM

Title: Current logger for battery systems
Post by: perky on October 08, 2016, 02:42:17 PM
Does anyone know of a low cost piece of test equipment that can log or give an indication of average current consumption for battery operated equipment? I'd like to measure the current of my radio system and average it over a long period of time (maybe a week), so it would need to read uA and mA current and log it dynamically down to ms resolutions.
Mark.
Title: Re: Current logger for battery systems
Post by: WhiteHare on October 08, 2016, 03:06:49 PM
A few ideas, but it depends on what resolution uA you need. 

1.  Maybe try an ADC in combination with Dave Jone's Microcurrent instrument?  If it were me, I'd opt for this.

2.  Alternatively, there may (?) be a newer version of the INA219 that you could leverage.  I found the INA219 to be good for capturing milliamps, and it seemed reasonably accurate.  Also, the INA219 is readily available on breakout boards for connection to arduino (and adafruit has a library for it).  IIRC, it may only be good down to 800uA resolution though.  But if there's something newer, it might have better resolution than that.  I don't recollect the refresh rate, but I suspect it may be longer than 1ms.

3.  Maybe simply a high resolution ADC in combination with a sense resistor?  Noise will be your enemy, but maybe there's a way to filter that.

4.  If you had a big enough capacitor, you could charage it up and run off that to count coulombs.  You'd need to then subtract the charge that would have been lost due to leakage.  One of the other forum members here (Emjay) once suggested that method.  This would allow you to derive the average current consumption that you're apparently interested in.
Title: Re: Current logger for battery systems
Post by: perky on October 08, 2016, 03:25:19 PM
Thanks. I'm edging toward coulomb counters (e.g. something like SiLabs TS1108) if they have the resolution. My controller takes about 5uA when asleep and the radio 45mA when transmitting, but there are also a couple of boost regulators which are turned on and off when needed. Ideal would be an off the shelf piece of test gear (or eval board).
Title: Re: Current logger for battery systems
Post by: WhiteHare on October 08, 2016, 03:42:40 PM
Yeah, unfortunately, out of the box the Dave Jones Microcurrent would have trouble handling that wide a range.    You could set it to uA *or* to mA, but it can't span both by itself. 

Please do let us know what you come up with, because I'm sure it's something most of us would want to do also.
Title: Re: Current logger for battery systems
Post by: perky on October 08, 2016, 04:06:51 PM
This thread on the EEVBlog forum has some interesting stuff, especially the EFM32 Zero Gecko Starter Kit circuit. They use the LTC6102 zero drift precision current monitor and two precision opamps on its output to give a wide output range. It should be relatively easy to use an MCU measuring those voltages and integrating over time to provide a coulomb counter. Pity I've no time to do it but would make a useful piece of test gear.

http://www.eevblog.com/forum/testgear/measuring-current-on-a-low-power-iot-device/
Title: Re: Current logger for battery systems
Post by: WhiteHare on October 08, 2016, 05:37:25 PM
One of the yzxstudio usb mah meter devices leverages a chip that's impressive that you could possibly use.  One of Julien Illett's youtube videos (possibly this one:
  https://www.youtube.com/watch?v=jYfzGoLxR4M

or if not, then one of his other ones) goes over it. I don't remember if it matches your requirements, but it's possibly worth a look.
Title: Re: Current logger for battery systems
Post by: perky on October 08, 2016, 06:41:31 PM
They're designed for USB so not accurate enough I think, the resolution is pretty poor and we need measurement down microamp levels.

Here's a Sparkfun coulomb counter based on a LTC4150, they have used a 50mR sense resistor so it gives a pulse on INT# every 170.7uAh for a max current of 1A. No reason I can see not to increase the sense resistance to say 0.25R, that would allow 200mA max current with a pulse every 34.1uAh. You'd need to measure the time between them to measure average current, just divide 34.1 by the time in hours between the pulses to give average current in uA.

https://learn.sparkfun.com/tutorials/ltc4150-coulomb-counter-hookup-guide

Mark.
Title: Re: Current logger for battery systems
Post by: WhiteHare on October 08, 2016, 07:25:11 PM
Quote from: perky on October 08, 2016, 06:41:31 PM
They're designed for USB so not accurate enough I think, the resolution is pretty poor and we need measurement down microamp levels.

Here's a Sparkfun coulomb counter based on a LTC4150, they have used a 50mR sense resistor so it gives a pulse on INT# every 170.7uAh for a max current of 1A. No reason I can see not to increase the sense resistance to say 0.25R, that would allow 200mA max current with a pulse every 34.1uAh. You'd need to measure the time between them to measure average current, just divide 34.1 by the time in hours between the pulses to give average current in uA.

https://learn.sparkfun.com/tutorials/ltc4150-coulomb-counter-hookup-guide

Mark.

I seem to recall that the sparkfun coulomb counter was done in a weird way.  Namely, it counts the coulombs that are used to power the instrument in addition to the current under test.  If that instrument current is constant (don't know if it is), then maybe that's easy to subtract out.  If not, then it might pollute the accuracy of what you're after.  Anyhow, perhaps worth looking into before you order one.
Title: Re: Current logger for battery systems
Post by: perky on October 08, 2016, 08:42:40 PM
Mmm. Here's the schematic:
https://cdn.sparkfun.com/datasheets/BreakoutBoards/LTC4150_BOB_v10.pdf

As you can see, it's bidirectional. So if you connected the power source to JP3 and connected the UUT to JP2 you should only read the UUT's current. I think the problem you're thinking of might be that they seem to have labelled IN and OUT round the wrong way (in fact OUT, i.e. JP3, is connected to SENSE+ which would normally be connected to the power source to get a positive reading). If someone does connect the power source to JP2 and the UUT to JP3 to follow the IN and OUT labels then you're right, it would measure the instrument's power as well as the UUT's power.

Mark.
Edit: This appears to be designed for larger systems and to have the coulomb counter permanently installed in that system, in which case you would want to read the total charge used, but by reversing the connections as above you can use it to measure lower powered systems. I may well buy one of these and bodge it onto an existing MCU board that has an FTDI header so it can dump out the accululated uAh and use the whole thing as a bench tester.
Title: Re: Current logger for battery systems
Post by: WhiteHare on October 09, 2016, 02:06:10 PM
Sounds promising.  It's only accurate to the most recent interrupt, but if you're averaging over a week, that shouldn't matter.

Any particular reason why you're measuring over such a lengthy period of time?
Title: Re: Current logger for battery systems
Post by: perky on October 09, 2016, 05:21:41 PM
Only that there are daily things it does as well, a week would give a good indication but that may be OTT.
Mark.
Title: Re: Current logger for battery systems
Post by: WhiteHare on November 03, 2016, 03:49:26 PM
@perky
Did you have a chance to try it out?  How did it go?
Title: Re: Current logger for battery systems
Post by: perky on November 03, 2016, 04:11:16 PM
Not yet, I'm going to do so within the next few weeks, I've got one of those Sparkfun coulomb counters from eBay to mess with now. My project is going into a trial period soon and calculated battery life is 2.4 years, but I'd like a true current measurement to check my calcs aren't way off.
Mark.
Title: Re: Current logger for battery systems
Post by: WhiteHare on November 05, 2016, 08:58:20 PM
@perky
Cool.  I followed your lead and ordered one from Aliexpress on the hope that it will prove useful someday.
Title: Re: Current logger for battery systems
Post by: WhiteHare on December 31, 2016, 02:13:46 PM
In my case, I'm wanting to measure the amount of coulombs produced by a very small solar cell.  So, it can't be used to power the LTC4150.  However, looking at the PCB:
(https://cdn.sparkfun.com/assets/learn_tutorials/2/2/5/cc_top2.jpg)
it looks as though I can cut the trace between the 4.7uF capacitor and OUT+, then solder a wire wire to the capacitor pad to power the LTC4150 independent of voltages on IN and OUT.  Then I'll just connect the solar cell to IN, and it should do the coulomb counting.  So, that's what I plan to do.  I hope it works.
Title: Re: Current logger for battery systems
Post by: perky on December 31, 2016, 04:49:22 PM
Quote from: WhiteHare on December 31, 2016, 02:13:46 PM
it looks as though I can cut the trace between the 4.7uF capacitor and OUT+, then solder a wire wire to the capacitor pad to power the LTC4150 independent of voltages on IN and OUT.  Then I'll just connect the solar cell to IN, and it should do the coulomb counting.  So, that's what I plan to do.  I hope it works.

Note the common mode sense spec for the LTC4150, it's VDD +/- 60mV. So this is going to be tricky if you use a separate supply.
Mark.

Edit: You might be able to fudge it, you'd probably need an opamp powered by your other supply set to generate the same voltage as OUT (see above post for why OUT not IN), and use the output of that as your power source.
Title: Re: Current logger for battery systems
Post by: WhiteHare on January 01, 2017, 07:55:35 AM
Thanks, Perky!  I think I'll hold off on this and try one of the easier methods first.

Happy 2017.
Title: Re: Current logger for battery systems
Post by: WhiteHare on January 07, 2017, 02:06:00 AM
Quote from: perky on December 31, 2016, 04:49:22 PM
Edit: You might be able to fudge it, you'd probably need an opamp powered by your other supply set to generate the same voltage as OUT (see above post for why OUT not IN), and use the output of that as your power source.

Do you think that an MCP6S21 would do the business for what you have in mind? (http://www.digikey.com/product-detail/en/microchip-technology/MCP6S21-I-P/MCP6S21-I-P-ND/562453)
Starting yesterday I started to use an MCP6S22 to better measure the self discharge rate on a capacitor without having the act of measurement itself drain the capacitor excessively.  While doing so it occurred to me that the same chip might (?)  fit the bill for what you had in mind.  In essence, the chip has a high impedance input pin, and then on an output pin it creates the same voltage, but sourced from a different power supply.  In the case of measuring the capacitor voltage, I attach my oscilloscope probe to the output pin of the chip, and as a result there's much less impact on the voltage of the capacitor under test than if I were to hook the oscilloscope probe directly to the capacitor.
Title: Re: Current logger for battery systems
Post by: perky on January 07, 2017, 09:08:56 AM
OTT I think. You just need a low input impedance unity gain opamp configured as a buffer, you don't need SPI or programmable gain.
Mark.
Title: Re: Current logger for battery systems
Post by: WhiteHare on January 07, 2017, 10:51:59 AM
It defaults to 1x gain on Channel 0, so I haven't actually been using the SPI or programmability aspects.
Title: Re: Current logger for battery systems
Post by: perky on January 07, 2017, 12:20:02 PM
Ah, OK. In that case it may well do the job ;)