Battery level readout?

Battery level readout?
« on: April 07, 2015, 04:21:54 AM »
Is it possible to read out the battery level of the lipo? Or what the power source is (battery/usb)?

Re: Battery level readout?
« Reply #1 on: April 07, 2015, 12:54:14 PM »
It's possible. Check the displayBattery function in the smartwatch demo at https://codebender.cc/sketch:91833 and the Arduino forum post it references. VCC of the microcontroller can be determined based on the internal 1.1V reference(which is unfortunately +/-10%), then you can infer the battery level based on that voltage- but keep in mind lithium batteries do not have a flat voltage curve- right now the example ignores that fact. If VCC is above 4.2V (5V minus a diode drop), USB power is probably attached. I'll try to update the demo with these things, but it may be a while.

Re: Battery level readout?
« Reply #2 on: April 07, 2015, 02:22:34 PM »
Thank you - that's good to know... though I probably can't integrate it into my game since I am getting slowly low on remaining flash memory :(

Re: Battery level readout?
« Reply #3 on: April 03, 2017, 01:04:35 AM »
in the case of
the demo code set battery in red if the result < 325, or green otherwise.

Does this mean there is no level of scaling? I.e. result / 325 does not mean anything, unlike the case of defined(ARDUINO_ARCH_SAMD) ?

How can we get the rough % of battery for ARDUINO_ARCH_SAMD type of circuit (such as TinyScreen+) ?