Determine power source on expansion board
shaunix last edited by
I have a Pytrack and I'd like to know whether or not it is plugged in and receiving power from USB or if it is running off the battery (and charging)
jcaron last edited by
@shaunix It would be charging if receiving power from USB, not running off the battery, obviously.
The simplest method is probably to use the on-board voltage divider and an appropriately configured ADC to measure the battery voltage. The charging voltage is higher than any voltage you may get while running off the battery.