Wand Under a Spell
A DIY wireless project.
Simple hardware and software setup.
Supplies
1. Wood
2. Bolt Wi-Fi Module
3. Battery bank
4. USB Cable
5. Jumper Wires
6. Wires
7. Paste
8. Android Phone
9. Bluetooth Headset
Making of Wand
Take a raw wood and craft the shape you like. The wizard's wand you like. Or cast it with plaster of paris of shape you like. Leave a hollow space for wire connections from module to LED. The wood I have is already hollow.
Circuit Connection Inside the Wand
Pass the wire through the hollow space. Connect the top end of the wire with a LED and end with jumper wire.
Making Base for the Module
I created a support for placing the module. Take the required square shape paper with enough GSM and paste it on the glove. I have used iron wire. Bent the wire in L shape and paste it on the paper with the module's respective distance of the holes. Paste another paper on it as shown above as the same size as the base.
Making Base for the Module 2
Raise walls at the three sides as shown above.
Making Top for the Module
Take the measurements of the base pasted on the glove and make a top as shown above. Make two holes for the jumper wires and cut the middle as shown above for the power cable.
Getting the Bolt API Key and Device ID
Login to cloud.boltiot.com and note the 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: f1f918e9-d9c2-4e5b-aed0-b7cb743f74cf
Creating the GPIO Control Command
Since LED is a digital output device, we will need to get a Digital Write command that can be sent to Bolt over the Internet to switch on the LED.
From 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 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 BOLT13819450 to PIN 0 is:
https://cloud.boltiot.com/remote/f1f918e9-d9c2-4e5b-aed0-b7cb743f74cf/digitalWrite?pin=0&state=HIGH&deviceName=BOLT13819450
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.
IFTTT Integration Via Google Assistant and Webhooks
Go to IFTTT to create a new applet
Login using your Gmail account. Make sure you use the same account that 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 'Lumos Maxima' which is the trigger for our action.
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'
To Turn OFF the LED
Now do the same process for a command to switch off the LED. Here you will change the state to LOW i.e. state=LOW in your code. Add the phrase 'Nox' to switch off the LED.
Circuit Connection With the Module
Connect the positive terminal of the LED to 0 and Negative terminal to GND.
Powering the Module
Connect the USB cable to the module and power bank. Th e Module with glow in blue with a interval of time.
Connecting the Module to the Cloud
Configure your Bolt module in the mobile app as the steps are given in it. Whrn the module is connected to the cloud using your mobile hotspot the blue light will stop blinking and the green light will glow without interval. Now we can confirm it online.
Now connect your Android phone to your Bluetooth headset. Wake your wand saying "OK Google" and say the phrase you had set while creating the trigger to see the magic happen.