Introduction: IOT Home Automation DIY Project #1

About: I am electronics engineer Like making and learning electronics stuffs


Home automation is the automation process of home appliances like AC , Fan , Refrigerator , lights and the list goes on, so that they can be controlled with your phone, computer, or even remotely. This project deals with the esp2866 nodeMCU to control the appliances of our home through our WiFi network.

Step 1: Components Used

ESP 2866 NodeMCU

2. 5V dc source / Arduino UNO for 5V source

3. DHT11 sensor

4. Electric Bulb

5. 5V Relay Module

6. Breadboard

7. Jumper Wires (male-female & male-male)

8. Smartphone with Blynk app installed

9. WiFi network .

Step 2: Description

1. The NodeMCU (Node MicroController Unit) is an open source software and hardware development environment that is built around a very inexpensive System-on-a-Chip (SoC) called the ESP8266.

ESP8266 is a low-cost, WiFi Module chip that can be configured to connect to the Internet for Internet of Things(IoT) and similar Technology Projects.
Basically, Your normal Electrical and Mechanical equipments cannot connect to the Internet on their own. They don’t have the in-built setup to do so.

You can set up ESP8266 with these equipments and do amazing stuff. Controlling, Monitoring, Analysis and much more.
ESP8266 NodeMCU has 17 GPIO pins which can be assigned to various functions such as I2C, I2S, UART, PWM, IR Remote Control, LED Light and Button programmatically. Each digital enabled GPIO can be configured as high or low. For more details refer to


Step 3: a Relay

is an electrically operated switch that can be turned on or off, letting the current go through or not, and can be controlled with low voltages, like the 5V provided by the Arduino pins.

The following figure shows the relay module pinout The 3 pins on the left side of the relay module connect high voltage, and the pins on the right side connect the component that requires low voltage—the Arduino pins.

The high-voltage side has two connectors, each with three sockets: common (COM), normally closed (NC), and normally open (NO).

1. COM: common pin

2. NC (Normally Closed): the normally closed configuration is used when you want the relay to be closed by default, meaning the current is flowing unless you send a signal from the Arduino to the relay module to open the circuit and stop the current.

3. NO (Normally Open): the normally open configuration works the other way around: the relay is always open, so the circuit is broken unless you send a signal from the Arduino to close the circuit.

The connections between the relay module and the NodeMCU are really simple:

1. GND: goes to ground

2. IN: controls the relay (it will be connected to a nodeMCU digital pin)

3. VCC: goes to 5V

Here, we give this 5V and GND pin of relay is connected to the arduino 5V and GND pin respectively and the GND pin of arduino is common with the GND pin of NodeMCU.

Before proceeding with this project, I want to let you know that you’re dealing with mains voltage. So, kindly see the connection properly before switching it on.
Pins & connection description :

1. Green wire is connecting the D2 pin of nodeMCU to the i/p of relay

2. The Red and Yellow wires are connecting 5V and GND to the VCC and GND of Relay respectively.

Now to connect the load (in this case the Bulb) . At first cut the live wire of the bulb or lamp . Now connect the first end i.e goes to mains supply to the NO pin (if you occasionally want to switch on the lamp/bulb ) and the other end of the live wire going to the bulb , to the COM pin of the Relay. Kindly find the connection below.

Step 4: DHT11 Sensor

Used to sense the temperature and humidity of the working place in this case room, of the sensor.

For more details refer

Connection of DHT11 is as follows
Connect the VCC and GND pins of the sensor to the 3.3V and GND pins of nodeMCU respectively and the data pin to the D4 in this well you can use any of the GPIO pins in this project discussed so far .Kind refer to the following image :

Here, the Red and Green wires are connecting the 3.3V and GND pins of nodeMCU with the VCC (+) and GND (-) pin of the DHT11 sensor respectively.

Step 5: The Blynk App

Blynk is a new platform that allows you to quickly build interfaces for controlling and monitoring your hardware projects from your iOS and Android device. After downloading the Blynk app, you can create a project dashboard and arrange buttons, sliders, graphs, and other widgets onto the screen.

To get started with blynk follow the link below .

For more details refer

Step 6: Circuit Diagram

Step 7: Code