Arduino and DHT11 Temperature Measurement

16,356

75

5

Introduction: Arduino and DHT11 Temperature Measurement

Abstract

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:- muthuswamy.pugazhendi@gmail.com//Libraries
#include <DHT.h>//Constants
#define DHTPIN 2     // what pin we're connected to
#define DHTTYPE DHT11   // DHT11DHT dht(DHTPIN, DHTTYPE); // Initialize DHT sensor for normal 16mhz Arduino//Variables
float hum;  //Stores humidity value
float temp; //Stores temperature valuevoid 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
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 =");
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.

Recommendations

27 2.5K
20 2.1K
141 8.2K
Large Motors Class

14,602 Enrolled

5 Discussions

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.

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.

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

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

Thanks diy_bloke