ESP8266IOT Projects

Arduino IoT Cloud and ESP8266 with DHT11 for Temperature and Humidity Monitoring

Arduino IoT Cloud with ESP8266 and DHT11:

 

Arduino IoT Cloud and ESP8266 with DHT11 for Temperature and Humidity Monitoring- In my previous two tutorials, I explained how to get started with the Arduino IoT cloud using ESP32 WiFi + Bluetooth Module and explained in detail the most basic things which I believe as a beginner you should know. In my first tutorial, I explained how to control the ESP32 Onboard LED and how to monitor a Potentiometer. This tutorial will help you how to use digital and analog pins of the ESP32 module.

In my 2nd tutorial, I built a Home Automation project using the same ESP32 module and Arduino IoT Cloud. I controlled 220Vac light bulbs and a Fan using my cell phone and computer. So, if you guys want to control AC or DC loads using relays then you should definitely read this article.

allpcb circuit

Arduino IoT Cloud and ESP8266


In this article, we are going to use Arduino IoT Cloud with the Nodemcu ESP8266. We will be using DHT11 temperature and Humidity module with the Nodemcu ESP8266. We will measure the Temperature and Humidity and then we will send these values to the Arduino IoT Cloud where these values will be displayed on the Gauges, charts, and message widgets. You can monitor these values using a dashboard on your cell phone or you can also use your computer or laptop. The dashboard which you can see on the cell phone is automatically generated and I have explained this in my previous tutorials. Anyways, with the help of this project you can monitor the temperature and humidity values from anywhere around the world if you have the internet connection. In this tutorial, I will also explain how to use the message widget on the Arduino IoT Cloud which you can use in different projects for displaying text messages.

In this tutorial, I will not explain the most basic things which I have already covered in my previous getting started tutorial, because the account registration and ArduinoCreateAgent installation is same for the ESP32 and Nodemcu ESP8266. Without any further delay, let’s get started!!!

Amazon Links:

DHT11 Temperature and Humidity Module:

Nodemcu ESP8266 WiFi Module:

LM7805 Voltage Regulator:

470uf capacitor:

330-ohm resistor:

DC Female Power Jack:

Female Headers:

Male Headers:

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!



DHT11 Sensor:

Arduino IoT Cloud and ESP8266

  • DHT11 digital temperature and humidity sensor is a digital signal output with a calibrated temperature and humidity combined sensor.
  • It uses a dedicated digital modules and acquisition of temperature and humidity sensor technology to ensure that products with high reliability and excellent long term stability.
  • Sensor consists of a resistive element and a sense of wet NTC temperature measurement devices, and with a high-performance 8-bit microcontroller connected.
  • The product has excellent quality, fast response, anti-interference ability, high cost and other advantages.
  • The single-wire wiring scheme makes it easy to be integrated to other applications and the

simple communication protocol greatly reduces the programming effort required.

  • For the easy interfacing I have already soldered some jumper wires.

This sensor module utilizes DHT11 as the sensitive component and has a bypass capacitor and a pull-up resistor on-board. The DHT11 is a pre-calibrated digital output temperature and humidity sensor. The single-wire wiring scheme makes it easy to be integrated to other applications. The simple communication protocol greatly reduces the programming effort required.

Specification:
Power supply voltage: 3.3~5.5V DC
Output: the single bus digital signal
Measuring range: 20-90%RH humidity, temperature 0~50°
The measurement accuracy of +-5%RH: humidity, temperature +-2 °
Resolution: 1%RH humidity, temperature 1 °
Exchangeability: fully interchangeable
Long term stability: < ± 1%RH
Size: 28 * 12 * 7.2mm


ESP8266 with DHT11, Circuit Diagram:

Arduino IoT Cloud and ESP8266

These are the minimal connections which you can start with if in case you want to use your laptop to power up the Nodemcu ESP8266, you can use these connections for testing your code. A 10K-ohm resistor is connected between the Data and VCC Pin. The data pin of the DHT11 Sensor is connected with the D4 pin of the Nodemcu ESP8266 WiFi Module. Now, let’s take a look at another circuit diagram.

External Power supply for ESP8266, DHT11, Circuit Diagram:

Arduino IoT Cloud and ESP8266

The DHT11 Temperature and Humidity sensor connection with the Nodemcu ESP8266 remain exactly the same. This time I added this 5V regulated power supply based on the 7805 voltage regulator and don’t forget to add these 470uF decoupling capacitors. You will need this 5v regulated power supply for the Nodemcu ESP8266 module because you cannot use your laptop or computer as the permanent power source.

