This project is about how to control a buzzer through google assistant and IFTTT with the help of Bolt IoT. I recently joined a course for Internet of Things (IoT) and to my surprise it quickly took hold off me, I mean its such a fascinating subject that lets you play with so many tech related objects and subjects. And suddenly u want to become a tech geek. So here I am now, with my 1st project. It is basically a small step from me before I dive deep into this s**t!
- So, well here is a short video of how it may look like.
Plug the negative terminal (shorter end) of the buzzer to the ground of bolt and positive terminal (longer end) to any one of the GPIO pin using male to female wire and power on the bolt module by connecting it to any power source using a USB cable as shown in image below.(In this case I have used pin number 1)
Login to https://cloud.boltiot.com. And if you haven't generated API key click on generate API key and make sure to enable it then copy and paste it somewhere safely your API key may look like this :- 2fe9a5a8-4987-498f-9d43-2a086d1eb372
you can see your code by clicking on the API option on the left side of your bar then you click on the eye option to see your code (first click on the enable option to enable your API key) just right to the the eye option you get an option for copying your API key to desired location.And You will be able to find your bolt ID easily on the dashboard it may look like it :- BOLT1234567 copy it too.
Step 3: Creating Your Control URLWe will be using analogWrite command in this if you want to see the documentation for this command you can visit: https://docs.boltiot.com/docs/write-analog-output-pwm
The structure of the command is like this:
https://cloud.boltiot.com/remote/API_KEY/analogWrite?pin=PIN_NUMBER&value=0-1023&deviceName=DEVICE_ID
NOTE: You will have to put your bolt API key which you have generated in the previous step in place of API_KEY, in place of PIN_NUMBER you will have to write the GPIO pin number in which you have connected the positive terminal of your buzzer, in value you will have to provide any one value which will decide the frequency of the sound of buzzer ranging from 0-1023 where 0means buzzer off no sound and 1023 is the maximum frequency at which it can buzz and finally in place of DEVICE_ID you will have to put device id of your bolt wifi module which you got in the previous step.
Final URL may look like this :-https://cloud.boltiot.com/remote/2fe9a5a8-4987-498f-9d43-2a086d1eb372/analogWrite?pin=1&value=245&deviceName=BOLT5845987
(Don't directly copy this, as it is my own generated URL yours might be different)
You can even click on your URL by changing value each time in your URL and the buzzer will buzz each time in accordance with the value which you have provided.
Step 4: Setting Your IFTTT AccountGo to ifttt.com by clicking this URL :- https://ifttt.com. Create your account on it and then click on create new applet or use this URL :- https://ifttt.com/create
Login using your Gmail account. Make sure you use same account which you'll be using on your mobile to interact with Google Assistant.
Click on '+This' to create the trigger.
Choose Google Assistant -> Say Specific Phrase..
1 / 2
Type the phrase you want to trigger the action. Make sure to specify the trigger command in different ways for example I used.
a) Turn on buzzer.
b) Make it buzz
c) Make the buzzer buzz
Or anything else you like then click on Create Trigger.
Now click on '+That'.
Select Webhooks and then Make a web request.
1 / 2
Enter the API URL you got in the previous Step. Make sure that you change the API Key and device name.
Method will be GET.
Content type will be Application/json.
This how your screen may look like:
Click on 'Create Action' and then Click on 'Finish'.
Now that you have learned how to set the buzzer on you can be quite creative repeat the step 4 again and in the make changes in the value of URL tbo any number between 0-1023.
Now what you have to do is repeat the same above steps with a bit of changes in it like:
1. Go back to the third step, change the value (i.e buzzer frequency) to zero and copy that URL.
2. Repeat the following steps again then change the phrases of step 4 to
a) Turn off buzzer
b)stop buzzing
etc..... And then click trigger and go ahead as you have done previously.
3. In webhook you paste the now copied URL and then go as usual and finish the remaining procedures.
NOTE: If you will set the value to 0 the buzzer will turn off also if you will write any number more than 1023 the buzzer will not buzz.
HURRAY!! YOU'RE DONE NOW
Now wake your Android phone by saying "OK Google" and say the phrase you had set while creating the trigger to see the magic happen.
Hope you enjoy it.
Thank you and have a good productive day.
Comments
Please log in or sign up to comment.