The Internet of things (IoT) is the inter-networking of physical devices (also referred to as "connected devices" and "smart devices"), buildings, and other items—embedded with electronics, software, sensors, actuators, and network connectivity that enable these objects to collect and exchange data.
Now I am going to instruct how to make an IoT-based device which is capable of controlling appliances and real-time weather monitoring. This device is built using ESP8266 NodeMCU.
ESP8266 NodeMCU is a device with a built-in WiFi module and micro controller which can interface with Arduino IDE.
Let's get started.
- NodeMCU ESP8266 [Banggood]
- 4 Channel Relay Board [Banggood]
- Perfboard [Banggood]
- Header Pins [Banggood]
- DC Jack [Banggood]
- DHT 11 [Banggood]
- First, take a perfboard and place female header pins with respect to NodeMCU ESP8266 pins.
- Take male header pins and solder beside the female header pins and interconnect the male and female header pins w.r.t ESP8266 to take output.
- Add some more male header pins at the +V and GND pins of ESP8266
- Now to make power supply: take a DC jack and IC7805 place it on the perfboard.
- Connect Vin of IC7805 to +V of DC jack and GND to GND.
- Now wire the +5v out of 7805 to Vin of ESP8266 and GND of IC7805 to GND of ESP8266.
- Now wire the relay board and DHT11 module to ESP8266 according to pins in the circuit.
- The connections in the circuit are the same as the pins declared in the program.
Now we need to prepare the dashboard and program the device.
For this project I used the Cayenne IoT platform.
- First you need to go to the Cayenne site and create an account by signing up.
- Now follow the instructions as given in the video.
- While creating the device, you need to select MQTT type.
- The site will generate username, password and client ID for the device; you need to copy it. This is needed for further procedure.
For more info visit here [Tutorial by Cayenne IoT team].
Download the libraries attached and include it in Arduino IDE.
I attached the code. First open the code and edit as follows:
- Enter SSID of your WiFi network (WiFi network name) within the quotes.
char ssid = "enter your WiFi network name";
- Enter password of your WiFi network within the quotes.
char wifiPassword = "enter your WiFi router password";
- Now you need to fill user name, password, client ID which you got while adding the device.
char username = "enter user name "; char password = "enter password "; char clientID = " enter client id ";
Now save and upload the code to ESP8266 NodeMCU module.
When ESP8266 NodeMCU module is connected to that server, you can automatically see widgets created in your dashboard. Pin those widgets and edit them (name, type, etc.).
That's all, guys.
For complete construction see the video below.
Feel free to comment.
For more projects, subscribe my YouTube channel [Click Here]