Get battery voltage
The Picoclick-C3 comes with an optimized battery monitoring feature which won't consume any power while not in use. For comparison: the C3T needs about 3µA of current even if the Picoclick is not in active state.
To read the voltage of the battery you have to change the state of ADC_ENABLE_PIN
from high to low after which the voltage can be read for a few milliseconds. After reading the battery voltage it is useful to go back to a high state of that pin in order to read the voltage again afterwards.
The function below reads the analog pin where the ADC is connected to and returns the filtered (sum of 100 divided by 100) battery voltage in volts. In the last row of code the raw analog value will be converted to a voltage value by using a multiplier. If needed a constant linear offset can be added as well.
Last updated