

top 200 commentsshow all 237

[–]Krexington_III 61 points62 points  (11 children)

I worked for a summer as a fuel gauging engineer for a major cellphone manufacturer in northern Europe. I was responsible for assessing the fuel gauging algorithm in a new smartphone model.

The battery holds charge - what we want to measure is how much charge it holds, we call this the "state of charge", or SoC for short. This is done in two ways.

We can measure the voltage over the battery's poles, just like /u/Spritetm has described before me. However, once the battery is changing states (whether it's charging or discharging), we suffer from a phenomenon called "hysteresis". Hysteresis is simply the fact that once we've got the battery discharging, if we stop discharging it (say, by turning the phone off), it will keep on discharging by itself for a short while. Like if you are pushing a wagon, then suddenly stop - the wagon keeps rolling. It works the other way for charging - so it doesn't matter if you push or pull the wagon, it will keep going in that direction for a short while after you stop.

What does this mean to us? It means that any voltage measurement done when the battery is charging or discharging will not correspond to the actual SoC - the battery must be "relaxed" for the voltage measurement to work. Relazing a cellphone battery completely can take 24 hours, but a "close enough" result can be had after just 1-3 hours. Typically, voltage measurements are only done on "wake from sleep" or "turn on" - that's why you get weird spikes in your battery usage curves, sometimes they drop sharply or even go up! That's because you've woken the phone from sleep and the fuel gauging algorithm is resetting by making a voltage measurement.

When the phone is running, we thus cannot rely on voltage measurements. Instead, we use a coloumb counter to measure the current from or to the battery - we know how much charge is "leaving" or "entering" the battery. This, however, also carries with it a problem - any measurement on the current will have a small error. Since we make many of these measurements per second, the error will start to accumulate. We call this "drift" or "measurement drift". This is no biggie however - we simply measure the current from/to the battery when the phone is in use, and then calibrate by doing a voltage measurement on wake from sleep or other opportune times.

For electric car batteries and other larger charge carrying arrays, a method known as Kalman filtering (used in control theory) is used - this is a quite advanced method that depends on studying the battery's state of charge by discharging and relaxing it many times (the relaxation may take 24-48 hours, making these measurements tedious and costly), making a curve of the SoC as a function of voltage. Then, a function fitting this curve is created - this function doesn't necessarily have anything to do with real physics, it just needs to fit the curve somewhat and be a function of voltage. We then "predict" where the curve is going to go when we use the battery, and use this made-up prediction to correct our actual measurements. This cannot be done on cell batteries however, because they are highly non-linear in nature.

Maybe this wasn't as though you were 5, but I tried my best! Cheers!

[–]Spritetm 1829 points1830 points x2 (166 children)

You've got multiple methods for that. Let's make an analog here: A battery is like a tank of water, with a faucet at the bottom. You can make the battery 'do work' by opening the faucet and holding e.g. a small water weel underneath it. You can't look into the tank: how do you know how much water is left?

One of the simplest (to implement) methods is by measuring the voltage. In the tank example, you do this by looking at the pressure the water has when you open the faucet. If the tank is full, the water pressure will be bigger than when the tank is empty, and by looking at it, you can guess how much of the tank still is full.

Batteries work the same way, for example an 1.5V battery may be 1.6V when full and 1.1V when almost empty. A digital device will take this voltage and will look up how much power a battery usually has left at that point. That then gets showed to the user.

The other way is to just calculate how much energy the battery has left by measuring how much energy you've already counted. The tank equivalent would be by putting a measuring device that can measure the amount of liters that flow out of the tank. If your tank holds 100 liters at full capacity and the measuring device indicates 50 liters are already used, you know the tank still is half full.

In battery technology, the 'measuring device' that does this is called a coulomb counter, and you can find them e.g. in smartphones. They don't always work as expected (but usually are quite precise): for example, they won't see if energy from a battery disappears in another way. For example, LiIon batteries will lose quite some power from being used at low temperatures, and the coulomb couter doesn't catch that. You can see that because some phones tend to go from half-full to almost completely dead in seconds when they are used in a cold environment

