Space In HIndi

 


Pages

Popular

DHT11 sensor interfacing with Arduino UNO

 DHT11 sensor interfacing with Arduino UNO 

How DHT11 measures Temperature and Humidity

Inside DHT11 sensor, there is humidity sensing component along with thermistor.


Humidity sensing component has two electrodes with moisture holding substrate sandwiched between them. The ions are released by the substrate as water vapor is absorbed by it, which in turn increases the conductivity between the electrodes. 

The change in resistance between the two electrodes is proportional to the relative humidity. Higher relative humidity decreases the resistance between the electrodes, while lower relative humidity increases the resistance between the electrodes.


DHT11 also contains a NTC/Thermistor to measure temperature. A thermistor is a thermal resistor whose resistance changes drastically with temperature. 

The term “NTC” means “Negative Temperature Coefficient”, which means that the resistance decreases with increase of the temperature

DHT11 sensor Basics:

DHT11 can measure temperature from 0°C to 50°C with ±2.0°C accuracy, and humidity from 20 to 80% with 5% accuracy. 

Note that the sampling rate of the DHT11 is 1Hz, meaning you can get new data from it once every second.

The module comes with all the essential supporting circuitry, so it should be ready to run without any extra components.
 The DHT11 sensors usually require external pull-up resistor of 10KΩ between VCC and Out pin for proper communication between sensor and the Arduino. However, the module has a built-in pull-up resistor, so you need not add it. 
The module also has a decoupling capacitor for filtering noise on the power supply.

DHT11 sensor interfacing with Arduino UNO

Connections are fairly simple. Start by connecting + (VCC) pin to the 5V output on the Arduino and connect – (GND) to ground. Finally, connect the Out pin to the digital pin 2

DHT11 sensors have their own single wire protocol for transferring the data. This protocol requires precise timing. By using DHT library,we can gives a command to read temperature and humidity data.

Download the library first, by visiting the GitHub repo. To install it, open the Arduino IDE, go to Sketch > Include Library > Add .ZIP Library, and then select the DHTlib ZIP file that you just downloaded.

Programming 

The following code show us Temperature and Humidity readings on serial monitor. 

#include // Include library 

#define outPin 2 // Defines pin number to which the sensor is connected 

dht DHT; // Creates a DHT object

void setup() 

{

 Serial.begin(9600);

 }

 void loop()

 {

 int readData = DHT.read11(outPin); 

float t = DHT.temperature; // Read temperature 

float h = DHT.humidity; // Read humidity 

Serial.print("Temperature = "); 

Serial.print(t); Serial.print("°C | ");

 Serial.print((t*9.0)/5.0+32.0); // Convert celsius to fahrenheit

 Serial.println("°F ");

 Serial.print("Humidity = "); 

Serial.print(h); 

Serial.println("% ");

 Serial.println("");

 delay(2000); // wait two seconds 

}


No comments: