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.
- 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
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.
- Start the Arduino IDE version 1.6.4 or higher
- Go to 'File > Preferences'
- Add the link below to Additional Boards Manager URLs:
- Go to 'Tools > Boards > Boards Manager'
- Search for ESP8266, hit the Install button. Wait until the installation is complete.
Step 3: Create Your Sensor Modules at AskSensors
- Get free AskSensors account at asksensors.com
- Create a new Sensor with two modules:
- Module 1: Temperature
- Module 2: Humidity
3. Get your Api Key In generated by AskSensors.
Step 4: Coding
- Install the Adafruit DHT Library.
- Get this example sketch from the AskSensors github page.
- 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
- Install the USB serial adapter driver.
- 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.
- Insert the ESP-01 into the USB serial adapter as shown in the first image(1).
- Connect the serial adapter to your computer USB port.
- 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).
- Select 'Generic ESP8266 Module' as your board (Go to Tools >> Board >> Generic ESP8266 Module )
- Hit the upload button.wait until the upload is complete.
Upload the code using Arduino IDE:
Before powering up the board:
- Remove the ESP-01 from the USB serial adapter.
- Be sure to remove also the connection between the GPIO_0and the ground to let the ESP-01 starts its firmware normally.
- 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 ESP8266 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).
Step 7: Results
Power up the board and open the serial terminal (115200 baud rate), the ESP8266 will do the following sequence:
- Connect to the WiFi network
- Read temperature and humidity from the DHT11
- Connect and send the measurements to the AskSensors server
- 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.