Welcome to another module interfacing video
and in this one, we’re going to learn more
about the DHT11 temperature and humidity sensor
so let’s begin.
Here are the quick specs for the DHT11 and
it has a maximum sampling rate of 1Hz, which
means that you can request the sensor readings
once a second. The accuracy is good enough
for most hobby projects, but if you’re looking
for something better then you can use the
DHT22 which is similar but has a better accuracy
and higher refresh rate.
The DHT11 is commonly available as a module
like this with the pinouts mentioned on the
PCB but if you do get the sensor by itself
then you will need to wire it this way and
also use a pull-up resistor for the data line.
The sensor accepts a 3-5.5V power supply and
we will be using the 5V power supply from
the Nano Every board.
Let’s start by wiring the sensor to the
board. Open up the Arduino IDE library manager
and type in DHT11. You need to install the
DHT sensor library by Adafruit and if you
get a prompt telling you to install the unified
sensor library then please go ahead and install
it as we need that too. Once the installation
has completed, simply open up the DHTtester
example sketch.
The sketch contains useful information to
get you up and running and you need to select
the right sensor depending on the one you
are using. In our case, it’s the DHT11.
The sketch initializes the serial port along
with the DHT sensor class. We then wait a
bit for the sensor to be initialized, read
the sensor values, check for any errors, compute
the heat index and then print the results
to the serial terminal.
Let’s upload the sketch to watch this in
action. Once uploaded, open up the serial
Monitor and you should be able to view the
sensor readings.
Each time the microcontroller sends out serial
data, the corresponding LED will also blink
as can be seen here.
That’s how easy it is to interface the DHT11
and obtain temperature and humidity readings.
We will interface
something new in next week’s video, so do
subscribe to stay update. Don’t forget to
like and share this video to help others.
Thanks for watching and I will see you in
the next one.
