Login

Interface DHT11 sensor with NodeMCU

Objective

  • Interface the DHT11 digital humidity and temperature sensor with the NodeMCU
  • Read the values of humidity and temperature of the surroundings.

Things

  1. NodeMCU board (quantity: 1 no.)
  2. Micro USB cable A to B (quantity: 1 no.)
  3. Breadboard (quantity: 1 no.)
  4. DHT11 temperature and humidity sensor (quantity: 1 no.)
  5. DHT sensor library
  6. Adafruit Unified Sensor library
  7. Jumper wire – male to male (quantity: 4 no.)
  8. Arduino IDE on your computer

Let’s begin!

The DHT11 is a digital humidity and temperature sensor. It has one digital output which can be connected to any digital input pin of the NodeMCU.

You need to install the DHT library and the Adafruit Unified Sensor library.

  • Open Arduino IDE
  • Navigate to Sketch -> Include Library -> Manage Libraries
  • Search for DHT library and install
  • Search for Adafruit Unified Sensor library and install

Interfacing the DHT11 sensor with NodeMCU

 

Interfacing the DHT11 sensor with NodeMCU

 

Final Code

To copy the code, right click on view raw at the bottom of the code, click on open link in new tab and then copy the code.

There you go!

Takeaway

Loader Loading...
EAD Logo Taking too long?
Reload Reload document
| Open Open in new tab

We would love to see what you build out of these learnings!

Click here to submit your projects, share it with the world and stand a chance to be rewarded.

top

Knowledge and Content by Li2 Technologies | © 2021 NASSCOM Foundation | All rights reserved

X