Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, a web toolkit designed to help citizens, conservation practitioners, municipal decision-makers, researchers, educators, and students advance knowledge and stewardship of fresh water. New to EnviroDIY? Start here

Reply To: Interrupt

Home Forums Mayfly Data Logger Interrupt Reply To: Interrupt

#2228
Shannon Hicks
Participant

Because the v0.5 board can now accept an input supply voltage up to 12v, I had to change the onboard voltage divider that’s used for measuring the battery voltage by way of A6. So the formula for reading the battery voltage on a v0.3 or v0.4 board is this:

rawBattery = analogRead(A6);
sensorValue_battery = (3.3 / 1023.) * 1.47 * rawBattery;

But for boards v0.5 and later, the formula is now this:

rawBattery = analogRead(A6);
sensorValue_battery = (3.3 / 1023.) * 4.7 * rawBattery;

This is built in to the MayflyOnboardSensors library we posted recently on Github. More instructions will hopefully be posted soon about how to use all of our new libraries.

EDIT: I’ve also updated the Battery Measurement example to show both formulas.