ss LEARN | TRONICLAB



GETTING STARTED WITH TEMPERATURE AND HUMIDITY SENSOR ON ARDUINO


In this tutorial we would learn how to interface the Arduino with a temperature and humidity sensor to add to your project. The DHT11/DHT22 humidity and temperature sensors makes it really easy to add humidity and temperature data to your DIY electronics projects. These sensors are very popular for electronics hobbyists and makers because it is relatively cheap and perfect for remote weather stations, home environmental control systems, and farm or garden monitoring systems. In this tutorial, we will first go into a little background about humidity, then I’ll explain how the DHT22 measures humidity because that is the sensor we are going to be using in this tutorial. After that, we’ll show you how to connect the DHT22 to an Arduino and give you some example code so you can use the DHT22 in your own projects and we would show you our experience with it. Here are the specifications of the DHT22:

WHAT IS RELATIVE HUMIDITY?


The DHT22 measures relative humidity. Relative humidity is the amount of water vapor in air vs. the saturation point of water vapor in air. At the saturation point, water vapor starts to condense and accumulate on surfaces forming dew. The saturation point changes with air temperature. Cold air can hold less water vapor before it becomes saturated, and hot air can hold more water vapor before it becomes saturated, relative humidity is expressed as a percentage

COMPONENTS REQUIRED:


SETTING UP THE DHT22 ON AN ARDUINO


Now that we are done with the boring stuff we can move on to the connection of the circuit, but before you can use the DHT22 on the Arduino, you will have to install the DHT library (If you have our starter kit we’ve Got you covered, you can just copy it from the library folder in the cd pack). If not, we still have you covered you can download it here Then open Arduino IDE. Then go to Sketch>Include Library>Add .ZIP Library and select the DHT_sensor_library-1.3.0 file.

SCHEMATICS


The sensor has four pins namely VCC, GND, DATA and a not connected pin. A 10k resistor is used as a pull-up resistor to keep the DATA line high and also to enable communication between the Arduino board and the sensor some sensors, alternatively you can get the sensor having just three pins (they have internal pull-up resistors).

CODE


Basically, in the setup we initiated serial communication between the Arduino board and the LCD and also the sensor

NOTE: specify the DHTTYPE as the exact type of sensor you are using

If you don’t have an LCD you can display your results using the serial monitor using the schematic and code below:

SCHEMATICS


CODE

OUR PROJECT EXPERIENCE:








If you have any questions about how to set up the DHT22 humidity and temperature sensor on your Arduino, just leave a comment below and I will try to answer it… And if you like our tutorials, please subscribe! Also, feel free to share this if you know anyone else that might find it helpful.z STAY CREATIVE!