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.

 

title

 

Create a new project on BLYNK.

 

2020_01_03_15.08.34

Get the Authorized Token ID.

2020_01_03_15.08.39

Create 2 button widgets , one for fan control and the other for light control.

 

2020_01_03_15.06.29

Fan to be connected at digital pin D2 through relay board.

2020_01_03_15.06.38

Light connected to digital pin D4 through relay board.

2020_01_03_15.06.43

 

2020_01_03_15.06.52

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

 

 

Image 4

 

Click on CREATE.

 

Image 7

You see a + symbol before THIS.

Click on that.

Image 8

Choose a service ,GOOGLE ASSISTANT

Image 9

Choose a method to trigger , Say a simple phrase.

Image 10

Next page is to complete trigger fields with options like what you want to say & what Google Assistant should reply.

Image 11

 

Complete the fields for FAN ON control as shown below & click Create Trigger

 

Image 13

 

Now you can see the GOOGLE ASSISTANT Logo at the THIS position.

Click on the + symbol before THAT

 

 

Image 15

Search for WEBHOOKS and select it.

Image 16

Then click on “ Make a WEB REQUEST”.

Image 17

On next page you’ve to complete action fields.

Image 18

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

 

Image 2

 

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 .

Image 12

 

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.

Image 19

 

Now the first APPLET is created and Connected.

 

Image 20

Click on FINISH.

Image 21

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.

Image 22

 

Image 23

 

Image 24

 

 

Image 26

 

Finally click on your account & MY APPLETS to see the applets you created.

Image 29

Image 28

 

Now open your Arduino IDE & under examples –> BLYNK –>  BOARDS WIFI –> NODEMCU

Do the following modifications in code & upload to NODEMCU.

 

Image 14

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.

2020_01_03_16.25.10

 

 

IMG_20200103_145849

VIDEO

 

blog_image