Using the Digital Humidity and temperature sensor

Have you ever realized that there are some days when the weather seems so nice to you and some days when it feels like your enemy already? Okay lets look at something today. 
This same air we move in day in day out has some wonderful properties that we humans are sensitive to and care to know about. Depending on the quantity or quality of theses properties in the air we may surely experience some effects. 
And it’s not just humans, the sytems and machines and robots we build, may also need to operate in some condusive enviroments, so it is very important for them too to know what the weather says, yeah!

And hei of course there are so many applications out there which would require you to measure or know properties like humidity and temperature. So today I want to show us how to use this awesome DHT11 sensor.

The DHT11 sensor

The DHT11 is a cool two in one sensor. It measures both humidity and then temperature and this is because both properties of the air have some direct influence on each other.
If You’ve been using some sensors for sometime you’d realize most sensors produce analog outputs which gives you a range of values that describe the quantity or quality of the property being measured.
It’s the same with humidity and temperature. With the DHT11 you will see relative humidity being measured between 20% to 90% on the average and you will see temperature being measured between 0°C to 50°C.

But there is something special about the DHT11 you should know; its output is digital and so don’t be tempted to hook the data pin to the analog pins of your microcontroller. Another mystery is that, it is the same single output pin that spits out both the humidity and temperature values. 
Mmm dont be scared or confused already you will get everything soon! Lets go ahead and build this super simple circuit. 

The DHT sensor used in this fritzing view is the raw case having all 4 pins but note that only 3 of the pins are useful. Make sure to know the pinouts of your sensor well.

As you can see, hooking up the DHT11 to the arduino is very simple. The data pin of your module is to be connected to any of the digital pins of your microcontroller. In our case above, it was connected to pin 4
Let’s go for the codes now….

Coding the DHT11 sensor

Of the many sensors you will find yourself using, the DHT sensors are quite complicated. Retrieving data from this sensor is not as simple as it is for other sensors. It requires a special timing protocol to get the data out. But the good news is that, there is a library we will use that handles all the complicated things and makes coding it very simple. You should download the dht sensor library directly from the arduino site or from your library manager if you dont have it yet.

So yh that’s basically it for the codes too. The comments in the code do well to explain the program. And as you can see, if your sensor is a dht22 you only have change the “read11” to “read22“. It is very important.

After uploading the codes to your arduino you should see all the values being displayed on your serial monitor.

Applications of DHT sensors.

Such a sensor which can measure both humidity and temperature can be useful in so many ways:

  • Heating, ventilation and air conditioning systems
  • Can be used to build mini weather stations
  • For medical equipments that measure humidity
  • For home automations systems
  • To monitor and control the enviroment of your hydroponics farm
  • and many more you can think about.

If you also know of any applications or projects where such a sensor is useful, let us all know in the comment section below.

So hei genius, this is it for totoday! Go be you..

And dont forget to share your cool projects with the rest of us in the Aaenics community.

Stay blessed!

Related Articles

Responses

Your email address will not be published. Required fields are marked *