LowPowerLab Forum

Hardware support => General topics => Topic started by: jalkestrup on June 02, 2017, 07:04:48 AM

Title: RFM96 (LoRa) - onboard low battery indicator, any use?
Post by: jalkestrup on June 02, 2017, 07:04:48 AM
Hi folks

In the hope of finding a way to get a battery warning before my moteino runs out of power (without adding external components) I was wondering if anyone had experience with using the onboard "Low Battery Detector" found in the RF96 datasheet? ( http://www.hoperf.com/upload/rf/RFM95_96_97_98W.pdf ).

Although when looking at the documentation it seem as it can at most be set to a threshold of 2.185 V - which I guess will make it obsolute if the voltage regulator is not bypassed as this cuts off at 3.3V if I'm not wrong?

Also if anyone has implemented it, example code would be much appreciated as I have very little experience with touching registrers and that kind of low-byte operations...

Kind regards
Jesper
Title: Re: RFM96 (LoRa) - onboard low battery indicator, any use?
Post by: Russ Hedger on July 02, 2017, 06:11:41 PM
I haven't used the moteino as difficult to get in the UK. However, both the MCU and RFM96 module are powered from the 3.3V regulator, so measuring this voltage won't give any indication of battery voltage until it falls through 3.3V + V_DROPOUT (at which point, you are in trouble).  Simplest way is to directly measure battery voltage with the ADC and a high resistance voltage divider so as not to over-voltage the ADC. Put a capacitor in parallel with the measured resistor to stabilise the measurement. See here for how to do it:

http://jeelabs.org/2013/05/16/measuring-the-battery-without-draining-it/index.html (http://jeelabs.org/2013/05/16/measuring-the-battery-without-draining-it/index.html)

I use 470K and 1M resistors with 100nF capacitor, which divides by 3.1, letting me read up to 10.3V.