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

vlcsnap-2021-04-06-10h47m28s170.png
thumb _website.jpg
vlcsnap-2021-01-17-19h59m11s931.png
vlcsnap-2021-04-06-11h23m39s309.png
Smart Home Automation System with multiple ESP32 NodeMCU IoT network with Blynk | 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:

  1. Connect multiple ESP32 and NodeMCUs with the same Blynk account.
  2. Control home appliances with WiFi (Blynk App)
  3. Control home appliances with manual switches.
  4. Monitor real-time feedback in the Blynk App.
  5. Control home appliances manually without internet.
  6. 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

  1. NodeMCU or ESP32
  2. Relays 5v (SPDT) (4 no)
  3. BC547 Transistors (4 no)
  4. PC817 Optocuplors (4 no)
  5. 510-ohm 0.25-watt Resistor (4 no) (R1 - R4)
  6. 1k 0.25-watt Resistors (5 no) (R5 - R9)
  7. LED 5-mm (5 no)
  8. 1N4007 Diodes (5 no) (D1 - D5)
  9. Push Buttons (4 no) or Switches
  10. Terminal Connectors
  11. 5V DC supply

Circuit Diagram of the ESP32 Control Relays

circuit1.jpg

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

circuit2.jpg

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

vlcsnapccccc.jpg

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

vlcsnap-2021-04-06-10h56m03s854.png
vlcsnap-2021-04-06-11h27m25s352.png
vlcsnap-2021-04-06-11h03m19s570.png

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

vlcsnap-2021-04-06-10h48m25s037.png
vlcsnap-2021-04-06-10h48m43s370.png
vlcsnap-2021-04-06-11h27m43s918.png

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

vlcsnap-2021-04-06-10h50m41s221.png
vlcsnap-2021-04-06-11h23m08s250.png

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

Multiple NodeMCU_22MAR2021 PIC 1.jpg

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

Multiple NodeMCU_22MAR2021 PIC 2.jpg

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

vlcsnap-2021-04-06-11h26m04s739.png
dgdggdrggddrVWY7M.png
vlcsnap-2021-04-06-11h26m40s058.png

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

  1. ESP8266 Board
  2. ESP32 Board

Then install the following libraries

  1. Blynk Library
  2. 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

vlcsnap-2021-04-06-11h25m35s244.png
vlcsnap-2021-04-06-10h54m51s825.png

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

vlcsnap-2021-01-17-19h58m26s121.png
vlcsnap-2021-01-17-19h58m40s950.png
vlcsnap-2021-01-17-19h58m50s543.png

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

JLC PCB_Pic 1.jpg
JLC PCB_Pic 2.jpg

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

jlc pcb pic 2.2.png
JLC PCB_Pic 3.jpg

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

FPR02XCKL1ddCQAUS.jpg
F637WIQKL1ddCQAUR.jpg
IMG20210109165955_01.jpg

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

vlcsnap-2021-01-17-19h59m20s552.png
vlcsnap-2021-01-17-19h59m26s786.png
vlcsnap-2021-01-17-19h59m32s188.png

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

vlcsnap-2021-04-06-11h21m56s134.png

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!!

IMG20210404073402.jpg
vlcsnap-2021-04-06-10h51m47s670.png
vlcsnap-2021-04-06-11h04m01s457.png
vlcsnap-2021-04-06-11h22m41s731.png

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.