Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By AcmeUK
#55220 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;
User avatar
By mrburnette
#55225 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
User avatar
By Britny
#55459 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;