Previous post was on controlling home devices using BLYNK CLOUD.
Instead of controlling manually we can use voice commands to operate devices.For this we use the GOOGLE ASSISTANT on mobile phone.
Google assistant cannot directly communicate with BLYNK. For making a chain link between Google assistant and Blynk we use IFTTT.
If This Then That, also known as IFTTT, is a free web-based service to create chains of simple conditional statements, called applets. An applet is triggered by changes that occur within other web services such as Gmail, Facebook, Telegram, Instagram,etc.
In this project we make use of WEBHOOKS on IFTTT to handle a web service , which is BLYNK.
The hardware setup is same as in previous post.
Create a new project on BLYNK.
Get the Authorized Token ID.
Create 2 button widgets , one for fan control and the other for light control.
Fan to be connected at digital pin D2 through relay board.
Light connected to digital pin D4 through relay board.
Once the settings on BLYNK application is completed we can close it.Need not be operated manually.
We shall use IFTTT to make a chain between Google assistant and Blynk.
Open IFTTT
Click on CREATE.
You see a + symbol before THIS.
Click on that.
Choose a service ,GOOGLE ASSISTANT
Choose a method to trigger , Say a simple phrase.
Next page is to complete trigger fields with options like what you want to say & what Google Assistant should reply.
Complete the fields for FAN ON control as shown below & click Create Trigger
Now you can see the GOOGLE ASSISTANT Logo at the THIS position.
Click on the + symbol before THAT
Search for WEBHOOKS and select it.
Then click on “ Make a WEB REQUEST”.
On next page you’ve to complete action fields.
Under URL, you need to provide the IP address of blynk-cloud.com
This can be achieved by opening Command prompt &
ping blynk-cloud.com
URL Format is
http://IP of blynk-cloud/auth id/update/digital pin
Authorized ID is the one you received in mail while creating your BLYNK project.
The digital pin to be controlled is that of Arduino. As we use NODEMCU hardware , check the pin out as below to select the correct digital pin.
For e,g we used D2 to connect Fan control.In NODEMCU pinout D2 is GPIO4 , so you need to input D4 .
Method to be selected is PUT
content type is : application/json
& the body is [“0”]
A 0 within double quotes & square brackets used to switch on the relay.As the 4 channel relay board we used is a LOW enabled ( LOW at input switches ON the relay) we need to feed 0 for ON.
Now the first APPLET is created and Connected.
Click on FINISH.
In the same way we need to create 3 more Applets for FAN OFF,LIGHT ON & LIGHT OFF.
Note that in Body you should send a 1 under double quotes & square brackets for switching OFF the relay.
Finally click on your account & MY APPLETS to see the applets you created.
Now open your Arduino IDE & under examples –> BLYNK –> BOARDS WIFI –> NODEMCU
Do the following modifications in code & upload to NODEMCU.
Finally install GOOGLE ASSISTANT from play store on your mobilr & open.
GOOGLE ASSISTANT will be running at the background.
You need to say OK GOOGLE or HEY GOOGLE to start the interaction.
Following is the screen shot on the commands given and the response from Google Assistant
Accordingly the devices will be made ON or OFF.
VIDEO