Saying that smartphones have transformed our lives is an understatement. We cannot imagine living a single day without touching it thanks to the battery powering it, well, until the battery percentage is zero.
Fundamentally, battery is an energy storage instrument that converts chemical energy to electrical. Proper maintenance of such a convoluted chemical system for a smartphone, an equally sophisticated system, is a tough job. But, it is already being done!
Battery Management System (BMS): The Battery Percentage Calculator
Most modern day smartphones are equipped with a battery management system (BMS) whose sole purpose is to protect the battery from being destroyed.
Formally, a battery management system is a built-in electronic circuit that monitors and manages battery operations. Depending on the situation, the system performs multiple tasks. However, every task it performs is to negate any plausible damage to the battery and increase its shelf life.
Calculating the battery percentage is one of the most important tasks amongst the long list of numerous functionalities it performs. Moreover, the battery bar is an indication to the user to be cognizant of the battery’s condition.
As mentioned earlier, the chemical reaction within a battery produces the terminal voltage. However, a smartphone is an electronic device depending on a microprocessor that only understands binary language (0s and 1s). So, the key is to connect the two worlds.
There are two crucial elements to connect the two worlds and calculate the battery percentage:
- Measuring the chemical state of the battery
- Converting it to a processor readable file and interpreting the received data using mathematical models
In simple words, the battery management system dynamically reads the battery’s chemical state and converts it to a processor understandable binary file. The processor then acts on the received binary data and maps the it to a human understandable language – the percentage level between 0 and 100. If only the process was as easy these few lines!
The chemistry of a battery constantly changes to supply power. This continuous change in the chemical state is extremely difficult to interpret. In fact, there does not exist a single mathematical model that perfectly describes the battery chemistry.
Hence, all the existing mathematical equations modeling a battery are approximations.
Techniques Used to Determine Battery Percentage
Each of the following techniques are mathematical equations. However, computing processors do not understand mathematical equations.
Therefore, they are first converted into computational algorithms. Computer programs feed the algorithms into the processor controlling the battery management system.
In a smartphone, the central processor controls all operations including the battery management system.
Fuel Gauge and State of Charge (SoC) Calculation
Fuel Gauge is one of the most commonly used techniques. In automobile and aviation industry, the fuel is measured (or gauged) to indicate the amount of fuel left in the tank.
Similarly, the fuel gauging technique determines the state-of-charge (SoC) of the battery. Essentially, the state of charge is the amount of charge remaining in the battery shown in percentage.
A typical fuel gauge system works by measuring the terminal voltage of the battery via various resistive based sensors like thermistors. On receiving the voltage values as binary data, the processor compares them with a pre-defined threshold or a set of reference values depending on the algorithm.
The general rule is that higher the voltage, higher is the state-of-charge (refer Fig 1).
While it looks simple, there’s a big catch! The voltage measurement occurs when the battery is in chemical equilibrium – the major drawback. In other words, you need to wait for a long time until the battery settles down and does not produce any current.
In an over-simplistic description, the chemical reaction within the battery produce these tiny particles called electrons which travel from one electrode to another. This traveling (or flowing) of electrons generates current in a given time.
Hence we arrive at the technical definition of electric current. It is the flow of electrons per unit time (and area) and the electrons are what we call commonly electric charge or simply charge.
By measuring the current flowing in and out of the battery and integrating (a mathematical operation) it over the measurement time, the charge is estimated. Columb is a unit that measures electric charge.
A good analogy to understand the process is to measure the amount of water (in litre) flowing in a pipe in (say) one hour. One way is to count each droplet flowing into the pipe. If it were me, I’d already give up as I could never complete it in my entire life.
On the other hand, what if you could somehow measure the speed with which the water enters and leaves in one hour? This is exactly the principle of columb counter.
Kalman filter is another technique that is much better than both, fuel gauge and columb counter. This technique takes in all possible information from the battery like voltage, temperature and current and uses complex mathematical equations to dynamically determine its chemical state.
This technique is beyond the scope of this article due to its sheer mathematical and computing complexity. Interested readers can read a paper by researchers at Stanford University “State of Charge Estimation Using Extended Kalman Filters for Battery Management System” .
In conclusion, there is no perfect system that works everywhere. Like every individual, every system functions with its advantages and disadvantages in its own unique way.
I hope this article provided insights on how the battery percentage is calculated.
Thank you for your time!