system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How does a cell phone determine how much charge is left? My understanding is that batteries output a constant voltage until they are almost depleted, so what does the phone use to measure remaining power?
gpt
Voltage isn't exactly constant.  A cell phone battery might be rated at 3.7 volts, but really it's 3.8V when it's fully charged, and 3.5V when it's empty.  

The phone then has (more or less) a look-up table.  The phone knows that when it's at 3.8V, it's 100% charged.  And when it's at 3.75V it's 80% charged, etc.  This is also why old phones sometimes go from 20% charged to 0% charged almost instantly - because the battery is old and isn't performing according to the lookup table.