Using the Internet of Things (IoT) in homes and industries it is possible to control any electrical or electronic equipment. Moreover, you can get the information from any sensor and analyse it graphically or in any user-defined format from anywhere in the world. The IoT using Arduino microcontroller (MCU) is easy and fun for those who are new to the field.
In this article, humidity and temperature information from DHT-11 sensor is analysed graphically on ThingSpeak platform using Arduino MCU and ESP8266 Wi-Fi module. Block diagram of the whole setup is shown in Fig. 1.
Circuit and working
Circuit diagram for monitoring humidity and temperature is shown in Fig. 2. It is built around Arduino MCU, DHT11 sensor and ESP8266 Wi-Fi module.
The DHT11 sensor senses humidity and temperature, and sends the information to digital pin 5 of Arduino MCU, as shown in Fig. 2. From Arduino MCU, humidity and temperature values are uploaded to the Cloud at regular intervals of time through ESP8266 Wi-Fi module. From the Cloud, humidity and temperature values can be seen graphically on ThingSpeak platform (http://thingspeak.com) from anywhere in the world.
Construction and testing
ThingSpeak is an open source data platform but you need to register to use it. After registering, login to your account and create a new channel with humidity as one field and temperature as another, as shown in Fig. 3. Once a new channel is created, it will generate two API keys, namely, write API key and read API key. Replace the line given below in the program with your write API key:
String apiKey = “ NTIM1RXET6YVUVWF “;
Next, substitute Host_Name and Password with your Wi-Fi name and Wi-Fi password in the two lines given below in the program (IoT.ino):
String Host_Name = “Jonah”;
String Password = “2569696”;
The program should be verified with your Wi-Fi setup. It uses DHT library. If DHT library is not present in your Arduino folder, download it from https://github.com/adafruit/DHT-sensor-library. To import DHT library in Arduino IDE, select Sketch→Import library→Add library→Select the library that you have downloaded.
Compile the sketch/program and upload it to Arduino MCU through Arduino IDE. Ensure that Wi-Fi modem and the Internet connection in your PC/smartphone are working properly.
Once sketch uploading is done, it will upload humidity and temperature values on ThingSpeak platform and you will be able to see it graphically in Private View window, as shown in Fig. 4. If you want to change channel or field name, you can change it from Channel Settings (Fig. 5). Author’s prototype is shown in Fig. 6.
Along with temperature and humidity sensor, other sensors like gas, voltage, current and energy can be used based on the requirement. Moreover, it is also possible to take further actions by controlling the actuators from the Internet once the sensor values are going above/below predetermined values.
Download Source folder
D. Citharthan is assistant professor at Christ The King Engineering College, Coimbatore, Tamil Nadu
T. Jonah Gilbert enjoys reading articles on machines, DIY projects and working with the IoT based projects