Software apps and online services
Hand tools and fabrication machines
In this IoT project, I have shown how to make an ESP01 Project using Blynk IFTTT to control a 2-channel relay module with the Google Assistant, and manual switch.
During the article, I have shown all the steps to make this Blynk home automation system.Tutorial Video on new Blynk ESP8266 ESP01 Project
This Blynk ESP8266 control smart relay has the following features:
- Control home appliances with Google Assistant.
- Control home appliances with the Blynk IoT app.
- Control home appliances with Blynk web dashboard.
- Control home appliances manually with push buttons.
- Monitor real-time feedback in the Blynk IoT App.
So, you can easily make this home automation project at home just by using an ESP01 and relay module. Or you can also use a custom-designed PCB for this project.Required Components for the PCB
- ESP01 ESP8266
- Relays 5v (SPDT) (2 no)
- BC547 Transistors (2 no)
- PC817 Optocuplors (2 no)
- 510-ohm 0.25-watt Resistor (2 no) (R1 -- R2)
- 1k 0.25-watt Resistors (3 no) (R3 -- R5)
- LED 5-mm (3 no)
- 1N4007 Diodes (2 no) (D1 -- D2)
- Push Buttons (3 no)
- Terminal Connectors
- Jumper (2no)
- Switch (1no)
- 5V DC supply
This is the complete circuit diagram for this home automation project. I have explained the circuit in the tutorial video.
The circuit is very simple, I have used GPIO-0 and GPIO-2 to control the 2 relays.
And the GPIO pins GPIO-3 and GPIO-1are connected with push buttons to control the 2 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.
After programming the ESP01 disconnect the GPIO-0 from the GND pin.Setup Blynk Cloud FREE Account
For this smart house project, I have used the Blynk IoT Cloud Free plan.
Click on the following link to create a Blynk Cloud account.
- Enter email ID, then click on "Sign Up".
- You will receive a verification email.
- Click on Create Password in the email, Then set the password, click on Next.
- Enter your first name, click on Done.
- After that Blynk cloud dashboard will open.
Then, you have to create a template in the Blynk cloud.
Steps to Create New Template for ESP8266
- Click on New Template.
- Enter a template name, select the hardware as ESP8266, and the connection type will WiFi.
- Then click on DONE.
You will get the BLYNK_TEMPLATE_ID and BLYNK_DEVICE_NAME after creating the temple.
The BLYNK_TEMPLATE_ID and BLYNK_DEVICE_NAME will be required while programming the ESP01 ESP8266.Create a Datastream in Blynk Cloud
After that, you have to create Datastreams. Here I will control 2 relays, so I have to create 2 Datastreams.
- Go to the Datastreams tab.
- Click on New Datastream and select Virtual Pin.
- Enter a name, select the virtual pin V1, and the datatype will be Integer.
- Then click on Create.
In a similar way, create the next datastreams with virtual pin V2.Set Up Blynk Cloud Web Dashboard
Now go to the web dashboard tab.
Drag and drop 2 Switch widgets.
Go to the settings of each widget, and select a Datastream.Install Blynk IoT App to Configure Mobile Dashboard
- Install the Blynk IoT app from Google Play Store or App Store. Then log in.
- Go to Developer Mode.
- Tap on the template that you have already made.
- Now go to the Widget box (on the right) to add widgets.
- Add 4 Button widgets from Widget Box.
- Go to Button widget settings.
- Enter the name, select Datastream, Mode will be Switch. Then exit.
- After setting all the Buttons tap on exit.
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.
You can download the PCB Gerber file of this home automation project from the following link:Order the PCB
After downloading the Garber file you can easily order the PCB
1. Visit https://jlcpcb.com 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 the JLCPCB
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 ESP01 board with the PCB.Program the ESP-01 With Arduino IDE
If you use the PCB, then you can easily go to program mode with a switch (PMOD) and directly connect the FTDI232 USB to serial interface board with ESP-01.
Otherwise, you refer to this circuit to program the ESP-01. During programming, the GPIO-0 and GND should be connected.Code for This ESP-01 Home Automation Project
First, download the code from the following link.
You have to keep all the 10 files in the same folder.
- Open the .ino file in Arduino IDE.
- In the code, you have to update the BLYNK_TEMPLATE_ID and BLYNK_DEVICE_NAME.
- For this project, you have to install the Blynk 1.0.1 library.
- Now select the "Generic ESP8266 Module" and proper PORT.
- Then upload the code to ESP01 Board.
After uploading the code, turn off the PMOD switch on the PCB and press the reset button.Update the WiFi Credentials Through OTA
After programming the ESP01, you have to update the WiFi credentials from the Blynk IoT app.
In the tutorial video, I have explained all the steps to update the WiFi credentials to ESP-01 through OTA.Testing the PCB
After the ESP-01 connects with the Blynk server, control the relay from the Blynk IoT app to test the PCB.
Now we will connect the Google Assistant with Blynk using IFTTT.
Create an IFTTT account, then log in.
In the FREE plan, you can create 5 Applets. To control each relay you need 2 Applets, so to control 2 relays you need 4 Applets.
For each applet, you have to define a trigger and related action. In this project, if you say any pre-define commands in Google assistant, then the related Webhook request will be sent to the Blynk Cloud server.Create Google Assistant Trigger for Applet in IFTTT
Steps to add Google Assistant Trigger in Applet
- Click on Create (on the top).
- Click on Add.
- Search for "Google Assistant" and click on it.
- Click on "Say a Simple phrase".
- Click on Connect and give the required permission.
- Then enter "What you want to say" and "response" for Google Assistant (as shown in the picture).
- Click on "Create trigger".
Here in the action, we will add Webhooks to send web requests to update the Datastream value in the Blynk server.
- Now click on the next Add button.
- Search for Webhooks and click on it.
- In Webhooks you have to mention the Blynk API URL.
Please refer to the following Blynk API URL syntax to update the Datastream value.
- fra1.blynk.cloud – Frankfurt
- lon1.blynk.cloud – London
- ny3.blynk.cloud – New York
- sgp1.blynk.cloud – Singapore
- blr1.blynk.cloud – Bangalore
The server region could be found in the right bottom corner of the web interface.
You can get the Auth Token from the Device Info tab. (Refer to tutorial video on top)
Now, enter the related Blynk URL to update the Datastream value. The method will be "GET". Keep other details as it is. (Refer to the picture)
- Click on Create Action.
- Click on Continue.
- Click on Finish.
Our first Applet is created. In a similar way, you have to create the next 3 Applets. Please refer to the tutorial video.Control Relays Using Blynk IoT App
If the ESP01 is connected with WiFi, then you can control the home appliances from Blynk IoT App.
You also use multiple smartphones to control the appliances with Blynk IoT App. For that, you have to log in same Blynk account from all the smartphones. In this way, all smartphones will be sink to the Blynk server.Control Relays With Google Assistant
You can also control the relay from Google Assistant with pre-defined voice commands.Control Relays Manually With Buttons
You can also control the relays from the pushbuttons.
If the ESP01 is connected with Wi-Fi then you can monitor the real-time feedback in the Blynk IoT App.
I hope you have liked this new Blynk home automation project. I have shared all the required information for this project.
I will really appreciate it if you share your valuable feedbacks. Also if you have any query please write in the comment section. Thank you & Happy Learning.