14. Measure Temperature and send data to server


Overview of LM35 Temperature sensor:

The LM35 datasheet specifies that this ICs are precision integrated-circuit temperature sensors, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35 thus has an advantage over linear temperature sensors calibrated in ˚ Kelvin, as the user is not required to subtract a large constant voltage from its output to obtain convenient Centi-grade scaling. The LM35 does not require any  external  calibration  or  trimming  to  provide  typical  accuracies  of  ±1»4˚C  at  rootemperature and ±3»4˚Cover a full 55 to +150˚C temperature range.

LM35 Features:

  •     Calibrated directly in o Celsius (Centigrade)
  •     Linear + 10.0 mV/oC scale factor
  •        0.5oC accuracy guarantee able (at +25oC)
  •     Rated for full −55o to +150oC range
  •     Suitable for remote applications.
  •     Low cost due to wafer-level trimming
  •     Operates from 4 to 30 volts
  •     Less than 60 µA current drain
  •     Low self-heating, 0.08oC in still air
  •     Nonlinearity only ±1»4oC typical
  •     Low impedance output, 0.1 Ω for 1 mA load

Pin configuration of LM35 Sensor:

  • Pin1(VCC): Supply voltage.
  • Pin2(output): Output voltage.
  • Pin3(GND): Ground.

Connection of LM35:

The Output pin of LM35 is Connected to A0 pin of ESP8266 Module, Ground pin is connected to the ground pin of ESP8266 Module and VCC is connected to 3V3 Pin of ESP8266 module.


Program:

#include <ESP8266WiFi.h> #include <WiFiClient.h>
#include <ESP8266WebServer.h>
const char* ssid= "WI-FI CAMPUS"; //replace with your network crediants const char* password="kuchbhi@123";
ESP8266WebServer server(80); //instantiate server at port 80(http port) String page="";
float data;
float analogValue,mv; 

void setup(void)
{

pinMode(A0,INPUT); delay(1000); Serial.begin(115200);
WiFi.begin(ssid, password); //begin Wifi connection Serial.println("");           //wait for connection while(WiFi.status()!=WL_CONNECTED)
{

delay(500); Serial.print(".");
}

Serial.println(""); Serial.print("connected to"); Serial.println(ssid); Serial.print("IP address:"); Serial.println(WiFi.localIP()); server.on("/",[](){
page="<h1>Sensor                   to                    Node                    MCU               web Server</h1><h3>Data:</h3><h4>"+String(data)+"</h4>";

server.send(200,"text/html",page);

});

server.begin();

Serial.println("Web server started!");

}


void loop()

{

analogValue=analogRead(A0);                // reading of temperature is equal to the analogvalue

mv=(analogValue/1024.0)*3300; // to convert the analog value in millivolt data=mv/100;
delay(1000); server.handleClient();
}
NOTE: After uploading the code open Serial monitor and get IP address of the WIFI and open browser and search this Ip address. The temperature data is shown in server. As shown in figure.




Comments

Popular posts from this blog

18. GPS Tracker Using Blynk App

6. Some IoT Platforms

16. Wi-Fi Button