LowPowerLab Forum

Hardware support => CurrentRanger => Topic started by: MrSurly on January 10, 2019, 11:08:34 AM

Title: Coulomb counting?
Post by: MrSurly on January 10, 2019, 11:08:34 AM
I have a need to asses overall battery life.  It seems the CR will log data approximately every 1 second, though I suspect that internally it's sampling much more than that. 

Title: Re: Coulomb counting?
Post by: Felix on January 10, 2019, 12:35:33 PM
It can sample and log much faster than 1 time per second.
By default it does it 5 times a second, for a human to looks at that is more than plenty:
Code: [Select]
#define BT_REFRESH_INTERVAL 200 //ms

It does no averaging for serial output, it only outputs the latest available reading.

The BT header serial can output very high bauds.
The baud rate depends on the BT module you use, or the receiver on the other end. The sketch default is 230Kbaud.
Code: [Select]
#define SERIALBAUD 230400      //Serial baud for HC-06 bluetooth output

See the firmware for details: https://lowpowerlab.com/guide/currentranger/programming-firmware-updates/
The log rate is determined by this parameter:

For proper use of external connected devices, please read the guide, you have to make sure whatever you connect to this header is not the same ground as the output negative terminal, that is why I suggest BT since it's wireless and has no shared GND with anything else. This is important if you measure current on any mains powered device, if it's a battery powered device, then you can even connect another arduino to read the serial from the BT header. Or if you have a laptop (running on battery, not plugged into mains), then that can also easily read the serial from the CurrentRanger USB port which outputs serial at USB speed.

And BTW - you can format the data in whatever way you want, the firmware is yours to modify in whatever way suits your needs.
Title: Re: Coulomb counting?
Post by: Felix on January 10, 2019, 12:37:21 PM
And for coulomb counting - there are dedicated chips for something like that.

But you could do integration of the current readings over time in the firmware and output it to serial, and I think the results should be very accurate (as accurate as the ADC and its calibration).
Title: Re: Coulomb counting?
Post by: MrSurly on January 10, 2019, 02:30:17 PM
Yes, I'm aware of the grounding issue -- I read the entire guide.

And for coulomb counting - there are dedicated chips for something like that.

But you could do integration of the current readings over time in the firmware and output it to serial, and I think the results should be very accurate (as accurate as the ADC and its calibration).

The coulomb counting ICs do give a total, but don't really show where you can improve, hence my desire for more detailed graphing and integration of total current/coulombs.

I had a project where the internal pullups of the MCU were adding excessive current -- turning this off and using a different external pullup helped power usage by a factor of 10.  I used the Nordic current measuring board for that, but it has poor desktop software.  Was looking for something easier to use.
Title: Re: Coulomb counting?
Post by: Felix on January 10, 2019, 05:59:29 PM
Below is a screenshot of the Serial Monitor receiving data from a CurrentRanger, monitoring a Pi booting up, something like this good enough?
This is from on the CurrentRanger guide BT page (https://lowpowerlab.com/guide/currentranger/bluetooth-data-logging/).
Logged at 5hz, you can increase that of course, fiddle with the ADC sampling/averaging, make it as fast as you want.

(https://lowpowerlab.com/wp-content/uploads/2018/09/Pi_Boot.png)