Imagine walking into your home and saying "Hey Google, turn on the lights" and watching the lights come on instantly. With the Bolt IoT WiFi module, Google Assistant, and IFTTT, you can set up voice-controlled lighting in just 5 minutes.
This project shows you how to connect a relay module to the Bolt WiFi module and integrate it with Google Assistant through IFTTT (If This Then That) to control your home lights with voice commands.
| Component | Quantity |
|---|---|
| Bolt WiFi Module | 1 |
| 5V Relay Module | 1 |
| LED or Light Bulb with Holder | 1 |
| Jumper Wires | 3 |
Connect the relay module to the Bolt WiFi module as follows:
| Bolt WiFi Module | Relay Module |
|---|---|
| 5V | VCC |
| GND | GND |
| Digital Pin 0 | IN (Signal) |
Connect the light bulb or LED through the relay's normally open (NO) terminal. When the relay is activated, the circuit closes and the light turns on.
Power the Bolt WiFi module using a micro-USB cable. Make sure the Bolt device is connected to your WiFi network and linked to your Bolt Cloud account.
Go to ifttt.com and create a free account if you don't already have one. You will also need to have Google Assistant set up on your phone or Google Home device.
Click on "Create" to start a new applet. For the "If This" trigger, search for and select "Google Assistant". Choose "Say a simple phrase" and set your trigger phrase to something like "Turn on the lights".
For the "Then That" action, select "Webhooks" and choose "Make a web request". Configure the web request with the following details:
URL: https://cloud.boltiot.com/remote/YOUR_API_KEY/digitalWrite?pin=0&state=HIGH&deviceName=YOUR_DEVICE_ID
Method: GET
Content Type: application/json
Replace YOUR_API_KEY and YOUR_DEVICE_ID with your Bolt Cloud credentials.
Repeat the process to create another applet. Set the trigger phrase to "Turn off the lights" and configure the webhook URL as:
URL: https://cloud.boltiot.com/remote/YOUR_API_KEY/digitalWrite?pin=0&state=LOW&deviceName=YOUR_DEVICE_ID
Method: GET
Content Type: application/json
Say "Hey Google, turn on the lights" to your Google Assistant. The IFTTT applet will trigger the Bolt Cloud API, which sends a HIGH signal to digital pin 0 on the Bolt module, activating the relay and turning on the light.
Say "Hey Google, turn off the lights" to deactivate the relay and turn off the light.
The flow is simple: Google Assistant receives your voice command and triggers an IFTTT applet. The IFTTT applet makes an HTTP GET request to the Bolt Cloud API, which sends a digital write command to the Bolt WiFi module. The Bolt module then sets the specified GPIO pin HIGH or LOW, controlling the relay which switches the light on or off.
In just a few minutes and a few simple steps, you now have a Google Assistant-powered smart light. You can extend this project to control fans, appliances, or any other electrical device through the relay.
Want to build more such IoT and ML projects? Want to learn IoT and ML from basics? Check out the Bolt IoT and ML training. This online video training is excellent for those who want to start with IoT and ML because it teaches you to build projects from the basics.
Get the latest IoT tutorials, projects, and updates delivered to your inbox.