Hello. Recently I purchased a couple of sensors to use with my Arduino. One of them is the DHT11 Temperature and Humidity sensor. This sensor is a cheap one. I got it in India for around $1.5. I'll mention the links if you want.
What this project does?
Displays the temperature (in Centigrade) and relative humidity (in %) received from the DHT11 sensor on the 16X2 LCD.
Let's know the basics!
"DHT11 Temperature & Humidity Sensor features a temperature & humidity sensor complex with a calibrated digital signal output. By using the exclusive digital-signal-acquisition technique and temperature & humidity sensing technology, it ensures high reliability and excellent long-term stability. This sensor includes a resistive-type humidity measurement component and an NTC temperature measurement component, and connects to a high-performance 8-bit microcontroller, offering excellent quality, fast response, anti-interference ability and cost-effectiveness."
Source: http://www.exp-tech.de/
SPECS:
Relative humidity
Resolution: 16Bit
Repeatability: ±1% RH
Accuracy: At 25℃ ±5% RH
Interchangeability: fully interchangeable
Response time: 1 / e (63%) of 25℃ 6s
1m / s air 6s
Hysteresis: <± 0.3% RH
Long-term stability: <± 0.5% RH / yr in
Temperature
Resolution: 16Bit
Repeatability: ±0.2℃
Range: At 25℃ ±2℃
Response time: 1 / e (63%) 10S
Electrical Characteristics
Power supply: DC 3.5~5.5V
Supply Current: measurement 0.3mA standby 60μ A
Sampling period: more than 2 seconds
Pin Description:
1. VCC power supply 3.5~5.5V DC
2. DATA serial data, a single bus
3. NC, empty pin
4. GND ground, the negative power
From now on, forget about the pin 3.
Materials Required:
1. A DHT11 Sensor
2. Arduino
3. Jumpers
4. One 16X2 LCD
5. Three 1K and one 10K resistor.
6. Breadboard
7. and ofcourse, a PC with Arduino IDE installed!
Procedure:
Hardware part:
1. Connect the components as shown.
REFERENCE:
[Click to enlarge]
Software part:
1. Download this library: DHT
2. Extract the zip and you'll get a folder named: "DHT"
3. Copy this folder to [My Documents/Arduino/libraries]
4. Upload the sketch given below.
5. Power on the Arduino.
Sketch:
/* * ON PUBLIC DOMAIN * Author : Nitish Dash * Name : Temperature and Humidity on 16X2 LCD with DHT11 Sensor * Created : 12/26/2014 * Webpage : http://goo.gl/W5iB30 * Author Email : nitishdash95@gmail.com * Author Website : http://www.nitishdash.com/ **** DONOT COPY AND PLAGIARATE WITHOUT THE AUTHOR'S PERMISSIONS **** */ #include#include #define dht_dpin A0 dht DHT; LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //this section is for the symbol of degree byte deg[8] = { 0b01110, 0b01010, 0b01110, 0b00000, 0b00000, 0b00000, 0b00000, 0b00000 }; void setup() { //initialise for at least 2s lcd.begin(16, 2); lcd.print("INITIALISING"); delay(500); lcd.print("."); delay(500); lcd.print("."); delay(500); lcd.print("."); delay(500); lcd.print("."); delay(500); lcd.createChar(0, deg); } void loop() { DHT.read11(dht_dpin); lcd.clear(); lcd.setCursor(0, 0); lcd.print(" TEMP : "); lcd.print((int)DHT.temperature); lcd.write((uint8_t)0); lcd.print("C"); lcd.setCursor(0, 1); lcd.print(" HUMIDITY: "); lcd.print((int)DHT.humidity); lcd.print(" %"); delay(1000); //modify but don't delay for less than 1s }
NOTE: Please remove the line 58 from the code while uploading.
How this works (Algorithm):
The arduino receives the analog signal from the DHT11 sensor via A0 pin. The received signal is interpreted and processed by the library. The arduino then prints the message and measurement of temperature and relative humidity every 1s.
To test the sensor, try touching the sensor.
NOTE: Keep the sensor in normal conditions. Don't use it in excessively humid atmosphere or subject it to direct sunlight.
To test the sensor, try touching the sensor.
NOTE: Keep the sensor in normal conditions. Don't use it in excessively humid atmosphere or subject it to direct sunlight.
Video:
Coming soon.....
Downloads:
1. sketch.ino
2. Breadboard schematics
5. DHT11 Library
Any doubts? Feel free to leave a comment.
Coming soon.....
Downloads:
1. sketch.ino
2. Breadboard schematics
5. DHT11 Library
Any doubts? Feel free to leave a comment.
I did try to use your information but it give me error I don't no y?
ReplyDeleteArduino: 1.6.6 (Windows 7), Board: "Arduino/Genuino Uno"
C:\Users\S.Armani\Desktop\tem_with_lcd_code\tem_with_lcd_code.ino:2:27: fatal error: liquidcrystal.h: No such file or directory
#include
^
compilation terminated.
exit status 1
Error compiling.
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Did you remove the last line from the code?
Delete?
C:\Users\johnc\Documents\Arduino\dht111602alcduno\dht111602alcduno.ino:2:27: fatal error: liquidcrystal.h: No such file or directory and then exit status 1
ReplyDeleteError compiling for board Arduino/Genuino Uno.
#include
any help would be nice
I ran the Arduino debnugger and also tried a differnt source for a master dht file, working fine now. thanks.
Deletehttps://codeload.github.com/markruys/arduino-DHT/zip/master
DeleteHi Jack! Did you copy the downloaded files (DHT) into library folder in Documents/Arduino ? Please follow the instructions correctly!
Delete