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

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 // 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.