Edit: Wow, I wake up to gold and a full inbox. If this interests you, also read the child comments, people have brought up some interesting facts there.

[–]Xtinguish 18 points19 points  (2 children)

Follow up question, how do those little pressure areas on older AA batteries give a readout on the level??

[–]rod156 3 points4 points  (2 children)

Although some users mentioned that devices use Voltage to measure battery charge, most Lithium Polymer or similar batteries take it further than that.

Instead of relying on solely the Voltage, they measure the difference of mAh over time, usually calibrated at the factory, but can also be calibrated by the user. For example, on a Macbook Pro, the design capacity of a standard battery is 5770mAh. After 6 months it can go down to about 4874mAh.

The battery calculator uses this new number as the top amount of charge. The battery chipset then starts counting the amount of mAh charge left on an even time interval. It extrapolates this data and creates both a percentage number and the remaining time for use.

Most of the time this is reliable, but when the battery is strained more (by playing games or running computing-heavy programs), the extrapolated time is no longer valid (and is recalculated, but it takes time) and the percentage counter falls faster due to the higher loss of mAh. It is however much more accurate than using just voltage since these batteries have an specific ceiling set for full charge and full drop.


Short answer: They don't.

Long answer: They use current meters and complicated algorithms to roughly estimate the remaining charge. Many people think you can find battery charge by simply checking the voltage, but this isn't usually the case. Modern batteries are designed to keep a nearly constant voltage throughout their entire use. It's only when they're nearly dead does the voltage then begin to significantly drop, and even then it varies based on the load.

[–]jeffesaurusrex 5 points6 points  (5 children)

In most devices it measures the voltage. If the device knows that it's battery is full at 8.40 volts (100%) and is drained past it's usability at 7.40 volts (0%), then it can tell you how much battery you have left at any given level. For example using that scale, 7.90 volts would be 50% battery left.

Some devices, like computers and some phones adjust your battery life based on usage trends. For example, if you are watching videos with the brightness all the way up you might have 10% battery left but if you turn the brightness down and stop watching videos, it might raise to 20%.

[–]JoeFloppy 0 points1 point  (0 children)

They measure the voltage. As a battery discharges, the voltage it can put out under a certain load goes down. The battery is still producing enough voltage to power the device but the internal circuit detects the voltage drop and calculates the percent of remaining time that the battery can sustain the device under the current power draw. A battery produces voltage via a chemical reaction where electrons are attracted to the negative terminal inside the battery. The electrons are taken from the metal strips attached to the positive terminal. This leaves a "hole", or an atom that is missing an electron in its orbit. The electrons (-) are very attracted to the "holes" left behind and will always take the path of least resistance to "fill the hole". Once a circuit is attached, the electrons flow towards the positive terminal. This flow of electrons is called current. Since the circuitry is not a perfect conductor, not all the electrons can go to the positive terminal at one time. This restriction of flow is called resistance.
Because of the resistance to the flow of electrons, the battery can store enough electrons to power the device for a certain amount of time. The internal circuit in the device is calibrated to calculate the amount of battery life in percentage.

[–]sigitasp 2 points3 points  (0 children)

It's ELI5, so electric charge in a battery is just like an inflated air balloon. You could for example make the windmill rotate by letting the air form the balloon. Gradually the balloon will deflate, also the "wind" from the balloon will get weaker and the pressure inside the balloon will decrease. By measuring the pressure in the balloon (or voltage of a battery) you can get the idea how much air is still in the balloon (without looking at the balloon).

[–]CHollman82 1 point2 points  (0 children)

