Arudino Uno – DHT11 Temperature, Humidity sensor

DHT11 is a very low cost digital temperature and humidity sensor. It contains a capacitive humidity sensor and a thermistor to measure the surround air.

The sensor uses a digital pin. The digital pin uses a pullup resistor. This resistor is needed if the sensor itself does not contains it. Compared to the DHT22 this sensor is less accurate but also lower price.

The sensor is supplied from the 5V output of the Arduino Uno board.

Circuit diagram (Breadboard)

Arduino Uno DHT11 Temperature, Humidity Sensor

Circuit diagram (Schematic)

Arduino Uno DHT11 Temperature, Humidity sensor Schematic

Arduino Code

The code uses the following DHT11 library:
https://github.com/adidax/dht11

#include "DHT.h"
#define DHTPIN 2 //DHT signal connected to PIN2
#define DHTTYPE DHT11 //DHT sensor type


DHT dht(DHTPIN, DHTTYPE);

void setup(){
	Serial.begin(9600);
	Serial.println(F("DHT Test"));

	dht.begin();
}

void loop(){

	delay (2000); //2 second delay
	
	float humidity = dht.readHumidity(); // Read humidity
	float temperature = dht.readTemperature(); //Read temperature in celsius
	float tempInFahrenheit = dht.readTemperature(true); // Read temperature in Fahrenheit /readtemperature(isfahrenheit =true!) /
	
	Serial.print(F("Humidity: "));
	Serial.print(humidity);
	Serial.print(F("%, "));
	Serial.print(F("Temperature: "));
	Serial.print(temperature);
	Serial.print(F("°C, "));
	Serial.print(tempInFahrenheit);
	Serial.print(F("°F, "));
	Serial.println

}

Leave a Reply

Your email address will not be published. Required fields are marked *