Voltage Readings Not Working

Tags: #<Tag:0x00007fe21d93b140>


I am using a Xenon/Argon mesh setup with the 3.6V Lipo battery and am using the given:

float voltage = analogRead(BATT) * 0.0011224;

to track battery level. This will not work in loop(), voltage remains at it’s initialized value. When I put this line of code in setup() as well as loop(), it returns the correct voltage value but remains unchanged over an extended period of time. I have multiple event handlers that could be interrupting this call, but the reference docs say that an analogRead() takes around 10 microseconds, and I doubt the multiplication takes very long either.

Please Advise

Measuring current consumption

On a Xenon, It may take a couple Hours for the Li-Po voltage to drop 0.01 Volt.


The battery is also powering an AdaFruit GPS Featherwing with an active antenna. I want to power off the GPS board when I don’t need it and now want to test how much battery this saves side-by-side with one that does not shut off. I let them run long enough that there should have been change.


You might consider purchasing the INA219 Feather for $8:

With a Tripler:

The INA219 can tell you the voltage and current going INTO and/or OUT of the Li-Po.
I started using the INA219 FeatherWing for my Xenon Battery Discharge and Solar Trials. So much cleaner than DIY wiring.

You can quickly determine the mA and mW for the Xenon, and the GPS, etc.


When you say calling from loop() do you mean every loop call?

I would rather make the reading a timed activity - every minute should be sufficient or on demand i.e. when you are publishing battery voltage. Battery voltage drop will depend upon the size of the Lipo a d the draw on the battery.


Thank you for the suggestion. I am on a pretty tight size constraint so I would ideally not add any other hardware however I might have to look into it!


Thank you I will try implementing a timed approach.