Skip to content
Advertisements

Measure temperature/humidity using DHT22 + LCD i2c + Arduino

Hello everyone,

In this tutorial we’ll try to measure temperature and humidity using the DHT22, DHT22 and DHT11 are famous sensors used a lot for measuring temperature and humidity, they are pretty much the same, simple to interface and simple to use.

I also add to the project an LCD i2c screen to visualize the measures, LCD i2c tutorial

And for the temperature I’m using both Celsius and Farenheit you chose what suits you.

DHT22-PinOut

Differrences between DHT11 and DHT22:

DHT11 DHT22
Temperature range 0-50 °C -40 – 80 °C
Error ±2 °C ±0.5 °C
Humidity range 20-80% 0-100%
Error ±5% ±2-5%
Sampling Rate 1Hz 0.5Hz

As you can see the 22 is more accurate and have high range but it reads one value every second unlike the 11 that reads every second, but accuracy is more important.

In this tutorial I’m using the 4 pins version of the DHT22, unlike my DHT11 tutorial where I used the 3 pin version of the DHT11, both versions are the same because the other pin is not used, also they add a pull-up resistor, you cann add one if you want, I didn’t use it because i didn’t see any difference, you can add it if you want but don’t forget that a pull-up resistor dissipate more power in case you want to use it in a project using batteries or low consumption circuit…

Wirings:

Wiring 1: wiring directly to Arduino to visualize the measures on the Arduino IDE monitor

 

N.B: In case you want to add a pull-up resistor you can leave this wiring as is it then add a 10k resistor with 5v from arduino and pin 2 of the DHT22

DHT 1

The pin 3 is not connected

Wiring 2: Adding the LCD i2c screen

DHT 2

Codes and libraries:

DHT library: works for both DHT11 and 22 needs only a little change in the code you can see it in codes, download here  (Just download the zip file, then in arduino IDE add it and it will install quickly)

Codes : Download here all used codes, then chose what suits your project (contains, printing in C and F in serial monitor, printing in C on LCD and printing in F on LCD).

Advertisements

Yassine View All

Electronics, Automation engineering student... I try to share my little experience with other electronics amateur.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: