They measure the voltage generally, and just use the voltage difference between a dead battery and a fully charged one and use that value as the amount of charge the battery can hold. Then when you have that, and you know how much power the battery loses when in use, you can then figure out the battery charge.
As batteries charge and drain, their voltage changes. The change is pretty small compared to their overall voltage, but it is measurable. A computer then compres the voltage to a chart like [this](https://www.powertechsystems.eu/wp-content/uploads/sites/6/2018/11/LiFePO4-vs-Lead-Acid-Discharge-Curve-EN-300×173.png) one to determine the charge.
Inside the Battery, the voltage is determined by the relative amount of charge on the 2 terminals and the capacitance between the terminals. So, the amount of charge is related to 2 different factors, how fast the charge is going out, which can be measured by current in the circuit, and how fast the charge is chemically being replaced by the battery reactions. Since you know the voltage and current, you can estimate how quickly the charge is being replaced by the batteries electrochemical reactions, so you have a good idea of how chemically “alive” the battery is.
Latest Answers