Introduction: Temperature and Humidity Sensor(dht11) Interface With Arduino

About: i am an electronics hobbyist.

Temperature sensor have wide range of application it’s used at many place some place it’s work as feedback system. There is multiple types of temperature sensor are available in the market with different specifications some temperature sensor used laser technique to measuring temperature this type of temperature sensor read the temperature sensor from far away but in this tutorial we will use only dht11 sensor to measure surrounding temperatures and humidity.

Step 1: Components Required:

  1. Arduino Uno
  2. dht11 sensor
  3. Breadboard
  4. Wires

Step 2: Connections:

Arduino Pin A0 ------->dht11 data pin

VCC -------->VCC

GND --------->GND

Explanation:

dht11 sensor: dht11 are used to measure surrounding temperature and humidity.Sensor Comes into 4 Pin package out of which only three pins will be used.

Spectifications:

1.Operating Voltage :3.3v to 5v

2.Operating Current: 0.3mA

3.Temperature range: 0°C to 50°C

4.Humidity Range: 20% to 90%

5.Resolution: 16-Bit

6.Accuracy: ±1%(both)

Step 3: Source Code:

Use following link to download library of dht11 : https://www.arduinolibraries.info/libraries/dht-se...

click here to get the code

Program Code:

#include<dht.h>
dht DHT;

void setup()

{

pinMode(A0,OUTPUT);

Serial.begin(9600);

}

void loop()

{

DHT.read11(A0);

Serial.print("current humidity = ");

Serial.print(DHT.humidity);

Serial.println("%");

Serial.print("current temperature = ");

Serial.print(DHT.temperature);

Serial.println("c");

delay(1000);

}

Explanation:

#include<dht.h>

dht DHT;

dht.h is the library that provides extra functions to minimize the line of code and makes the code simple and easy to understand.

pinMode(A0,OUTPUT);

pinMode(A0,OUTPUT) pinMode function are used to set direction of the pin whether INPUT or OUTPUT.

Serial.begin(9600);

Serial.begin(9600) Serial.begin is function it's allow the communication between Arduino and Computer and 9600 is the baud rate that means speed of data transferring between Arduino and Computer in a second 9600 bits data can transferred.

DHT.read11(A0);

DHT.read11(A0) read11 function used to read data from Sensor.

Serial.print(DHT.humidity);

Serial.print(DHT.humidity) DHT.humidity function used to read humidity and that data will be send to Computer.

Serial.print(DHT.temperature);

Serial.print(DHT.temperature) DHT.temperature function used to read temperature and that data will be send to Computer.

Step 4: Applications:

1.Local weather station.

2.Humidity and Temperature Measurement