Reading DHT22 (or DHT11) with Arduino

Didn't find a working example of how to read the data of DHT22. So here is what I came up with

Apr 16, 2021

1720 views

0 respects

Components and supplies

1

Arduino UNO

1

DHT22 Temperature Sensor

1

Jumper wires (generic)

1

Breadboard (generic)

1

Through Hole Resistor, 4.7 kohm

Project description

Code

Code for Arduino Uno to read DHT22

c_cpp

Code for Arduino Uno to read DHT22 (or DHT11). The values get written to Serial monitor. Other explanations in the code. Upload the code to your Arduino and then open the Serial Monitor (Windows 10: CTRL + SHIFT +M). Here you see the values of the sensor.

Downloadable files

DHT22 wirings to arduino

Here are the wirings you need to do for the DHT22. Program that I used for the schematic, didn't have a DHT22 so I used an other temperature sensor to represent it. It differs by only having 3 legs, but you are anyway using only 3 legs from the DHT22 (or DHT11). From left to right (from the textured side): 1. Vcc, connect to 5 v. 2. Data line, connect to digital pin 12. 3. Empty, not used for anything. 4. Ground.

DHT22 wirings to arduino

DHT22 wirings to arduino

Here are the wirings you need to do for the DHT22. Program that I used for the schematic, didn't have a DHT22 so I used an other temperature sensor to represent it. It differs by only having 3 legs, but you are anyway using only 3 legs from the DHT22 (or DHT11). From left to right (from the textured side): 1. Vcc, connect to 5 v. 2. Data line, connect to digital pin 12. 3. Empty, not used for anything. 4. Ground.

DHT22 wirings to arduino

Comments

Only logged in users can leave comments

kr_alexander

0 Followers

0 Projects

0