You are on page 1of 3

HUMIDITY & TEMPERATURE SENSING USING DHT11 SENSOR

HUMIDITY AND TEMPERATURE SENSING USING DHT11 SENSOR AND


ARDUINO UNO

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

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

Pinouts:

1. DHT11
The DHT11 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.

MICROCODE SOLUTIONS, PUNE Page 1


HUMIDITY & TEMPERATURE SENSING USING DHT11 SENSOR

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 trimmer 16x2 LCD 220
R

MICROCODE SOLUTIONS, PUNE Page 2


HUMIDITY & TEMPERATURE SENSING USING DHT11 SENSOR

Procedure:
a) Connect the circuit as shown.
Connect the DHT11 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 DHT11 //select DHT sensor type to DHT11

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 DHT11
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
}
-------------------------------------------------------------------------------------------------------
MICROCODE SOLUTIONS, PUNE Page 3

You might also like