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

Battery Measurement

This example sketch shows how to measure the voltage of the battery.  On the Mayfly, analog pin A6 is connected to a resistor divider that measures the voltage of the battery connected to the LiPo jack.  However, if the USB cable or an FTDI adapter is connected to the Mayfly (which is very likely since you’re viewing the data on the Serial Monitor) the measured voltage will be from the USB/FTDI cable and not the LiPo battery.  But this example shows the theory behind measuring and calculating the battery voltage, so this concept can be used in other sketches that are battery powered.