DHT-11 is a temperature and humidity sensor module. It use a serial data transmission between the module and the controller. It has the following features:
- Operating Voltage: 3.5V to 5.5V
- Operating current: 0.3mA (measuring) 60uA (standby)
- Output: Serial data
- Temperature Range: 0°C to 50°C
- Humidity Range: 20% to 90%
- Resolution: Temperature and Humidity both are 16-bit
- Accuracy: ±1°C and ±1%
A simple DHT-11 Sensor |
Typical connection |
Arduino running program |
The pull up resistor I used here is 10kOhm.
//Two-Wire library #include <Wire.h> #include <LiquidCrystal_I2C.h> //DHT-11 Sensor Library #include <SimpleDHT.h> //Default address 0x27, LCD is 16x4 LiquidCrystal_I2C lcd(0x27,16,4); //DHT-11 connects to pin A0 SimpleDHT11 dht11(A0); void setup(){ //Initialize the LCD lcd.init(); //Turn on the backlight lcd.backlight(); //show some information lcd.print("BTE Technician"); lcd.setCursor(0,1); lcd.print("Arduino Uno And"); lcd.setCursor(-4,2); lcd.print("DHT-11 Sensor"); lcd.setCursor(-4,3); lcd.print("LCD Example"); delay(3000); lcd.clear(); } byte temperature,humidity; void loop(){ //Get temperature, humidity, and no raw data dht11.read(&temperature,&humidity,NULL); lcd.setCursor(0,0); lcd.print("Temperature:"); lcd.setCursor(3,1); lcd.print(String(temperature,DEC)+" "+char(223)+"C"); lcd.setCursor(-4,2); lcd.print("Humidity:"); lcd.setCursor(-1,3); lcd.print(String(humidity,DEC)+" %RH"); delay(3000); }
Its wiring diagram is shown below.
Wiring diagram |
Click here to download its source file.
No comments:
Post a Comment