Temprature And Humidity Using ESP8266 And DHT11

Welcome to the first Project of Abhi’s Lab. In this project we will monitor temprature and humidity of our surrounding using ESP8266 and DTH11.

DTH11 is simple and cheap Temperature And Humidity Sensor, which gives data in digital format. For reading the data and Coding the module we will use Arduino IDE.

So first Things First connect your module to your PC and upload the code given below.

				
					
#include "DHT.h"        // including the library of DHT11 temperature and humidity sensor
#define DHTTYPE DHT11   // DHT 11

#define dht_dpin 0
DHT dht(dht_dpin, DHTTYPE); 
void setup(void)
{ 
  dht.begin();
  Serial.begin(9600);
  Serial.println("Humidity and temperature\n\n");
  delay(700);

}
void loop() {
    float h = dht.readHumidity();
    float t = dht.readTemperature();         
    Serial.print("Current humidity = ");
    Serial.print(h);
    Serial.print("%  ");
    Serial.print("temperature = ");
    Serial.print(t); 
    Serial.println("C  ");
  delay(800);
}
				
			

Leave a Comment

Your email address will not be published. Required fields are marked *