Introduction: Temperature & Humidity Monitoring Using the ESP-01 & DHT and the AskSensors Cloud

About: IoT Maker, co-founder of asksensors.com

In this instructable we are going to learn how to monitor the temperature and the humidity measurements using the IOT-MCU/ESP-01-DHT11 board and the AskSensors IoT Platform.

I'm choosing the IOT-MCU ESP-01-DHT11 module for this application because it's ready-to-use and save development time. However, if you are looking for home automation systems, I suggest the ESP8266 nodeMCU tested in my previous instructable, which provides more input/outpout, large memory and additional features.

ESP-01 OVERVIEW:

  • The ESP8266 is a low-cost WiFi module with full TCP/IP stack.
  • The ESP8266 series are produced by Espressif Systems.
  • The ESP-01 is a small size black colored module with 1M memory.
  • Note that the ESP-01 module requires only 3.3 volts to power up.

IOT-MCU ESP-01-DHT OVERVIEW:

This module uses the ESP-01 or the ESP-01S as the master control, and the DHT11 allowing to measure the in the scales from 0 to 50 degrees Celsius and the humidity of the air in the ranges from 20 to 90%.

As follows a summary of the main characteristics:

  • Controller: ESP-01 / ESP-01S (To buy separately)
  • Temperature and humidity sensor: DHT11
  • Operating voltage: DC 3.7V-12V (It supports 3.7V lithium battery power supply)
  • Measuring range: 20-90% RH 0-50 ℃,
  • Measurement accuracy: Temperature ± 2 ℃, Humidity ± 5% RH.

Step 1: Materials

These are the components that you will need for this tutorial:

  1. ESP-01 or ESP-01S
  2. USB Serial converter to program your ESP-01.

  3. IOT-MCU/ ESP-01-DHT11

  4. External 3.7V to 5V DC Power supply.

Step 2: Environment Setup

First, You need install the ESP8266 core to the arduino IDE. Skip this step if you have the ESP8266 already installed.

  1. Start the Arduino IDE version 1.6.4 or higher
  2. Go to 'File > Preferences'
  3. Add the link below to Additional Boards Manager URLs:

    'http://arduino.esp8266.com/stable/package_esp8266com_index.json'

  4. Go to 'Tools > Boards > Boards Manager'
  5. Search for ESP8266, hit the Install button. Wait until the installation is complete.

Step 3: Create Your Sensor Modules at AskSensors

  1. Get an AskSensors account at asksensors.com
  2. Create a new Sensor with two modules:
  • Module 1: Temperature
  • Module 2: Humidity

3. Get your Api Key In generated by AskSensors.

You can find tutorials and instructables showing how to get started with the AskSensors IoT platform and setting sensors to collect data using the web browser or the ESP8266 nodeMCU.

Step 4: Coding

  1. Install the Adafruit DHT Library.
  2. Get this example sketch from the AskSensors github page.
  3. Modify the Wi-Fi SSID and password, the Api Key In and, if needed, the delay between two successive measurements:

const char* wifi_ssid = "..........";             // SSID 
const char* wifi_password = ".........";         // WIFI 
const char* apiKeyIn = ".........";      // API KEY IN
delay(25000);     // delay in msec

Now the code is all set. Let's move to the next step to run the software.

Step 5: Programming the ESP-01

    Upload the code using Arduino IDE:

  1. Install the USB serial adapter driver.
  2. Connect the GPIO_0 to the ground in order to enable the programming mode of ESP8266. There are some USB serial adapter that come with programming switch on it so during upload you have to press the switch. in my case,I have no switch, so I soldered a jumper between the GPIO_0 and the ground of the USB serial adapter.
  3. Insert the ESP-01 into the USB serial adapter as shown in the first image(1).
  4. Connect the serial adapter to your computer USB port.
  5. Open Arduino IDE . You should get 'Port' enabled. if not, select the right port shown for your USB serial adapter (On Arduino software click Tools >> Port).
  6. Select 'Generic ESP8266 Module' as your board (Go to Tools >> Board >> Generic ESP8266 Module )
  7. Hit the upload button.wait until the upload is complete.

Before powering up the board:

  1. Remove the ESP-01 from the USB serial adapter.
  2. Be sure to remove also the connection between the GPIO_0and the ground to let the ESP-01 starts its firmware normally.
  3. Insert the ESP-01 into the IOT-MCU connector as shown in the second image(2). Now we are ready to power up the board!

Got Issues ?

Have you get any issues? Please see the next step.

Step 6: Throubleshooting

Programming the ESP-01 is a little bit hard for beginners. These are some possible errors:

  • GPIO_0 is not grounded during the Reset
  • The USB Connection with PC is not good.
  • The COM port is not correct. If you have more than one port showing, just disconnect the USB serial adapter from the USB port and see what port disappeared. Insert the serial adapter again and verify the new COM port added. Select this port number manually.
  • You are not selecting the right Board(Generic ESP8266 Module).

If you are still having issues, please refer to this instructable.

Step 7: Results

Power up the board, the ESP8266 will do the following sequence:

  1. Initialization
  2. Connect to the WiFi network
  3. Read temperature and humidity from the DHT11
  4. Connect and send the measurements to the AskSensors server
  5. Repeat the two previous steps periodically.

Login to the AskSensors web site and show graphs of the temperature and humidity modules. You will get your measurements plotted in real time. You can also export the collected data in CSV files.

Step 8: Well Done!

You have successfully completed our tutorial about monitoring the temperature and humidity with ESP8266 and IOT-MCU board connected to the AskSensors cloud.
See more instructables here.