DHT11 temperature and humidity sensor (module)


In this tutorial we will learn how to use a temperature and humidity sensor.

This is sufficiently specific for most projects that must follow a humidity and temperature readings.

We will use a library specially designed for these sensors, which will make our code short and easy to write.

Sensor specification (module)

DHT11 temperature / humidity sensor

Temperature range: 60 ° C (+/- 1 ° C), rel.
Humidity: 5-95% (+ / 5%)
Supply voltage: 3 to 5.5V.
With a built-in 10 K ohm pulling resistor.
Arduino Library: DHT .h

Required component:

x Arduino Uno R3
x USB cable
x DHT11 module
(x) x son F-M

Cable schematics


Capteur (module) de température et d’humidité DHT11

DHT11 temperature and humidity sensor (module)

Connect using a breadboard (BreadBoard) for testing purposes. We will use the digital connector 7 for the data. Follow the diagram above for easy setup. (Power supply at 5 volts, GND grounding and data output at digital 7 connector.

Arduino programming

To use DHT11 on the Arduino, you need to install the DHTLib library. It has all the functions necessary to obtain the humidity and temperature readings of the sensor. It is easy to install, just download the DHTLib.zip file below and open the Arduino IDE. Then go to Sketch> Include Library> Add .ZIP Library and select the DHTLib.zip file. (Http://playground.arduino.cc/Main/DHTLib)

Once installed, download, Compile and install this sample program on Arduino and open the serial monitor:


#include <dht.h>

dht DHT;

#define DHT11_PIN 7

void setup()

{  Serial.begin(9600);}

void loop(){  int chk = DHT.read11(DHT11_PIN);

Serial.print(“Temperature = “);


Serial.print(“Humidity = “);



Ces Fini, Vous prouver Observer les résultats sur la console.

Show Buttons
Hide Buttons