The project is mostly concerned with the automation of LED using the google assistance.The key feature is to operate an LED by giving voice commands and accordingly the LED will operate.Reason behind building
I saw a video on youtube about this that the devices can be voice controlled.i.e when we say ON they are turned on and something like that so I was very much excited having watched the videos about this Thus I thought of building one for myself. So it starts with a simple Led.CONSTRUCTION and WORKING(A) CONSTRUCTIONHARDWARE CONNECTIONSStep 1
Get your bolt wifi module and a LED, insert the positive terminal of the LED to the "A0" pin of the module and the negative terminal to the "ground". As shown in the figure given below.
After doing the connections power on your Bolt module and allow it to connect with the local internet network(green light will glow when connected)SOFTWARE CODE
There is no such hardcore code to be written anywhere required just follow these steps:-Step 1
Get your bolt API key and the device ID.To get the API key, simply login to your bolt cloud account and on the left go the the API section there you will find your API key, its a long Alphanumeric value. If its not present overthere so go on to generate option so your API will be generated in no time.NOTE this down
For device id, its over there only something like BOLTXXXXXStep 2
In Bolt Cloud go to Docs Tab -> API Documentation -> GPIO Commands API -> Write Digital OutputThe command to turn the light on is:
and for turning off the light is :
Make sure that you change the API Key to your own API Key and device ID which you got in the previous step.If you have connected the LED to any other pin other then Pin 0 then make a suitable change in the pin no in your code.
Just write these two lines somewhere and save it. they will be useful in further steps.Step 3
Go to IFTTT to create a new applet
Click on '+This'
Choose Google Assistant -> Say Specific Phrase
Type the phrase you want to trigger the action. Make sure to specify the trigger command in different ways for example I used
" light the room"
Response : As your wish master
Click on 'Create Trigger'
Click on '+That'
Select Webhooks and then Make a web requestEnter 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
Here is how your screen will look like
Click on 'Create Action' and then Click on 'Finish'
Now do the same process for a command to switch off the LED. Here you will use the second line which we have written, the only change is the state to LOW i.e. state=LOW in your code.
The phrases which I used:
Turn off the Lights
Response - As your wish master
Thats it we are all set.Now open your google assistance and give the commands and see the magic.