Ever since, JARVIS the Virtual AI of Iron Man is known, the demand to have a own personal assistant has increased. With this project I've made a simple device which will take voice command from the user to Turn the Lights ON and OFF.
This project gives us power to control home automation from anywhere in the home. The only things we need is phone and a internet.
Step 1: Hardware SetupTake the LED and Bolt WiFi Module.The two end of the LED one is long which is the +ve end and second is short which is the -ve end. Take +ve end and insert it into pin 0 and the -ve end into ground pin i.e. GND of Bolt.
Step 2: Bolt API Key and Device IDLog in to your Bolt Cloud account. In the dashboard, you can find your device ID.
Device ID
Now click on the 'API Tab' and under the section for 'Generate Key, ' click on 'Enable.'
Note down both of them in a separate space for future use.
Step 3: Creating the GPIO control commandSince, the LED is a digital output device, we will need to Write a Digital command that can be sent to Bolt Cloud over the Internet to turn ON the LED.
Click here to go to Bolt Cloud. Under that go to Docs Tab -> API Documentation -> GPIO Commands API -> Write Digital Output, to understand how to create a API command link to turn ON or turn OFF a pin of the Bolt.
The structure of the command is:
https://cloud.boltiot.com/remote/API_KEY/digitalWrite?pin=PIN_NUMBER&state=HIGH/LOW&deviceName=DEVICE_ID
The parameters that you need to replace are:
API_KEY: You can get it from API tab on cloud dashboard.
PIN_NUMBER: Pin to which you have connected the LED. Values can be either 0, 1, 2, 3 or 4
HIGH/LOW: This value indicates if you want to turn on/off the LED. HIGH will turn it ON, LOW will turn it OFF.
DEVICE_ID: The id of your device. You can get it from cloud dashboard.
The sample command to turn the led ON connected to device having ID BOLT***** to PIN 0 is:
https://cloud.boltiot.com/remote/API_KEY/digitalWrite?pin=0&state=HIGH&deviceName=BOLT*****
Step 4: IFTTT integration with Google Assistant and WebhooksLogin using your Gmail account. Make sure you use the same account which you'll be using on your mobile to interact with the Google Assistant.
Go to IFTTT to create a new applet.
Choose Google Assistant -> Say a Simple Phrase
Enter the phrase that you want to trigger the action. Make sure to specify the trigger command in different ways. For example:
Click on 'Create Trigger'
Now, click on '+That'
Type Webhooks in the search bar and then make a web request.
Enter the API URL you got in the previous step. Make sure that you change the API Key and device name.
Set 'Method' to GET
Set the 'Content' type to Application/json
Finally, click on 'Create Action' and then click on 'Finish' in the next prompted page.
All set to GO..Now your voice-controlled lights are ready to go. Say "Ok Google" on your Android phone and speak out the phrase you used in the above section.
Steps to turn OFF the LED bulbNow, repeat the same process for a command to switch OFF the LED. Here you will have to change the state to LOW i.e. state=LOW in your code. Here is a sample of the code. Also, add a suitable phrase to switch off the LED.
https://cloud.boltiot.com/remote/API_KEY/digitalWrite?pin=0&state=LOW&deviceName=BOLT****
Comments