Getting voltage from ESP8266 board

It would be good if it was possible to get voltage from my board. All my projects are made to run on batteries.

I suspect i can use the esp ADC line to get voltage but how would i go about setting it ůp in sketch.

I have this board and have the adc pulled out.

You might have better luck asking the question over at the Arduino.cc forums. You may also want to Google the ESP8266 datasheet to see if/how it maps the voltage to the ADC line.

Have alook at http://nvdd.info/1KkeHaA

Please keep us up to date, I would love to knwo your experience with this - same issue as you - battery operated units :slight_smile:

Isn’t a small solar panel an option to recharge the battery on the fly? Just thinking out loud here :wink:

Problem is that batterys add little cost. With some sleep function they can last up to a year. Solar panels add a lot of cost.
The thing with iot is the less cost the better.

Just tried it and the following works quite nicely. Added a bar graph on virtual 10 with values from 0 to 3500 (3.5v).

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

extern "C" {
  uint16 readvdd33(void);
}

char auth[] = "insert_your_auth_token_here";
unsigned long lastUpdate = 0;

void setup()
{
  Serial.begin(115200);
  Blynk.begin(auth, "wifi_ssid", "wifi_password");
}


void loop()
{
  Blynk.run();
  if (millis() - lastUpdate > 10000)
  {
    lastUpdate = millis();
    if (!Blynk.connected()) return;
    Blynk.virtualWrite(10,readvdd33());  
  }
}

@horsedung

Please avoid “virtualWrite” in main loop. It could crash your board and creates unnecessary load on server. Please look at better example here.

1 Like

Thanks for the hint… had just noticed that it was causing a lot of traffic and was trying to find a better timer based example! Will update my poor example in a second once I’ve changed it to not flood the servers.

2 Likes