### How does my phone know how much battery is left?

Most electronic devices use a power regulator to create a fixed output voltage that can be depended on to be consistent, even when the input voltage changes. In most cases the input voltage needs to be at least a little higher than the output voltage for the converter to function, although there are boost converter circuits that can take a lower voltage and boost it to a higher one, by drawing more current.

A typical cell phone battery outputs 3.7V or 4.2V depending on the chemistry, and a typical cell phone circuit requires 3.3V or 2.5V or 1.8V or 1.2V depending on the chip. The regulator will take the battery voltage, which will vary as it gets depleted, and produce the constant fixed voltages of 3.3V, 2.5V, 1.8V, 1.2V as needed. If the battery level falls below the point that the regulator can function, then the phone shuts off. The chips simply won't operate if the exact correct voltage isn't applied.

You can think of it like a pressure regulator for an air compressor. You can connect a pressure regulator to an air tank and dial it down to 50 psi. If the tank has 100 psi, the regulator outputs 50 psi. If the tank drops to 70 psi, the regulator still outputs 50 psi. If the tank drops to 50 psi the regulator will still output 50 psi, but below that, the regulator output will fall with the tank. 40-40, 20-20, 0-0.