0:00
Hey everyone, welcome back to Arduino intro
0:02
Today we're diving into the world of temperature and humidity sensors with the DHT11 in Arduino
0:07
We'll explain what the DHT11 sensor is and show you how to use it to display temperature and humidity readings on the serial monitor
0:14
Let's get started. The DHT11 is a basic low cost digital temperature and humidity sensor
0:24
It uses a capacitive humidity sensor and a thermistor to measure the surrounding air, and it spits out a digital signal on the data pin
0:31
It's simple to use, but requires careful timing to grab data. The DHT11 temperature and humidity sensor module we're using
0:38
has three pins, VCC, data and ground. Now let's wire the DHT11 sensor to the Arduino
0:44
Here's how to connect it. DHT11 sensor VCC to 5V on Arduino, GND to GND on Arduino
0:51
data pin to digital pin 5 on Arduino. Next, we'll need to install the DHT library in the Arduino IDE
0:57
This library simplifies the process of reading data from the sensor. To install it, you need to download it first
1:03
I'll be posting the link to the library in the description. After downloading, open your Arduino IDE, go to sketch
1:09
include library, add zip library, locate the downloaded zip file and click open to install
1:15
With the library installed, it's time to write some code. This code will read the temperature and humidity from the DHT11 sensor
1:22
and print it to the serial monitor. Let's break down the code. First, we include the necessary library DHT.H for the DHT11 sensor
1:30
We create an instance of the DHT class for the DHT11 sensor
1:34
We define the pin the DHT11 is connected to with hash define DHT11 underscore pin 5
1:41
In the setup function, we initialize serial communication with serial dot begin 9600
1:47
In the loop function, we read the temperature and humidity using DHT11 dot read 11 DHT11 underscore pin
1:55
We then print the temperature and humidity values to the serial monitor with serial dot print and serial dot print line
2:01
Finally, we add a delay of 2000 milliseconds, two seconds between each reading to allow the sensor to stabilize
2:08
Now let's upload the code to the Arduino and see it in action. Open the serial monitor to see the temperature and humidity
2:20
readings every two seconds. As you can see, the temperature and humidity readings
2:25
are now displayed on the serial monitor. This simple project is a great starting point for more advanced weather stations
2:30
or environmental monitoring systems. And there you have it. A straightforward way to read temperature and humidity
2:38
using the DHT11 sensor and an Arduino. If you enjoyed this video, please give it a thumbs up
2:44
and subscribe to Arduino intro for more exciting projects. Leave a comment below if you have any questions or suggestions