Introduction to the Project: -
This project came up to my mind when I thought of “why not use phone to turn lights on and off instead of getting up”. That time with the help of the IOT Bolt kit and with the help of Google Assistant this project is built.
Power ON the BOLT WIFI Module by simply proving it a power supply which is basically done with the USB cable provided. Check if the device is on i.e. both blue and green lights are on. Take the led provided and put the positive end (long leg) in the pin 0 of the Bolt module and the negative (short leg) in the GND of the module.
Step 2: CONFIGURATION AND SETUPHardware part:
Go to the Dashboard of the BOLT IOT and on the left side click on product.Then click on add product once it is clicked it will prompt showing name add any name for the project /product also you and put a picture of your project in the left side corner. As the led as input device the click on input devices. Click on the GPIO pin which will store the data. Click on done.
Configure the product:
After the saving is done click on configure symbol select the pin as GPIO 0 and the variable name as led (any variable name) and save the configuration.
Coding part:
The structure of the code is:
https://cloud.boltiot.com/remote/API_KEY/digitalWrite?pin=PIN_NUMBER&state=HIGH/LOW&deviceName=DEVICE_ID
Now the command basically tells the led to turn on and off
The major parameters in this piece of code is
API_KEY: you can get this key from your bolt cloud for that you simply need to click on the API icon on google cloud and get the API pin.
Copy the 20-digit pin and place it:
PIN_NUMBER: The ground Pin is connected the LED. Values can be either 0, 1, 2, 3 or 4HIGH/LOW:
STATE: this variable is used to tell weather the led should turn on or off according to the its high/low value. High value is for turning off the device. off value is for turning off the device.
DEVICE_ID: This is the id of your device. Which you can easily obtain from the cloud dashboard.
Example:
The structure of the control command is:
· To turn ON the LED:
https://cloud.boltiot.com/remote/API_KEY/digitalWrite?pin=PIN_NUMBER&state=HIGH&deviceName=DEVICE_ID
· To turn OFF the LED:
https://cloud.boltiot.com/remote/API_KEY/digitalWrite?pin=PIN_NUMBER&state=LOW&deviceName=DEVICE_ID
Step 4: GOOGLE ASSISTANT CONFIGURATIONGo to Google chrome open www.ifttt.com/create to create a new applet. Make sure that you should login IFTTT and Google Assistant with same Credentials.
Steps to Turn ON the LED:
1) Click on +this in the first step.
2) Search for google assistant and search for say a simple phrase.
SAY A SIMPLE PHRASE
3) Type for the phrase you want to say when you want to turn on the led(ANYTHING) in the 3-dialog box:
· OK GOOGLE TURN ON THE LED.
· TURN ON
· TURN LED ON
· PRESS ON “CREATE TRIGGER”
Now, Click on '+That'
4)Select Webhooks and then Make a web request.
5) Enter the API URL you got in the previous Step that you have copied from dashboard. Make sure that you change the API Key and device name. (example)
https://cloud.boltiot.com/remote/ff012827-2971-4e0a-bd9c-0e2dddcb146f/digitalWrite?pin=0&state=HIGH&deviceName=BOLT14883062
6)Method will be -> GET
7)Content type will be ->Application/json
8)Click on 'Create Action' and then Click on 'Finish'.
YOUR SCREEN AFTER THE CREATE ACTION THE PRESS ON CONNECT:
Steps to Turn OFF the LED:
1) Click on +this in the first step.
2) Search for google assistant and search for say a simple phrase.
3) Type for the phrase you want to say when you want to turn on the led in the 3-dialog box:
· TURN OFF LED.
· TURN OFF
· TURN LED OFF
· PRESS “CREATE TRIGGER”
Now, Click on '+That'
4)Select Webhooks and then Make a web request.
5)Enter the API URL you got in the previous Step that you have copied from dashboard. Make sure that you change the API Key and device name. (example)
https://cloud.boltiot.com/remote/ff012827-2971-4e0a-bd9c-0e2dddcb146f/digitalWrite?pin=0&state=LOW&deviceName=BOLT14883062
6)Method will be-> GET
7)Content type will be-> Application/json
8)Click on 'Create Action' and then Click on 'Finish'.
· YOUR SCREEN AFTER THE CREATE ACTION THE PRESS ON CONNECT:
Now when you press the google assistant from the smart phone and say “turn on led” the led will be on and off according to your commands.
Conclusion:The simple and easiest way to trigger the action for turning on and off the led using your smart phone which can further be used to build bigger projects.
Comments
Please log in or sign up to comment.