• Limonene@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    12 hours ago

    It’s hard because it’s not a perfect linear relationship between battery voltage and battery percentage. When the battery is 80% full, the voltage hardly changes at all as it drains. But it can change significantly with unrelated factors, like age and temperature. So they have to use the integral of current consumption to calculate the battery level. There are other tricks, too, like using temperature to check battery percentage (when the battery is charging, it heats up if it’s nearly full), and some lithium ion batteries have a third wire for measuring the temperature.