How to Make an IoT Device to Control Appliances and Monitor Weather Using Esp8266

Introduction: How to Make an IoT Device to Control Appliances and Monitor Weather Using Esp8266

About: HI! I am Junez Riyaz, currently doing Bachelor of Technology in the field of Electronics and Communication Engineering. I am much interested in inventing something new yet from my childhood. In my leisure time…

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 base device which is capable of controlling the appliances and realtime weather monitoring . This device is build using ESP8266 Node Mcu .

Esp8266 node mcu is a device with built in wifi module and micro controller which can interface with arduino ide .

Lets Get Started..

Step 1: Components Required

Node MCU Esp8266 [Banggood]

4 Channel Relay Board [Banggood]

Perfboard [Banggood]

Header Pins [Banggood]

DC Jack [Banggood]

DHT 11 [Banggood]

Step 2: Circuiting

  • First take a perfboard and place female header pins with respect to Node Mcu esp8266 pins.
  • Take male header pins and solder beside of 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 +V and GND pins of Esp8266
  • Now the turn 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 DHT 11 module to Esp 8266 according to pins in the circuit.
  • The connections int he circuit is same as the pins declared in the program.

Now we need to prepare the dashboard and program the device.

Step 3: Creating a Device in Dashboard.

For this project I used Cayenne IoT platform .

First you need to go Cayenne site and create an account by sign up.

Now follow the instructions as given in the video.

While creating the device you need to select MQTT type.

Then 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 ]

Step 4: Programming

Download the libraries attached and include it in arduino ide .

I attached the code.

  1. First Open the code and edit as follow.
  2. Enter SSID of your wifi network ( Wifi network name ) with in the quotes.

char ssid[] = "enter your wifi network name ";

3. Enter password of your wifi network with in the quotes.

char wifiPassword[] = "enter your wifi router password ";

4.Now you need to fill user name,password,clientid 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 ESP 8266 node mcu module.

When esp8266 node mcu module is connect to that server , you can see automatically widgets created in your dashboard. Pin those widgets and edit them (name, type etc) .

Thats all Guys ...

For complete construction see the video below.

Step 5: Construction and Testing

Feel free to comment.

For more projects subscribe my youtube channel [Click Here]

Visit my website for more projects.

Lights Contest 2017

Participated in the
Lights Contest 2017

Internet of Things Contest 2017

Participated in the
Internet of Things Contest 2017

Be the First to Share


    • Mason Jar Speed Challenge

      Mason Jar Speed Challenge
    • Bikes Challenge

      Bikes Challenge
    • Remix Contest

      Remix Contest

    3 Discussions


    3 years ago

    Hi, I do not see the 4 light switches on Cayenne, i see only the DHT 11 .

    What am i doing wrong?

    Thanks in advance.


    Reply 1 year ago

    You must have found the method to add the switches on Cayenne . But for those who search for answer here.
    "if you want to add a Button (or any other actuator, as opposed to a sensor) in MQTT, there is no auto-creation process like there is with the virtualWrite statements. Instead, first create the button on your Cayenne dashboard via Add New > Device Widget > Custom Widgets. Assign it an unused MQTT channel."



    Question 2 years ago on Step 2

    how to open this file