# How to read the battery level of a Pytrack/Pysens

• I am trying to read the battery level (between 0 and 100%) of the LiPo battery connected to my pytrack/Pysens trough the Jst connector. I didn't find how to do it. I managed to read the battery voltage but not its level (remaining charge).
Can anyone help me put with that?

• @robert-hh ah ok, thank you for explaining. so I set it to 3.28 V and I am on the safe side ;) thanks

• @svonbentzel That depends. For the ESP32, the lowest recommended Vcc is 2.3 V. For the voltage regulator, it's 3.0V, for the SX127x of the Lopy's and SiPy it's 1.8 V, for the LTE chip I did not find a data sheet.
So, it's 3V

• @robert-hh

Hello Robert,

Can you tell me the minimum voltage the pycom runs „safe“?? 3.3 Volt or 3.2 Volt?

Actually I measure voltage and if battery voltage unter 3.3 I shut down the board.

• @Gaby Hi
I'm using a Max17043 to read the State of Charge of a LiPo (https://datasheets.maximintegrated.com/en/ds/MAX17043-MAX17044.pdf)
It uses I2C to get the state. Even wrote a library for it (https://github.com/andrethemac/max17043.py).
André

• @jcaron Please note these curves are drawn for 5C (= 5 times rated capacity in chargecurrent) steps.
If your application draws less current (say below 1C) you can expect that the dependency of voltage with dischargging current is also less pronounced.
But anyhow it remains battery and temperature dependent. For discharge currents below 1C the effect of temperature might be more visible than of the discharge current.

• @gaby It's a complex question. The voltage is a function of the remaining charge, but also how much current you are drawing.

All things being equal, the voltage will vary following a curve which starts but dropping relatively quickly, then remain pretty stable for quite a while, then drops again quickly when the battery is becoming empty. However, the exact curve will vary will the load, and if of course you have a variable load, this can be quite messy.

Here's an example of the curves for various discharge rates for a type of battery:

The curve can also vary with temperature and probably a few other things.

If your load and environment is quite stable, you can monitor a battery while it discharges, and then use previous data points to find an estimate of the current charge level, but we aware that it can be quite approximate, especially when you are in the "flat" part in the middle.

• @robert-hh Thank you for replying! I am a computer scientist, not an electrical engineer so this could be a stupid question but, are there a relation between the battery voltage and the remaining charge? is it possible to calculate the remaining charge of the battery using the current voltage?

• @gaby actually not. Witz the XxPy, you can only read the voltage, tust allows only a rough estimate on the charge level of a typical battery. The best you can get is a warning, if the battery is almost empty, by montoring the voltage change. If it starts to decrease fast after bring almost constant for a while, then the battery is almost empy.
And you have to determine the critical levels by testing.