Since, Google Assistant working on my phone, I want to control my house appliances with it. I have spent quite some time by the help of bolt wifi module and trying to implement.This project allows me to control home appliances from anywhere in the world, using my voice.
Step 1: Hardware SetupPut the positive (+ve) terminal of the LED in the Pin 0 (as your choice) of Bolt WiFi module & negative (-ve) terminal to the ground pin (GND), and supply power to the Bolt Wi-Fi module.
Step 2: Setting the Bolt API Key and Device IDGo to cloud.boltiot.com and note down the Device ID of your Bolt Wi-Fi Module.Now, click on the API Tab and under the section for Generate Key, click on Enable.Next, click on the copy button to copy your API key. Your API key will may look something like this: 72ffecae-1c92-44bb-8b97-09f2ec8e393a
Step 3: Code GPIO Control CommandAs LED is a digital output device, we will need to get a DigitalWrite command that can be sent to Bolt over the Internet to switch on the LED.Click here Bolt Cloud 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 4HIGH/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 BOLT13167901 to PIN 0 is:
https://cloud.boltiot.com/remote/72ffecae-1c92-44bb-8b97-09f2ec8e393a/digitalWrite?pin=0&state=HIGH&deviceName=BOLT13167901
Be sure you replace the API key & device id as per your device and cloud information.
Step 4: Integrating IFTTT via Google Assistant and WebhooksGo to IFTTT to create a new applet by clicking here.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.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 the lights on
b) Turn on the lights
c) Lights on
Click on 'Create Trigger'.Click on '+That'.Select Webhooks 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.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'
Steps to turn OFF the LED
Now do the same above process for to switch of the LEDs. Here you will change the state to LOW i.e. state=LOW in your code. Also, add a suitable phrase to switch off the LED. Sample program:-
https://cloud.boltiot.com/remote/72ffecae-1c92-44bb-8b97-09f2ec8e393a/digitalWrite?pin=0&state=LOW&deviceName=BOLT13167901
Project ReadyNow wake your Android phone by saying "OK Google" and say the phrase you had set while creating the trigger to see the magic happen.
Comments
Please log in or sign up to comment.