Arduino and DHT11 Temperature Measurement




Introduction: Arduino and DHT11 Temperature Measurement


The DHT11 is a precision temperature sensor module, provide calibrated temperature and humidity which is connected to digital IO pin of Arduino. The DHT11 provides the temperature in Celsius format. The Arduino program converts the temperature into Fahrenheit, Kelvin and Rankine, and sends via serial port.

Parts and components

Arduino Uno board = 1 No

DHT11 = 1 No

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Schematic

DHT11 digital temperature / humidity sensor delivers temperatures between 0°C and +50°C and humidity between 0% to 100%.

The temperature accuracy is ±2°C (maximum).

The DHT11 data pin is connected with Arduino digital IO pin. Arduino reads the temperature and humidity at 2 second interval and sends to the serial port.

The conversion formula for Celsius to other scale are given below.

Fahrenheit:- T(°F) = T(°C) × 9/5 + 32

Kelvin:- T(K) = T(°C) + 273.15

Rankine:- T(°R) = (T(°C) + 273.15) × 9/5

Step 2: Software

The included DHT library offers the read interface for the sensor. Arduino reads the temperature and humidity values at 2 seconds interval.

The temperature is in Celsius format, which is converted into Fahrenheit, Kelvin and Rankine format by the software.

All four formats are send to the serial port and will be printed on the serial terminal.

// Experiment of DHT11 digital temperature reader

//DHT11 Data line connected to Arduino digital IO 2

// Name:- M.Pugazhendi // Date:- 12thAug2016 // Version:- V0.1 // e-mail:-

//Libraries #include <DHT.h>

//Constants #define DHTPIN 2 // what pin we're connected to #define DHTTYPE DHT11 // DHT11

DHT dht(DHTPIN, DHTTYPE); // Initialize DHT sensor for normal 16mhz Arduino

//Variables float hum; //Stores humidity value float temp; //Stores temperature value

void setup() { //Initialize serial port Serial.begin(9600);

Serial.println("DHT11 sensor testing"); //Initialize the DHT sensor dht.begin(); }

void loop() { float converted = 0.00; //Read data and store it to variables hum and temp hum = dht.readHumidity(); temp= dht.readTemperature();

Serial.print("Celsius = "); Serial.print(temp); //Print degree symbol Serial.write(176); Serial.println("C");

//Fahrenheit //T(°F) = T(°C) × 9/5 + 32 converted = ( temp * 1.8 ) + 32; Serial.print("Fahrenheit = "); Serial.print(converted); //Print degree symbol Serial.write(176); Serial.println("F");

//Kelvin //T(K) = T(°C) + 273.15 converted = temp + 273.15; Serial.print("Kelvin = "); Serial.print(converted); Serial.println(" K");

//Rankine //T(°R) = (T(°C) + 273.15) × 9/5 converted = temp + 273.15; converted = (converted * 1.8); Serial.print("Rankin = "); Serial.print(converted); //Print degree symbol Serial.write(176); Serial.println("R");

Serial.print("Humidity ="); Serial.println(hum);

//2000mS delay between reads delay(2000); }

Step 3: Conclusion

The project is successfully completed with Arduino UNO and DHT11 module.

The converted temperature, and its serial port screen is given below.

1 Person Made This Project!


  • Backyard Contest

    Backyard Contest
  • Silly Hats Speed Challenge

    Silly Hats Speed Challenge
  • Finish It Already Speed Challenge

    Finish It Already Speed Challenge

5 Discussions


1 year ago

Eureka, finally found a code that works. The degree symbol displays a square but I know the difference! Thought at first my generic DHT11 was defective. Now to modify code for an 16x2 LCD I2C........Thank you.


2 years ago

It worked fine for me once I remembered how to use Arduino IDE and found where you must change the DHT type from DHT11 to DHT22. Then it worked. I will be including this in a project to remotely monitor temperatures and display on a 3.5" screen using MQTT. Raspberry PI, and ESP8266.


3 years ago

The DHT11 is terrible :D buy the DHT22 type, it is so much more accurate and just a little bit more expensive ;)


3 years ago

Great ibble

I love the DHT11 but they are not really that accurate :-)
| am right now looking at a display that shows the temperature of a DS18B20 as well as the temperature of two DHT11's and their humidity:
DS18B20 22.25 degrees C
DHT11-1 24 degrees C
DHT11-2 23 degrees Celcius
DHT11-1 25% humidity
DHT11-2 59% humidity
Commercial humidity/temp meter tells me it is 22.1 degrees and 69% humidity

The DS18B20 was checked in icewater (gave 0.2 degrees Celsius) and boiling water (gave 100 degrees Celsius)
So perhaps the temperature is in the ballparc, but obviously a problem with the humidity

Nevertheless, I love those little DHT11's


Reply 3 years ago

Thanks diy_bloke