Remaining Battery Life

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
project_science
 
Posts: 190
Joined: Sun May 04, 2014 1:26 pm

Remaining Battery Life

Post by project_science »

Hi,

I'm looking to do two things with a LiPo battery:

1. Find out what the remaining battery life of it is

I thought I once read that the Arduino is capable of using a voltage divider with Vin / gnd to monitor battery life (up to some amount). Is this possible with the Arduino, Trinket, and / or Feather somehow, either with a voltage divider, or some function?

2. Find out what the average current draw over my circuit is

Is there some way to monitor what the current draw is over some time scale?

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Remaining Battery Life

Post by adafruit_support_mike »

The circuit that meets both requirements is called a 'Coulomb counter'.

The fundamental unit of stuff in electronics is charge (usually electrons). Voltage is the energy that makes charge move from one place to another, and current is the amount of charge that actually does go from one place to another. The unit of charge is the Coulomb, which is roughly 6.2e18 electrons. 1 Volt is one Joule of energy per Coulomb of charge, and 1 Ampere of current is a transfer rate of 1 Coulomb of charge per second.

Batteries store energy, and it's generally easiest to measure that energy as Coulombs of charge the battery can pump up to a given voltage. When you measure current for a given amount of time, you're finding the number of Coulombs that passed through the circuit in that amount of time.

That's what a Coulomb counter does: it measures the current passing through a circuit and keeps track of the time. From there, it can calculate the amount of charge that has come out of the battery so far. The most convenient units for that are milliamp-hours (1mAh is the amount of charge that flows through a 1mA load in 1 hour), and that's how battery storage capacity is measured.

The pieces you need are a current sensor and a reasonably accurate clock.

You can use an INA169 analog current sensor and read it with a microcontroller's ADC every so often:

https://www.adafruit.com/product/1164

or you can use the INA219, which has a built-in ADC and calculates the current for you:

https://www.adafruit.com/product/904

We also have real-time clocks if the system you're working with doesn't have a reliable clock of its own.

User avatar
project_science
 
Posts: 190
Joined: Sun May 04, 2014 1:26 pm

Re: Remaining Battery Life

Post by project_science »

Hi,

I was looking at this board specifically for my portable project: https://www.adafruit.com/product/2771

There's a line which says,
We also tied the battery thru a divider to an analog pin, so you can measure and monitor the battery voltage to detect when you need a recharge.
So for this, would this board be accurate enough to tell me what the remaining voltage is? (I realize this wouldn't give me current draw info., however.)

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: Remaining Battery Life

Post by adafruit_support_bill »

It can tell you what voltage the battery is delivering at the moment. But that is not necessarily a good indication of the charge level of your battery. The voltage depends on the discharge rate as well as the charge level. At higher discharge rates, the battery voltage will drop. So, you really need to monitor current and time to measure the charge flowing into or out from the cell.

If you don't want to do the measurements and calculations yourself, there are 'fuel gauge' chips that can do that for you. I believe that SparkFun has a breakout board for one of them.

User avatar
adafruit_support_bill
 
Posts: 88096
Joined: Sat Feb 07, 2009 10:11 am

Re: Remaining Battery Life

Post by adafruit_support_bill »

This is a somewhat extreme example to illustrate the point:

Discharging at a 7C rate, this cell voltage does not drop below 3.5v until it is down to about 5% capacity. But when discharging at a 40C rate, the voltage drops to the same voltage while still around 90% capacity.
Image

User avatar
devinganger
 
Posts: 72
Joined: Tue Aug 09, 2016 1:09 am

Re: Remaining Battery Life

Post by devinganger »

adafruit_support_mike wrote:Voltage is the energy that makes charge move from one place to another, and current is the amount of charge that actually does go from one place to another.
BTW, I just wanted to say I think this is the most concise, useful distinction between voltage and current I have ever seen.

User avatar
project_science
 
Posts: 190
Joined: Sun May 04, 2014 1:26 pm

Re: Remaining Battery Life

Post by project_science »

adafruit_support_bill wrote:This is a somewhat extreme example to illustrate the point:

Discharging at a 7C rate, this cell voltage does not drop below 3.5v until it is down to about 5% capacity. But when discharging at a 40C rate, the voltage drops to the same voltage while still around 90% capacity.
Image
This helps, thank you!

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Remaining Battery Life

Post by adafruit_support_mike »

devinganger wrote:BTW, I just wanted to say I think this is the most concise, useful distinction between voltage and current I have ever seen.
Thank you.. I've spent a couple of years banging that down from a few thousand words to a couple of sentences.

Now I can say I understand them in Einstein/Feynman terms. ;-)

User avatar
project_science
 
Posts: 190
Joined: Sun May 04, 2014 1:26 pm

Re: Remaining Battery Life

Post by project_science »

Ok, this is great stuff!

I'd now like to modify this project in so you know how much remaining battery life there is until you need to recharge? https://learn.adafruit.com/micropython-oled-watch

If I needed either https://www.adafruit.com/product/904 or https://www.adafruit.com/product/1164, which would you recommend for this project? I'm trying to compact it as much as possible.

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Remaining Battery Life

Post by adafruit_support_mike »

The INA169 would probably be the easiest to add in terms of code. It's an analog sensor, so you can connect it to one of the Feather's analog pins, take a reading once per second, and use that to estimate the current in milliamps.

One second of current at one milliamp is one millicoulomb, so you can just keep a running sum of the current measurements to estimate how much current you've pulled from the battery.

User avatar
project_science
 
Posts: 190
Joined: Sun May 04, 2014 1:26 pm

Re: Remaining Battery Life

Post by project_science »

Ok, that sounds good enough. So then I have to ask the reverse:

The feather has a battery charging port built into it I believe (so I don't have to disconnect the LiPo while charging it). How do I know when the battery is done charging?

Is there a method to write code to see when that battery is full, or when "x" amount of charge has been added to the battery...or something like that (e.g. 97%...98%...99%...100% "Done Charging)"?

User avatar
adafruit_support_mike
 
Posts: 67454
Joined: Thu Feb 11, 2010 2:51 pm

Re: Remaining Battery Life

Post by adafruit_support_mike »

The Feather does have a built-in LiPo charger, and measuring the battery voltage isn't helpful for detecting end-of-charge for a LiPo.

The LiPo charging process has two phases: constant-current and constant-voltage. The constant-current phase takes the LiPo up to full-charge voltage, which is 4.2v for the LiPos we carry. At that point, the lithium polymer directly in contact with the battery's anode and cathode is fully charged, but the polymer farther between the plates isn't. If you disconnect the charger as soon as the LiPo voltage hits 4.2v, the voltage will sag to about 3.8v over the next few hours as charge diffuses evenly through the polymer.

The constant-voltage phase keeps the polymer touching the anode and cathode at full charge during that diffusion process. The charger holds the voltage at 4.2v and tapers off the current until it falls to 5% of the constant-current rate, at which point the LiPo is considered fully charged.

As a rule of thumb, the constant-current phase charges a LiPo to about 80% of its storage capacity, and the constant-voltage phase handles the remaining 20%.

If you have a current monitor on the LiPo, that's the ideal tool for detecting end-of charge: just wait until the current flowing to the LiPo stops.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”