Hi guys, this is my first project on the Arduino project hub.
Thanks to this project you will be able to turn on or off the lights of your Christmas tree from Google Assistant. Follow me.
Firstly you have to connect all the devices as the schematic shows. After that we can proceed to configure the Blynk project.
Blynk project configurationMaybe you have already used Blynk many times, nevertheless I will repeat the first passages for those who don't know anything about it.
- Download Blynk app (from the App Store or from the Play Store)
- Create an account or log in if you already have one (you can also log in with your facebook account)
- create a new project (the auth token would be sent to the email with which you have signed in)
- Choose a name for your project, set as device Arduino Uno and as connection WiFi
- then just tap on the screen and a menu with some options will appear on the left. Choose text input box and drag it wherever you want
- tap on the text input box you see on the screen and something like this will appear
- Set as title what you prefer. Write "V0" as PIN, don't put anything in the input value box, and set character limit to 20.
Blynk configuration is now finished.
IFTTT configuration- download Ifttt app
- log in as you prefer
- tap on "create"
- tap on "If This add" and search for google assistant
- tap on it and then select "Say a phrase with text ingredient" (the first option)
- Under the "What do you want to say?" I have written "Google turn $ the lights" (the $ mark is the text ingredient)
- if you want you can choose other ways to say the same phrase (the text ingredient must be always the same)
- and then choose the answer google will give you
- now choose the language (this tutorial is in english so I have chosen english)
- tap on create trigger
- tap on "Then That Add"
- Search for webhooks
- tap on it
- choose the unique option
- Open command prompt on your PC with active Internet connection and type following command: ping blynk-cloud.com. Note down the IP address which looks something like this: 188.166.206.43. It is the IP address of blynk server for your country.
- in the url you have to put this link: http://ip address from previous passage/Your auth token of the blynk project/pin/V0
- Set method to put
- Set content type to application/json
- put this into the "Body field": ["{{TextField}}"]
- tap on create action
- tap on continue
- Choose a title
- tap on finish
- tap on the X on the top left corner
Ifttt configuration is finished
Important things about the codeThese lines of code are pretty important
if(s=="on")
else if(s=="off")
If you change the phrase (and so the text ingredient) you have to change also these values: you have to put the turning on text ingredient where now is written on and the turning off text ingredient where now is written off. I will write an example to explain better myself:
I decide to choose this phrase: "I am $".
The text ingredient will be "happy" to turn on the lights, "sad" to turn off them.
So in the code I will write this.
if(s=="happy")
else if(s=="sad")
ConclusionUpload the code on the Arduino UNO, start blynk project, open google assistant, say the phrase and see if it works
Comments