Arduino IoT Cloud and ESP8266

This is my Nodemcu ESP8266 development board based on the same connections as explained in the circuit diagram. I have already explained the designing and making.

Arduino IoT Cloud and ESP8266


I have also soldered a 10k-ohm resistor between the data and VCC pins.

Arduino IoT Cloud and ESP8266

I connected the DHT11 Temperature and Humidity sensor with the Nodemcu ESP8266 as per the circuit diagram. Now, let’s start working on the Arduino IoT Cloud.

Arduino IoT Cloud Dashboard Designing:

Now we will design application for the Temperature and Humidity monitoring system for which we will declare three variables. So, click on the add variable button and these variable will be:

  • Temperature variable: it will be used for the measurement of the temperature we will select the variable type of the temperature sensor

Arduino IoT Cloud and ESP8266

  • Humidity variable: now, we will add the humidity variable by selecting the variable type which is relative humidity and click on the add variable.

Arduino IoT Cloud and ESP8266

  • Then we will add a string variable msg through which we will send data to messenger and will click on the add variable.

Arduino IoT Cloud and ESP8266


Now all the variables are declared and ready for use.

Arduino IoT Cloud and ESP8266

Now we will select the device; so click on the select device and then select the third party device and in the select type device we will select the ESP8266 and select NodeMCU 1.0 and click on the continue button.

Arduino IoT Cloud and ESP8266

Then we will give a name to the device, in our case we are giving the name My_NodeMCU and click on the next button.

Arduino IoT Cloud and ESP8266

Now in order to make the device ready to use we will click on the download button and save the security id and secret key which will be used in the network connection.

Arduino IoT Cloud and ESP8266

After that we will configure the network; so click on the network button, write the SSID which is the name of the Wifi which we are using and give the password and paste the secret key from the pdf file, and click on the Save button.

Arduino IoT Cloud and ESP8266

Now the network is successfully added and now we are ready to start working on the Dashboard.  We will click on the dashboard in which we will design the application for the monitoring. First we will insert the gauge for the temperature.

Arduino IoT Cloud and ESP8266



Then we will link the temperature variable with the gauge.

Arduino IoT Cloud and ESP8266

So click the link variable and select the temperature.

Arduino IoT Cloud and ESP8266

In the similar way, we will add the humidity gauge and link the variable humidity with it.

Now we will add the messenger through which we will receive the notification of temperature and humidity. So click on the add button and select the messenger.

Arduino IoT Cloud and ESP8266

Then we will link the string variable msg with it.

Arduino IoT Cloud and ESP8266

We have also added chart for both the humidity and temperature in order to monitor and temperature on daily and weekly basis, so we will click on the add button, select the chart for the temperature, and link it with the temperature variable; then we add another chart for the humidity and link it to the variable humidity.

Arduino IoT Cloud and ESP8266

After adding all the Widgets and linking all the variables the next step is to open the Arduino Online editor and start coding.


Arduino IoT cloud Dht11 Code:

Nodemcu ESP8266 and DHT11, Code Explanation:

This Header file is automatically added.

#include “DHT.h”

I only added the DHT.h header file. You don’t need to download this header file, as we are using the Arduino Online editor so most of the libraries are already added. This is an amazing thing, as most of the beginners find it quite hard to download and install libraries. So, with the Arduino Online editor you only need to add this line of code and that’s it.

Inside the setup() function, I activated the Serial Communication which I used for debugging purposes to check my code if it’s working. The other lines of code inside the setup() function are automatically added.


Inside the loop() function, the ArduinoCloud.update() is automatically added. I added this dht_sensor_getdata() function, which is a user-defined function. I have placed my DHT11 sensor code inside this function.

I didn’t use the functions which were automatically generated.

But I defined my own function dht_sensor_getdata(). This is a user-defined function, it has no return type, and does not take any arguments as the input. Inside this function, we are simply reading the humidity and temperature values which are stored in variables humidity and temperature and then we send these values to the Arduino IoT Cloud where these values are displayed on the Gauges and charts widgets. The msg variable is also automatically generated and this variable is used to send a string message to the Arduino IoT cloud Dashboard.

You can find all the automatically generated variables on the top of the sketch, so you have to use these variables to send your sensors data to the Arduino IoT Cloud. So, that’s all about the programming.

Arduino IoT Cloud and ESP8266

I successfully monitored the Humidity and Temperature values on my cell phone and also on my Laptop screen.

Arduino IoT Cloud and ESP8266

For the practical demonstration and set by step explanation watch video tutorial given below.



Video tutorial:

 

Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Related Articles

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button