In our last tutorial, we learned the basics of relay and its control via a webpage using NodeMCU. There we used basic web server principles, where NodeMCU acted as a web server, and the web page hosted there helped us communicate with the ports to switch relay, thereby switching devices on/off. But there, you need to do a lot of coding and be on the same network to access the local server page, which means it’s time-consuming and you can’t control devices from anywhere. There comes a handy utility to rescue called Blynk, which opens the doors to the IoT world and supports a plethora of devices and platforms. Using it, without much coding and via a simple interface, we are able to do home automation using NodeMCU.
So, let us move one step ahead and utilize Blynk’s capabilities. Believe me, achieving things with Blynk is super easy as opposed to the earlier method. Blynk app is free to use with 1800 free recyclable energy with each account, which is more than sufficient for general projects or there is unlimited energy if the local server is used. Energy is used by each widget you add to the project. You can always purchase more energy for bigger projects or recycle used ones.
BLYNK + NODEMCU ESP8266 + RELAY BOARD = DIY HOME AUTOMATION
Things Required
- NodeMCU board
- Micro USB cable + power supply (any mobile charger or laptop USB port will work)
- Arduino IDE with ESP8266 board definitions & drivers installed
- Blynk software installed on your smartphone
- Relay Module (up to 9 relays can be operated using one NodeMCU, I am using 4 channel relay module)
- AC/DC bulb, fan, etc, to control using the relay (optional)
- Breadboard *
- Jumper cables, Male to Female M-F, Female to Female F-F *
* You can connect NodeMCU to Relay board via breadboard using M-F jumper cables or you may skip breadboard and directly connect relay & NodeMCU using F-F jumper cables.
HARDWARE SETUP (with NodeMCU)
Hopefully you have already set up NodeMCU with Arduino. If not you can refer to my review for NodeMCU where I have detailed every step. Now proceeding with steps to connect relay to NodeMCU.
1. Connect GND of relay board to GND of NodeMCU.
2. Connect IN1-IN4 to GPIO’s (D0 to D8). Suppose it’s like IN1-D1, IN2-D2, IN3-D3, IN4-D5.
3. With jumper on VCC/JD-VCC, connect board’s VCC to VIN of NodeMCU (to provide direct 5V supply coming from USB port).
4. Connect AC load on relays NO circuit i.e. phase to each of relay connectors mid terminal and wire from load (e.g. light, fan etc) to left NO terminal (Be careful while dealing with AC)
5. Other ground wire of AC supply goes directly to load.
6. You can also have manual switch parallel to NO circuit for manual on/off.
SOFTWARE SETUP
- Steps for the initial setup of the NodeMCU board with Arduino IDE can be found here.
- Install the Blynk app from the app store & register.
Google Play Store | Apple App Store - Create project. Auth token will automatically be sent on email or can manually email from project settings.
- Download the library zip from here.
- Install Blynk library manually by copying unzipped folders as per mentioned paths on the website for the sketchbook folder of Arduino IDE.
- After libraries are installed, another entry with Blynk is created in examples. (Pic attached)
- Open Arduino IDE & Go to → File → Examples → Blynk → Boards_WiFi → ESP8266_Standalone.
- Enter auth token of Blynk project, said, and password of your Wi-Fi network in the sketch.
- Upload sketch to board.
- Now in the app add 4 buttons to the project created above, by clicking on + and selecting buttons.
- Open each button, name them as per load (e.g. fan1, fan2, overhead light, night lamp), and specify D1, D2, D3, D5 pin with 1 → 0. (Since the relay is active low)
- Click on the Play button on top.
- Press buttons to control the load from anywhere using mobile.
- Enjoy the endless world of IoT and automation. Control everything wirelessly from your smartphone via the Blynk server or local server.
A few other things to try:
Setup Arduino for NodeMCU programming
Interface With Relay (for controlling AC/DC devices)
… [Trackback]
[…] Information on that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Find More on that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Information on that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Read More on on that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Here you can find 34534 additional Info on that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Find More to that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Read More Information here on that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Information on that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Read More Information here on that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Here you will find 88374 additional Info to that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Find More Info here on that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Read More here on that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Read More Information here on that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Find More to that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Read More Information here on that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Info to that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Here you can find 1268 additional Info to that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] There you can find 49981 additional Information on that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Find More Information here to that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
relax everyday
… [Trackback]
[…] Here you can find 48690 more Information on that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Here you will find 7812 more Information to that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Find More on that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
night music relax
relaxing music
soothing music
study music
japanese type beat
bird chirping
Trap \Bass Japanese Type Beat
yoga music
piano music
soft music
… [Trackback]
[…] Read More Information here on that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
relax music
… [Trackback]
[…] Read More Information here on that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
… [Trackback]
[…] Find More Info here on that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
music for stress relief
motivation song
calming music
winter
study music
study music
spa music
… [Trackback]
[…] Information to that Topic: abstractotech.com/home-automation-using-nodemcu-blynk-based/ […]
soft jazz
calm music
stress relief
piano music
piano music
relax
relaxing piano music