I'm a software engineer and I actually implement this feature in our products. Essentially I read the output of an analog to digital converter, which takes an analog voltage reading and turns it into a digital value that the processor reads. From there I have to map the reading to a calibrated curve, since batteries do not discharge linearly, to convert the ADC value to a percentage and then I use the percentage to draw the battery indicator to the screen properly.

[–]Stiggalicious 1 point2 points  (0 children)

In addition to other good answers others have already posted, here is an example that shows how different temperatures affect battery voltage and discharge.

The effect is even greater when the battery is discharged faster. Combined with the lower voltage and lower capacity, overall energy delivered by the battery can be less than half when cold.

[–]eachwishresigned 0 points1 point  (0 children)

By the way, "coulomb counter" is just a fancy term for an integrating ADC. The ones found in fuel gauges can vary between 12 to 16-bits and use a variety of fancy techniques to achieve low noise measurement which is especially critical given that we want to minimize accumulated coulomb counting error, which essentially translates to undesired error in state-of-charge estimation. As stated in a few posts here, the best fuel gauging algorithms tend to combine coulomb counting with periodic open-circuit voltage vs state-of-charge lookup tables to best exploit the merits of each method and offer the most accurate state-of-charge estimation/remaining capacity prediction. Keep in mind, such lookup tables are chemistry dependent and work best when applied to an exact chemistry match. There are subtle differences in the chemical formulas used by a wide range of cell-makers in constructing the cell cathode that result in changes to the OCV vs SOC characteristics of said cell. The industry tends to use blanket statements when referring to all cells as Li-ion, but these are more accurately described as LiCoO2, LiMn2O4, LiFePO4, or other up-and-coming formulations. Conversely, in most cases the anode construction tends to employ graphite but there are ongoing developments to introduce unique materials there as well. Overall, the holy grail is to strive for maximum energy density, decreased aging effects over cycling, minimal self-discharge, and uncompromising safety. This industry is continually intriguing and offers a compelling set of challenges. Every workday is unique. :)

Source: Years of experience in fuel gauging and batteries.

[–]symsymsym 2 points3 points  (3 children)

A battery contains two things: Electric Charge and Potential Energy. The fullness or emptiness of the battery is expressed in Volt. When a battery is full it contains the greatest amount of Potential Energy and its Volt will be highest. As the battery is drained the Volt will drop because the battery has lost Potential Energy.

An battery will stop producing energy below a certain Voltage, usually about half way. The phone knows what that Voltage is - as it knows what the maximum Voltage is.

[–]SlouchPounder 1 point2 points  (0 children)

To break this down as simple as possible picture the battery as a gas tank. There is a meter which is measuring the amount of gas left in the tank, or in this case, voltage left in the battery. As the gas, or voltage, gets lower in the tank the indicator will get closer and closer to empty..

[–]Death-By_Snu-Snu 0 points1 point  (1 child)

The simple answer is that as a battery dies, the voltage goes down. Digital devices (or battery checkers) measure the voltage of the battery. When it hits a certain point (usually the rated voltage) they usually shut down to prevent damage to the battery (in the case of Lithium-Ion batteries especially - if they drop below a certain voltage (I believe it's 3.6v) they will not accept a charge again)

[–]lmorsino 1 point2 points  (0 children)

As a battery discharges, its voltage decreases. Digital logic is able to measure that voltage and approximate the remaining energy based on how much power the device consumes.

[–]eydryan 1 point2 points  (0 children)

Voltage and temperature.

[–]Biglar10 1 point2 points  (0 children)

My iPhone must suck at measuring voltage. Turns off at around 15-20% reported battery life...

[–]galaxyandspace 0 points1 point  (0 children)

As a nexus 4 owner: sometimes your device has no clue. Most devices don't have this problem though.

[–]LIL_BIRKI 0 points1 point  (0 children)

Thanks for the help. I really do hope that your a scientist because you sound as smart as one

[–]kouhoutek 0 points1 point  (0 children)

Voltage a battery puts out drops as the battery is discharged, and drops particularly quickly when it is almost out of energy.