TEMPERATURE MONITORING With DHT22 & ARDUINO

OVERVIEW

This is very simple and small post but always simple and small things make smart and enterprise products. Any way it’s my dream that i write a program from that i can check my room temperature and humidity instead of watching from small devices.

The DHT sensors are made of two parts, a capacitive humidity sensor and a thermistor. There is also a very basic chip inside that does some analog to digital conversion and spits out a digital signal with the temperature and humidity. The digital signal is fairly easy to read using any microcontroller. There are two types – DHT11 and DHT22. Both have the same pinouts but have different characteristics. Summarily, the DHT11 sensor is cheaper and portable as compared to the DHT22 but if you want more accurate readings, the DHT22 is your best choice. So in today’s lesson, we will learn how to set up the DHT22 Temperature and Humidity Sensor so it can record the Temperature and Humidity values and display on the Serial Monitor. 

DETAILS

Some of the DHT22 sensors come with 3 pins and others come with 4 pins with the extra pin being  NC which stands for ‘No Connection’ and so not used. The common pins are; VCC which is the power supply and is connected to 5V pin / positive terminal of the power supply of the Arduino Uno, Data/out which spits out both Temperature and Humidity Values unto the serial monitor and is connected to any of the digital pins(in this case pin 10) of the Arduino Uno, Ground which stores the power and is connected to the Ground Pin/ negative terminal of power supply of the Arduino Uno. Therefore whether you have the 3-pin or 4-pin DHT11 sensor you need not worry.

You would need the following items for this project;

SCHEMATIC

 

 

CODE

#include <DHT.h>

DHT dht(10, DHT22);

void setup() {
  // put your setup code here, to run once:
  dht.begin();
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  int temperature = dht.readTemperature();
  int humidity = dht.readHumidity();

  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println(" C");

  Serial.print("Humidity: ");
  Serial.print(humidity);
  Serial.println(" %"); 
delay(1000);
}#include <DHT.h>

DHT dht(10, DHT22);

void setup() {
  // put your setup code here, to run once:
  dht.begin();
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  int temperature = dht.readTemperature();
  int humidity = dht.readHumidity();

  Serial.print("Temperature: ");
  Serial.print(temperature);
  Serial.println(" C");

  Serial.print("Humidity: ");
  Serial.print(humidity);
  Serial.println(" %"); 
delay(1000);
}

FINAL SETUP

READING ON THE SERIAL MONITOR

 

 

0 0 vote
Article Rating
0
Would love your thoughts, please comment.x
()
x