2023-06-07 3:21 AM
I am using STM32F446RE for my application to just log the time accurately. I have an RTC module DS3231SN[1] connected to the STM32 on the I2C. The RTC is connected to a coin cell battery CR2032[2] for a long life on its VBAT terminal. The entire board by itself is powered with an external 5V. However, the device is expected to last for 10 years and the device is powered on roughly for 2000h.
I can read the battery voltage from the VBAT pin on the STM32. Is the voltage read a linear relation with the battery capacity? Circuit[4]
[1]: https://www.mouser.de/datasheet/2/609/DS3231-3122489.pdf
2023-06-07 8:11 AM
Voltage and capacity remaining are not linear. Look up "CR2032 discharge curve" to get an idea.
https://components101.com/sites/default/files/inline-images/CR2032-Discharge-Time.png
You could track total battery on-time, but measuring the voltage and correlating that to the curve is how battery life remaining is typically done. Temperature plays a big effect.