Blynk Home Automation With Multiple ESP32 NodeMCU IoT Projects 2021
by techstudycell in Circuits > Microcontrollers
2439 Views, 7 Favorites, 0 Comments
Blynk Home Automation With Multiple ESP32 NodeMCU IoT Projects 2021
In this IoT project, I have shown how to make IoT-based Smart Home Automation using Multiple NodeMCU ESP32 network to control all the home appliances from the switches & Blynk App. If the internet is not available, then you can control the home appliances from manual switches. During the article, I have shown all the steps to make this smart home system.
This complete Home Automation system has the following features:
- Connect multiple ESP32 and NodeMCUs with the same Blynk account.
- Control home appliances with WiFi (Blynk App)
- Control home appliances with manual switches.
- Monitor real-time feedback in the Blynk App.
- Control home appliances manually without internet.
- You can connect any number of microcontrollers in this IoT network as per the requirements.
For each room, you just need a relay module & a microcontroller like ESP32 or NodeMCU to make this smart home project.
Supplies
- NodeMCU or ESP32
- Relays 5v (SPDT) (4 no)
- BC547 Transistors (4 no)
- PC817 Optocuplors (4 no)
- 510-ohm 0.25-watt Resistor (4 no) (R1 - R4)
- 1k 0.25-watt Resistors (5 no) (R5 - R9)
- LED 5-mm (5 no)
- 1N4007 Diodes (5 no) (D1 - D5)
- Push Buttons (4 no) or Switches
- Terminal Connectors
- 5V DC supply
Circuit Diagram of the ESP32 Control Relays
The circuit is very simple, I have used the GPIO pins D23, D22, D21 & D19 to control the 4 relays.
And the GPIO pins D13, D12, D14 & D27 connected with switches to control the 4 relays manually.
I have used the INPUT_PULLUP function in Arduino IDE instead of using the pull-up resistors.
I have used a 5V mobile charger to supply the smart relay module.
Please take proper safety precautions while working with high voltage.
Circuit Diagram of the NodeMCU Control Relays
This is also a very simple circuit, I have used the GPIO pins D1, D2, D5 & D6 to control the 4 relays.
And the GPIO pins SD3, D3, D7 & RX connected with switches to control the 4 relays manually.
I have used the INPUT_PULLUP function in Arduino IDE instead of using the pull-up resistors. I have used a 5V mobile charger to supply the smart relay module.
Please take proper safety precautions while working with high voltage.
Multiple ESP32 NodeMCU ESP8266 Network
Now if you have multiple rooms, then you can use either ESP32 or NodeMCU for each room and then repeat the same circuit for each room.
If you use ESP32 then you can use either a 4-channel or 8-channel relay module, but for the NodeMCU you have to use the 4-channel relay module.
There is no limitation on the number of ESP32 or NodeMCUs that can be connected. All microcontrollers will connect to the Blynk server using the same Authenticate Token.
So we can control each NodeMCU or ESP32 independently from Blynk App.
Control Relays With Internet Using Blynk
If the ESP32 or NodeMCUs are connected with the WiFi, then you can control the home appliances from Blynk App.
You also use multiple smartphones to control the appliances with Blynk App. For that, you have to login same Blynk account from all the smartphones. In this way, all smartphones will be sink to the Blynk server.
You can control, monitor the real-time status of the relays from anywhere in the world with the Blynk App.
Control Relays Manually With Switches
You can always control the appliances manually with switches.
If the WiFi connected. then you can also monitor the relay time status of each switch in the Blynk App.
Controlling Relays Without WiFi
If the WiFi is not available, you can control the relays from the switches.
The NodeMCU will check for the WiFi after every 3 seconds. When the WiFi is available, the ESP32 or NodeMCU will automatically connect with the WiFi.
Configure the Blynk App for the Multiple ESP32 & NodeMCUs
1. Install the Blynk App from the Google play store or App store. Then create an account.
2. Sign In and Tap on the New Project.
3. Give the name to the project, select NodeMCU, Connection type will be WiFi. Then tap on Create.
4. Blynk will send an authentication token to the registered email id. Tap on OK.
**As we will use only virtual pins in this Blynk project, so we can control both ESP32 and NodeMCU with this Blynk project.
Add the Button Widgets in Blynk App to Control Relays
Then add 8 button widgets from the Widget Box to control the 8 relays.
Create buttons with V1, V2, V3, V4, V5, V6, V7, V8 pins to control the relays.
Select the Mode as Switch for all the buttons.
**Here I have used an active low Relay module, so to turn ON the relay we have to send “0” and “1” to turn OFF the relay.
I have used virtual pins V1, V2, V3, V4 to control the first relay module with ESP32 (Room-1).
And V5, V6, V7, V8 to control the second relay module with NodeMCU (Room-2)
I have explained all the details in the tutorial video.
Code for Blynk NodeMCU & ESP32 Home Automation
In the Tutorial video, I have explained all the steps to program the NodeMCU and ESP32 using Arduino IDE.
Before uploading the code you have to install the following boards in Arduino IDE
- ESP8266 Board
- ESP32 Board
Then install the following libraries
- Blynk Library
- AceButton Library
I have mentioned all the download links in the code.
Then enter the WiFi name, WiFi password & Blynk Auth Token in the code.
Enter the following WiFi credential and Authentication token in the code:
- WiFi Name at “WiFi Name”
- WiFi Password at “WiFi Password”
- Auth Token sent by Blynk at “AUTH TOKEN“
To program NodeMCU select the “NodeMCU 1.0 ESP-12E” board and proper PORT. Then click on the upload button.
To program ESP32, select the “DOIT ESP32 DEVKIT V1” board and proper PORT. Then click on the upload button.
For each NodeMCU or ESP32, you have to change the virtual pins in the code. For the ESP32, virtual pins will be V1, V2, V3, V4. And for the NodeMCU, virtual pins will be V5, V6, V7, V8.
And while programming, please don't connect both microcontrollers with the laptop at the same time.
PCBs for This Home Automation Project
As I said, you can make this smart home system just by using the Relay module and ESP32 or NodeMCU.
But to make the circuit compact and give the project a professional look, you can use the PCBs for this project.
Designing the PCB
To make the circuit compact and give a professional look, I have designed the PCB after testing all the features of the smart relay module on the breadboard.
You can download the PCB Gerber file of this home automation project from the following link: https://drive.google.com/uc?export=download&id=1Jx4D_DSV_ei1y0a82AbtxbsNhy8sjCmY
Order the PCB
After downloading the Garber file you can easily order the PCB
1. Visit https://jlcpcb.com/RHS and Sign in / Sign up
2. Click on the QUOTE NOW button.
3 Click on the "Add your Gerber file" button. Then browse and select the Gerber file you have downloaded.
Uploading the Gerber File and Set the Parameters
4. Set the required parameter like Quantity, PCB masking color, etc
5. After selecting all the Parameters for PCB click on SAVE TO CART button.
Select Shipping Address and Payment Mode
6. Type the Shipping Address.
7. Select the Shipping Method suitable for you.
8. Submit the order and proceed with the payment.
You can also track your order from JLCPCB.com. My PCBs took 2 days to get manufactured and arrived within a week using the DHL delivery option.
PCBs were well packed and the quality was really good at this affordable price.
Solder All the Components on PCB
After that, I have soldered all the components as per the circuit diagram.
Then connect the NodeMCU board with the PCB.
Control Applicances With Blynk App
Here I have used the ESP32 for room-1 and NodeMCUs for room-2 to control appliances for 2 rooms.
If you have 3-rooms, then you add one more ESP32 or NodeMCU in the IoT network.
Thus, you can connect multiple NodeMCU and ESP32 as per your requirement.
Finally!!
Now you can control all the home appliances in a smart way.
I hope you have liked this home automation project. I have shared all the required information for this project. I will really appreciate it if you share your valuable feedback. Also if you have any query please write in the comment section. Thank you & Happy Learning.