-->
Page 2 of 2

Re: ESP8266-01 - voltage meter using GPIO0

PostPosted: Tue Oct 03, 2017 2:41 am
by Lars Bo Wassini
Update:

After I started this thread, I searched the internet a little further. My problem seems to be that the GPIO on ESP8266 does not actually have analog input. I need to use the ADC pin, and this is not present on the ESP8266-01 I was playing with.
I'll try using a "bigger" (07..12) version, where the ADC pin is exposed.

Re: ESP8266-01 - voltage meter using GPIO0

PostPosted: Sat Oct 07, 2017 7:30 am
by Lars Bo Wassini
I found a solution!
This is also working for ESP8266-01

Code: Select allADC_MODE(ADC_VCC);      // voltage sensor
int vcc;

void setup() {
...
}

void loop() {
   vcc = ESP.getVcc();

    double dvcc = (float)vcc / 1000;
    Serial.println("Voltage: " + String(dvcc,3) + "V");
}

Re: ESP8266-01 - voltage meter using GPIO0

PostPosted: Sat Oct 07, 2017 9:05 am
by schufti
not quite, the voltage is value/1024 according to sdk documentation.

Re: ESP8266-01 - voltage meter using GPIO0

PostPosted: Sun Oct 08, 2017 1:33 pm
by Lars Bo Wassini
schufti wrote:not quite, the voltage is value/1024 according to sdk documentation.



Aha! :-) Thanks! :)