-->
Page 1 of 2

Battery replacement notification

PostPosted: Thu Sep 15, 2016 4:51 pm
by Britny
How to get a battery change notification for Esp8266 powered using AA batteries?

Re: Battery replacement notification

PostPosted: Fri Sep 16, 2016 4:40 am
by AcmeUK
There is a readvdd33() function but it was causing stack overflows/resets. Not sure if it has been fixed.

The preferred method is this :-

Code: Select allat the beginning of sketch
ADC_MODE(ADC_VCC); //vcc read
...
//in loop
float vdd = ESP.getVcc() / 1000.0;

Re: Battery replacement notification

PostPosted: Fri Sep 16, 2016 8:08 am
by mrburnette
If you are using a generic ESP8266 module, just design a voltage divider that uses high-value precision resistors and then use the A0 value reading to turn on a digital pin and an associated LED.

If you are using a NodeMCU, there is a voltage divider already on the board! You can choose to use the existing resistors in your calculations or remove them and place higher values as replacements. You can do the resistance-voltage calculations manually, or you can use on of the fancy online Circuit Simulators to quickly design exactly what you want from resistor values you have on-hand. I love Circuit Simulator:

Falstad Original Circuit Simulator Java: http://www.falstad.com/circuit/
Falstad Revised Circuit Simulator javascript

Lush Projects Circuit Simulator javascript: http://lushprojects.com/circuitjs/

Here is an example of where I used a modified NodeMCU and Circuit Simulator to calculate the proper values for a thermistor


Ray

Re: Battery replacement notification

PostPosted: Tue Sep 20, 2016 8:03 pm
by Britny
Thanks. I think this will work
AcmeUK wrote:There is a readvdd33() function but it was causing stack overflows/resets. Not sure if it has been fixed.

The preferred method is this :-

Code: Select allat the beginning of sketch
ADC_MODE(ADC_VCC); //vcc read
...
//in loop
float vdd = ESP.getVcc() / 1000.0;