Devices & Components
Arduino Uno Rev3
DHT22 Temperature Sensor
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (3 pins)
Jumper wires (generic)
Breadboard (generic)
Software & Tools
Arduino IDE
Project description
Code
DHT11 Library
Don't forget to add this library to the Arduino IDE.
DHT11.ino
arduino
The code for receiving the data from the DHT11 and printing it out on the serial monitor.
1#include <dht11.h> 2#define DHT11PIN 4 3 4dht11 DHT11; 5 6void setup() 7{ 8 Serial.begin(9600); 9 10} 11 12void loop() 13{ 14 Serial.println(); 15 16 int chk = DHT11.read(DHT11PIN); 17 18 Serial.print("Humidity (%): "); 19 Serial.println((float)DHT11.humidity, 2); 20 21 Serial.print("Temperature (C): "); 22 Serial.println((float)DHT11.temperature, 2); 23 24 delay(2000); 25 26}
DHT11 Library
Don't forget to add this library to the Arduino IDE.
Downloadable files
Schematics
Schematics

Schematics
Schematics

Comments
Only logged in users can leave comments