Home › Forums › Mayfly Data Logger › Interrupt › Reply To: Interrupt
2017-05-15 at 6:16 AM
#2228
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 f
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.