Temperature and humidity monitoring by vision36 ,,, dht 11 sensor .
This is a project in which we will be using arduino and dht 11 temperature and humidity sensor ... so u can view the temperature and humidity in the serial monitor ,,,, LETS GET STARTED
CONNECT PIN NUMBER 2 TO THE DATA PIN ON THE DHT 11 [signal]
CONNECT 5V PIN TO THE VCC OF DHT11 SENSOR [ voltage (or) power ]
CONNECT GND TO THE GND PIN ON DHT11 SENSOR [ ground ]
now upload the code given below in the arduino ide
CODE :
#include "DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(9600);
Serial.println(F("DHTxx test!"));
dht.begin();
}
void loop() {
delay(2000);
float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true);
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println(F("Failed to read from DHT sensor!"));
return;
}
float hif = dht.computeHeatIndex(f, h);
float hic = dht.computeHeatIndex(t, h, false);
Serial.print(F("Humidity: "));
Serial.print(h);
Serial.print(F("% Temperature: "));
Serial.print(t);
Serial.print(F("°C "));
Serial.print(f);
Serial.print(F("°F Heat index: "));
Serial.print(hic);
Serial.print(F("°C "));
Serial.print(hif);
Serial.println(F("°F"));
}
COPY AND PASTE THE CODE ,, IF ANY MODIFICATIONS ARE REQUIRED YOU ARE FREE TO DO ,, THIS IS AN OPEN CODE NOT OWNED BY ME .
Comments
Post a Comment