0% found this document useful (0 votes)
14 views

DHT 22

The document describes a circuit to display temperature and humidity readings from a DHT22 sensor on a 16x2 LCD screen using an Arduino UNO. The circuit connects the DHT22 data pin to pin 7 of the Arduino and connects the LCD according to its pinout. The Arduino code uses the DHT and LiquidCrystal libraries to read the DHT22 sensor and display the temperature and humidity on the LCD.

Uploaded by

Bagwan Shoaib
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

DHT 22

The document describes a circuit to display temperature and humidity readings from a DHT22 sensor on a 16x2 LCD screen using an Arduino UNO. The circuit connects the DHT22 data pin to pin 7 of the Arduino and connects the LCD according to its pinout. The Arduino code uses the DHT and LiquidCrystal libraries to read the DHT22 sensor and display the temperature and humidity on the LCD.

Uploaded by

Bagwan Shoaib
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

AIM: To display Temperature and Humidity on a LCD using Arduino UNO & DHT22 sensor.

Apparatus:
1. Arduino UNO & programming cable
2. DHT22 sensor
3. 16x2 LCD module
4. 10k ohms trimmer
5. 220 ohms resistor
6. Breadboard
7. Connecting wires

Pinouts:

1. DHT22
The DHT22 is a basic, low-cost digital temperature and humidity
sensor. It uses a capacitive humidity sensor and a thermistor to measure
the surrounding air, and spits out a digital signal on the data pin (no
analog input pins needed). It's fairly simple to use, but requires careful
timing to grab data. The only real downside of this sensor is you can only
get new data from it once every 2 seconds, so when using our library,
sensor readings can be up to 2 seconds old.

2. 16x2 LCD
A 16x2 LCD means it can display 16 characters per line and there are
2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. The
16 x 2 intelligent alphanumeric dot matrix display is capable of displaying
224 different characters and symbols. This LCD has two registers, namely,
Command and Data.
3. Arduino UNO
Arduino Uno is a microcontroller board based on the ATmega328P. It
has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6
analog inputs, a 16 MHz ceramic resonator, a USB connection, a power jack,
an ICSP header and a reset button. It contains everything needed to support
the microcontroller; simply connect it to a computer with a USB cable or
power it with a AC-to-DC adapter or battery to get started.

Circuit:

DHT22

10k
220 R
trimmer

16x2 LCD
Procedure:
a) Connect the circuit as shown.
Connect the DHT22 data pin to pin 7 of Arduino.
Connect the LCD as shown. The 10k trimmer is used to adjust the contrast of LCD.
We use the 5V power supply from Arduino

b) Program the Arduino.

Program:
Upload the following program to Arduino

#include <DHT.h> //Add DHT library


#include <LiquidCrystal.h> //Add library of LCD
#define DHTPIN 7 //Set arduino pin 7 as DHT sensor input
#define DHTTYPE DHT22 //select DHT sensor type to DHT22

DHT dht(DHTPIN, DHTTYPE);


LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

//Declare variables to store values of humidity & temprature


float humi;
float temp;

void setup()
{
//start communication with DHT22 & LCD
dht.begin();
lcd.begin(16, 2);
}

void loop()
{
//Read temprature & humidity from DHT22
humi = dht.readHumidity();
temp= dht.readTemperature();

lcd.setCursor(0, 0); //Set cursor of LCD on first row


//Display Humidity
lcd.print("Humi.: ");
lcd.print(humi);
lcd.print(" %");

lcd.setCursor(0, 1); //Set cursor of LCD on second row


//Display Temprature
lcd.print("Temp.: ");
lcd.print(temp);
lcd.print(" *C");
delay(2000); //wait for 2 seconds
}

You might also like