This is a voice controlled ( Google Assistant ) home automation project.
In this project we can connect any of our home appliance ( I have used light here) and make it a IOT stuff.
Step 1 - Get all the required components with you1) Bolt iot wifi module
2) 5v Relay
3) Jumper wires
4) Bulb & its holder
5) 2-pin socket & a smartphone charging adapter (any usb port will work)
Step 2 - Connecting those hardware together1) Connect the 5V pin and GND pin of the Bolt module to the VCC/DC+ and GND pin of the relay module.
2) Connect any of the digital pin (i.e 0-4) of the Bolt to the IN/REL pin of the relay module.
3) Connect a wire from the NO pin of the relay module to the 2-pin socket.
4) Connect a wire from the COM pin of the relay module to the bulb holder.
5) Connect the remaining terminal of the bulb holder tot the other terminal of the 2-pin socket.
CIRCUIT DIAGRAM:
1. Go to cloud.botiot.com and login with your account credentials.
2. Note the ID of your Bolt WiFi module.
3. Now click on 'API' and then Generate the Key and enable it. Note it down, we will use it very soon!
4. Since relay 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 relay.
Click here or move to Docs Tab -> API Documentation -> GPIO Commands API -> Write Digital Output to understand how to create a API command link to turn on and to turn off a pin of the Bolt.
5. The code we are going to use will look like this:
https://cloud.boltiot.com/remote/API_KEY/digitalWrite?pin=PIN_NUMBER&state=HIGH/LOW&deviceName=DEVICE_ID
Here:
High refers to the state ON
Low refers to the state OFF
PIN_NUMBER is the gpio (0-4) pin which you have connected to the relay's vcc/dc+/5v.
Step 4 - Integration with Google Assistant for voice controlSteps to turn ON the RelayStep 1 - Go to IFTTT and login/signup with your google account and then create a new applet by clicking here.
Make sure you use same account which you are using in your android right now.
Step 2 - Click on Add
Step 3 - Search for Google assistant and Click on it
Step 4 - Click Say a simple phrase and Type whatever you need to make google assistant switch on the light! Click on Create trigger.
Step 5 - Now click on Then That Add
Step 6 - Search for Webhooks and then Make a web request.
Step 7 - Enter the API URL that you got previously. Make sure that you change the API Key, input pin number (0/1/2/3/4) and device id as your configuration.
Method will be GET
Content type will be Application/json
Here is how the screen will look like:
Now click Create action -> Continue -> Finish
Now your Google assistant will hear you and perform switch ON action!
Steps to turn OFF the RelayNow follow the same process (step-4 to step-7) that we have done before for switching ON the relay. Here you will change the state to LOW i.e. state=LOW in our code. Here is a sample of the code.
https://cloud.boltiot.com/remote/API_KEY/digitalWrite?pin=0&state=LOW&deviceName=BOLT432123
Now your Google assistant will hear you and perform switch OFF action!
Time to test it out!Take your Android phone and say "OK Google" followed by our command (eg: turn on the light) and watch what happens next! BOOM!!!!!!
Thank you!
Comments
Please log in or sign up to comment.