www.webx.dk Start page
OZ2CPU Radioamateur mainpage
Homemade electronics Stuff old and new
ESP8266 WIFI Voltmeter Li-Ion ThingSpeak Deep Sleep Datalogger

The ESP8266 wifi serial modules, are the new HIT, so i had to play with them also
Here is my very first project with this new-wounder, a wireless WIFI voltmeter datalogger, very usefull for my lab experiments
when i want to monitor electronics over longer time, and simply check the live result via a web page, no matter where in the world i am at the same time.

The complete voltmeter ESP12E module, Li-Ion battery, 10V or 100V full scale readout for 1000 ADC value
IMPORTANT: the Node MCU 1.0 programmer board with ESP12E mounted, is using 10mA of current, the serial chip and 3.3V regulator
AND there is a voltage divider on the ADC input, 100k to gnd, and 220k in series with analog in.
this scale the input on node-mcu board, to about 3.3V while the esp12e module got 1V for full scale.

The node mcu board is very good as a programmer, I added a "standard" 8 pin socket, so I can handle the little esp8266 module also
the tiny module as shown here got NO ANALOG input, so it can not be used for the voltmeter project.
A ready made programmer is also available on ebay, but I could not wait.. so i had to make my own as shown.

Another picture of the node mcu programmer with small esp8266 module

Node mcu programmer bottom side reveal all the wires, quite easy to find the how to connect info online.

To program my ESP12E module, I had to mount a standard 8 pin connector as shown.

Some pins need pull up and pull down resistors to make it run.
And one extra connection from GPIO16 to RESET, for wake up after deep sleep.

Here it is better explained what to connect, ESP12E for RUN mode, with wake up after deep sleep

Voltmeter, divider resistors values, I used E24 values from my kit, but it is offcourse easier with trimmers,
or fixed resistors from E96 so the right values can be found.
I recommend fixed resistors, less trouble with temperature drift or age once soldered and tested.
Adjust the 10V range first, when perfect, then adjust the 100V range.
Of course you know what kind of voltage to expect, when you measure stuff,
So it is no big deal to "think" the decimal point into the ADC value readout
The ADC go from 0-1023 (it is 10 bits) but will readout 1024 if overloaded.

close up resistors esp8266 module, also see the removed copper, better for longest radio range not to have metal near the antenna,
and to avoid shorts on bottom side parts and wires.

I made a very simple webpage with a few thingspeak curves added to it,
actually I added 3 curves with the last 10, 100, 1000 points,
this way i simply scroll down to look at the relevant one. Each point is 2 minutes.
go to www.thingspeak.com and create user account, you need API key number for the software, read below.

The software : Just copy and paste directly into ARDUINO
All this do, is simply a visit to a web link with the measured value added to the URL, this way the value is transfered to the ThingSpeak system.
and cool curves or math or any funny function can be added. If you can dream it, you can make it (for 5$ total project cost)

#include Arduino.h //(just add <> arround all the 4 h files, for no compile errors) #include ESP8266WiFi.h #include ESP8266WiFiMulti.h #include ESP8266HTTPClient.h ESP8266WiFiMulti WiFiMulti; #define INTERVAL 60000 void setup() { pinMode(5, OUTPUT); //Serial.begin(115200); // uncomment for debugging for (uint8_t t = 4; t > 0; t--) { //Serial.println("Connect..."); delay(1000); } WiFiMulti.addAP("wifiname1", "wifipassword1"); // add as many known locations as needed WiFiMulti.addAP("wifiname2", "wifipassword2"); // maybe even your phone id in shared wifi mode WiFiMulti.addAP("wifiname3", "wifipassword3"); // this way it also work anywhere you might want to bring it WiFiMulti.addAP("wifiname4", "wifipassword4"); delay(1000); } // Time to sleep (in seconds): const int sleepTimeS = 120; // adjust the wanted update interval here, 120 = 2 minutes. void loop() { delay(100); if (WiFiMulti.run() == WL_CONNECTED) { digitalWrite(5, HIGH); HTTPClient http; String URL = "http://api.thingspeak.com/update?api_key=YOUR_UPDATE_KEY_HERE&field1="; // field is the curve number URL += (String)analogRead(A0); // here is ADC value is added as text to the URL. http.begin(URL); //HTTP int httpCode = http.GET(); if (httpCode > 0) { // file found at server if (httpCode == HTTP_CODE_OK) { String payload = http.getString(); } } else { } http.end(); digitalWrite(5, LOW); // Serial.println("wifi-data-send"); delay(100); ESP.deepSleep(sleepTimeS * 1000000); }// wifi } // main loop


2017 Thomas Scherrer OZ2CPU
Thanks to OZ5DZL for patience and support, and kick-starter help with the ESP stuff
If you found this page usefull, why not consider donate a bit.. see my contact page.