@christoph-blank Hi, thanks for using this board. In the first version of this board the divider is conected after LDO, so you can't measure voltage above 3.3V. In the second version the divider is connected to the battery directly. You use 3.2v battery so it is not problem for you. But LiFePo4 battery has very flat discharge curve so it can be hard to read this level with reasonable accuracy.
I will try to find LiFePo4 battery and add some piece of code soon. Yet you can play with followed code
// Get the battery Voltage int sensorValue = analogRead(BATTERY_SENSE_PIN); // 1M, 470K divider across battery and using internal ADC ref of 1.1V1 // ((1e6+470e3)/470e3)*1.1 = Vmax = 3.44 Volts /* The MySensors Lib uses internal ADC ref of 1.1V which means analogRead of the pin connected to 470kOhms Battery Devider reaches * 1023 when voltage on the divider is around 3.44 Volts. 2.5 volts is equal to 750. 2 volts is equal to 600. * RFM 69 CW works stable up to 2 volts. Assume 2.5 V is 0% and 1023 is 100% battery charge * RFM 69 HCW works stable up to 2.5 volts (sometimes it can work up to 2.0V). Assume 2.5 V is 0% and 1023 is 100% battery charge * 3.3V ~ 1023 * 3.0V ~ 900 * 2.5V ~ 750 * 2.0V ~ 600 */ #ifdef MY_IS_RFM69HW int batteryPcnt = (sensorValue - 750) / 1.5; #else int batteryPcnt = (sensorValue - 600) / 3; #endif
Thank you very much, what are the other differences between V1 and V2? I believe I have V1 but I'm not sure.
The above code is what I currently use, and I removed the sensor part of the module. However, it shows 100% until the end (until it's not sending anymore).
Looking forward to your tests!