Ever felt a need for an assistant to do your tasks for you? Here let’s build an awesome project to control a LED with Google Assistant. Simply say ‘ON’ or ‘OFF’ and let the device do its task. Let’s begin.
Hardware setup- Put one leg of the 330 ohm resister to any GPIO pins (here PIN 0) and wind the other leg to the longer leg (positive) of the LED.
- Put the shorter leg of the LED (negative) to GND of Bolt Wifi module with a jumper wire (Ref pic).
- Plug on your Bolt Wifi module.
Step 1: Find your Bolt module’s API Key and Device ID
- Visit this website cloud.boltiot.com and note down the Bolt Device ID (Like BOLT13166914).
- In the same page, click on the API tab and click ‘Enable’ and generate a key and note down the API key (Like 7bbd2431-ab09-44e0-909b-8dc66770fbfb).
Step 2: Understand the GPIO control commands of Bolt
- Visit this link to view the Bolt Document to understand creating an API command link to turn on/off an LED
- Learn the structure of the digitalWrite command:
https://cloud.boltiot.com/remote/API_KEY/digitalWrite?pin=PIN_NUMBER&state=HIGH/LOW&deviceName=DEVICE_ID
3. Replace the Device ID and API Key as found in Step 1 and PIN_NUMBER is the port to which the LED is connected (Here it is 0).(Note down the URL for future use)
Here, it is, for
ON - https://cloud.boltiot.com/remote/7bbd2431-ab09-44e0-909b-8dc66770fbfb /digitalWrite?pin=0&state=HIGH&deviceName= BOLT13166914
OFF - https://cloud.boltiot.com/remote/7bbd2431-ab09-44e0-909b-8dc66770fbfb /digitalWrite?pin=0&state=LOW&deviceName= BOLT13166914
Step 3: Integrate to Google Assistant and Web Hooks via IFTTT
- Visit IFTTT website using this link and login.
(Note: You need to repeat the below steps twice to create an applet for ON and OFF)
2. Click on ‘If This’. This is used to create a trigger.
3. Choose ‘Google Assistant’.
4. Click on ‘Say a simple phrase’.
5. Type your desired phrases to trigger the action (Ref picture).
6. Click on ‘Create Trigger’
7. Now click on ‘Then That’. This is used to make a web request.
8. Choose ‘Webhooks’. Navigate using search bar for convenience.
9. Select ‘Make a web request’.
10. Fill out the action field columns as per the following (Ref picture):
- URL: Copy paste the URL written in Step 2 (for ON/OFF)
- Method: GET
- Content Type: application/json
11. Click on ‘Create action’
12. Finally click on ‘Finish’
(Now repeat the same for OFF (Ref pic))
Once you complete creating 2 applets your project is done. And now it’s time to TEST!!!
Step 4: Test your build
Take out you phone, open google assistant and say out the triggering phrase you had set in Step3(5) and watch your LED turn ON/OFF.
ConclusionKUDOS!!! You have successfully deployed this project and now can control LED with your Android device. Thank You.
Comments