The following table compares some of the most important specifications of the dht11 and dht22 temperature and humidity sensors.
Arduino code for temperature and humidity sensor dht22.
Feel free to substitute if needed.
Before i go to next step i think i need to tell you some thing about dht22.
If you have any questions about substitutions please leave a comment below and i will help you out.
There are various reasons why we went for the dht22 sensor in this tutorial for starters it is both small and highly affordable.
So in this tutorial we are going to interface the dht22 temperature and humidity sensor with arduino and also we will display the data on the lcd.
The dht22 sensor is used to measure the temperature and humidity.
Arduino library for dht11 dht22 etc temp humidity sensors author.
The dht 22 also named as am2302 is a digital output relative humidity and temperature sensor.
The dht22 humidity temperature sensor.
The dht11 and dht22 are very similar but differ in their specifications.
Write all changed data to the serial monitor.
After the c code is successfully compiled a hex file is generated.
This sensor is cheap and also has better accuracy.
The code developed for the arduino uno r3 is written in the c language.
This distance makes the sensor highly suitable for arduino projects where you want the arduino to be in a central location.
I am using dht22 temperature and humidity sensor with arduino uno r3 and getting it s data from arduino serial monitor.
The room temperature humidity will be.
Initialize dht temperature humidity sensor data.
It is also known as the am2302.
You can copy the code by clicking on the button in the top right corner of the code field.
Temperature and humidity monitoring with dht22 sensor arduino uno r3 code include dht h include define dhtpin 7 define dhttype dht22.
The compiler used to write the c code is arduino ide 1 8 0.
Arduino uno rev 3.
The dht22 has a long transmission distance with the cable length being able to be 20m.
In this tutorial you will learn how to use this sensor with arduino uno.
It uses a capacitive humidity sensor and a thermistor to measure the surrounding air and spits out a digital signal on the data pin.
You can upload the following example code to your arduino using the arduino ide.
It s humidity range is 0 100 and temperature range is 40 125 c that s why i prefer dht22 as compared to dht11.
This library is compatible with all architectures so you should be able to use it on all the arduino boards.
Guide for dht11 dht22 humidity and temperature sensor with arduino.
Next i will explain how the code works.
Parts used in this test.
Dht11 dht22 temperature and humidity sensor arduino example code.