najnesnaj / pinetime-zephyr

pinetime smartwatch nrf52 zephyr
Apache License 2.0
105 stars 20 forks source link

Create a module for battery monitoring #9

Closed nordic-krch closed 4 years ago

nordic-krch commented 4 years ago

A module should be able to report battery status in milivolts and charge level in percentage. Additionally, it should notify when external power is connected and when battery is being charged. Module will use adc (saadc peripheral) to measure battery voltage and gpio driver to monitor charge indication pin (pin 0.12) and power presence pin (0.19).

Battery voltage can be in range from 3.0V - 4.2V (?). Unfortunately, internal reference (0.6V) can only be used for voltages up to 3.6V (due to minimal gain of 1/6). VDD/4 reference can be used with 1/6 gain to measure voltages up to 4.95V. Test is needed to check how accurate is VDD as reference.

Discharge curve (https://forum.pine64.org/showthread.php?tid=8147) will be used to calculate charge level in percent.

Things to consider:

nordic-krch commented 4 years ago

i'm looking into it now.