Temperature Data logging from sensor to server, This tutorial to show how you can send sensor data to a web server using esp8266 IoT WiFi Module, This tutorial is useful to understand in depth when we design projects using esp8266 IoT WiFi Module
ESP8266 WiFi Module ADC is present on ESP-12 Module not on the ESP-01,
ESP8266 accepts 0 to 1V as ADC input so we are connecting LM35 Temperature sensor it gives 10mV Per degree centigrade so we don't have to worry about calibration.
ESP8266 WiFi Module contains only one ADC Channel A0.
Programming of ADC is same as Arduino.
Step 1: Circuit Connections
Step 2: Programming the esp-12 (ESPino)
In This code we have refreshed web page automatically every 5 Seconds using
<meta http-equiv='refresh' content='5'/>\
Step 3: Testing of results
1. Connect your phone or Laptop using wifi to the Network Circuit4You
2. Enter IP:192.168.4.1 in browser.
3. You will see temperature reading continuously updating at every 5 seconds
You can find more stuff in project section
Your comments and suggestions are welcome, you can post your projects also
ESP8266 WiFi Module ADC is present on ESP-12 Module not on the ESP-01,
ESP8266 accepts 0 to 1V as ADC input so we are connecting LM35 Temperature sensor it gives 10mV Per degree centigrade so we don't have to worry about calibration.
ESP8266 WiFi Module contains only one ADC Channel A0.
Programming of ADC is same as Arduino.
Step 1: Circuit Connections
Step 2: Programming the esp-12 (ESPino)
In This code we have refreshed web page automatically every 5 Seconds using
<meta http-equiv='refresh' content='5'/>\
snprintf ( temp, 400, This is used to combine temperature reading and web page.
/* * Copyright (c) 2015, Circuits4You.com * All rights reserved. /* Create a WiFi access point and provide a web server on it. */ #include <ESP8266WiFi.h> #include <WiFiClient.h> #include <ESP8266WebServer.h> /* Set these to your desired credentials. */ const char *ssid = "Circuits4You"; const char *password = "password"; ESP8266WebServer server(80); /* Just a little test message. Go to http://192.168.4.1 in a web browser * connected to this access point to see it. */ void handleRoot() { digitalWrite ( led, 1 );
int analog; analog = analogRead(A0); //Read Analog Voltage of ADC Pin
analog = analog/10; //10mV is 1C
snprintf ( temp, 400, "<html>\ <head>\ <meta http-equiv='refresh' content='5'/>\ <title>Circuits4You.com Temperature Monitoring Server Demo</title>\ <style>\ body { background-color: #cccccc; font-family: Arial, Helvetica, Sans-Serif; Color: #000088; }\ </style>\ </head>\ <body>\ <p>Temperature: %04d</p>\ </body>\ </html>", analog ); server.send ( 200, "text/html", temp ); digitalWrite ( led, 0 ); } void setup() { delay(1000); pinMode(LED_BUILTIN, OUTPUT);
/* You can remove the password parameter if you want the AP to be open. */ WiFi.softAP(ssid); IPAddress myIP = WiFi.softAPIP(); server.on("/", handleRoot); server.begin(); } void loop() { server.handleClient(); }
Step 3: Testing of results
1. Connect your phone or Laptop using wifi to the Network Circuit4You
2. Enter IP:192.168.4.1 in browser.
3. You will see temperature reading continuously updating at every 5 seconds
You can find more stuff in project section
Your comments and suggestions are welcome, you can post your projects also