Home Automation using NodeMCU ESP8266 and Blynk 2.0(IOT)

 Hello! guys,let us develop another real life project today. we are about to control any of our home electronics,lighting and power system with our  smart phone . We are using a diffrent micro controller with wifi module called NodeMCU ESP8266 to hook up all our connection to cloud . In addition, we are using Blynk 2.0 as our mobile app to control all the embeded system from our smart phones.

THE WORK FLOW IS AS FOLLOWING:

CODE<------>NodeMCU ESP8266<---->CLOUD<---->BLYNK2.0<------>RELAYS<-->LOADS<--->CODE



Home automation



Circuit of the Blynk NodeMCU Home Automation projects

NodeMCU home automation circuit

The circuit is very simple, I have used D1, D2, D5 & D6 GPIO pins to control the 4-channel relay module.

And the GPIO SD3, D3, D7 & RX are connected with the switches to control the relay module manually.

I have used the INPUT_PULLUP function in Arduino IDE instead of using the pull-up resistors with each switch.

As per the source code, when the control pins of the relay module receive the LOW signal the respective relay will turn on and the relay will turn off for the HIGH signal in the control pin.

**The Boot will fail if SD3 and D3 are grounded during the Boot process. So manual switch-S1 and switch-S2 must be OFF during NodeMCU Boot.

Now, if you want to use pushbuttons then just connect the pushbuttons across the GPIO pins and GND pin instead of switches.

I have used a 5V 5Amp power supply to supply the NodeMCU and relay module.

Required Components for the NodeMCU projects

Required components
  1. NodeMCU X 1
  2. 4-channel 5V SPDT Relay Module X 1
  3. Pushbuttons or Switches X 4




  • Create an account at Blynk IoT Cloud.
  • Create a template for ESP8266 in Blynk IoT Cloud.
  • Set up Blynk Cloud Web Dashboard.
  • Install and set up Blynk IoT App in mobile.
  • Program the NodeMCU with Arduino IDE
  • Update the Wi-Fi credentials to ESP8266 through OTA.
  • Control relays with Blynk IoT app from mobile.

You can also manually control the appliances from the switches or pushbuttons. If the NodeMCU is connected with Wi-Fi then it will send real-time feedback to the Blynk IoT server.

Blynk IoT Cloud setup

Please refer to the following article for the Blynk IoT Cloud account setup.

Getting started with New Blynk 2.0 IoT platform

https://iotcircuithub.com/blynk-iot-platform-setup-esp8266-esp32/

Program NodeMCU with Arduino IDE

In the Tutorial video, I have explained all the steps to program the NodeMCU using Arduino IDE.

  1. Update the Preferences –> Aditional boards Manager URLs: https://dl.espressif.com/dl/package_esp32_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json
  2. Then install the ESP8266 board from the Board manager or Click Here to download the ESP8266 board.
  3. Install all the required libraries in Arduino IDE:
    • Install the Blynk library from Include Library or Click Here to download.
blynk

Go to Sketch -> Include Libraries -> Manage Libraries in Arduino IDE.

When you try to install the Blynk library, it may ask you to install all the dependencies. Then Click on Install All.


Code for Blynk IoT Cloud ESP8266 home automation

Code_NodeMCU_Blynk2_4Relay_Button_NEW


After downloading the code, you will get total 10 files. ( 1 .ino & 9 .h files). You have to keep all these files in the same folder.

Then open the .ino file in Arduino IDE, select the NodeMCU 1.0 board then compile the code. If you have downloaded all the required libraries then you should not get any errors.

In code, you have to update only the BLYNK_TEMPLATE_ID BLYNK_DEVICE_NAME as shown in the video. You don’t have to enter the W-Fi credentials in the code.

update BLYNK_TEMPLATE_ID

You need to change this links to the one on your IOT cloud.

just copy and past it into your code.

Now upload the code to NodeMCU using USB cable connect to your computer.




Connect the home appliances with the relay module as per the circuit diagram.

Please take proper safety precautions, while working with high voltage.

Now, turn on the 5V DC supply and 110V/220V AC supply.

Finally, the ESP32 Smart Home System is ready

I hope you like this Smart house IoT projects idea with the new Blynk 2.0 IoT Cloud and NodeMCU ESP8266.


About Me


Akinpelu Abiodun


I am Akinpelu Abiodun Moses by name. I am a programmer and a graphics designer.
Follow my google website link to know more about me:


Popular Post

  • Wifi hacking with python
  • Complete html,css and javascript web page
  • Facebook login and sign up form with html,css and javascript 
  • Resturant,college,hostital and pharmercy store management system with python
  • online shopping website with html,css and javascript 
  • Text to speech app with html,css and javascript 
  • Online text editor with html,css and javascript 
  • Quiz app with html,css and javascript 
  • To -do app with html,css and javascript 
  • Traffic ligth project
  • Home automation
You can contact me for there source code on my website:


Comments

Post a Comment