SIGN IN

5 Minutes, Few Steps, and Google Turn On the Lights

Bolt IoT Community January 13, 2020

Overview

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.

Things Used In This Project

Hardware Components

ComponentQuantity
Bolt WiFi Module1
5V Relay Module1
LED or Light Bulb with Holder1
Jumper Wires3

Software and Online Services

Hardware Setup

Step 1: Connect the Relay to Bolt

Connect the relay module to the Bolt WiFi module as follows:

Bolt WiFi ModuleRelay Module
5VVCC
GNDGND
Digital Pin 0IN (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.

Step 2: Power the System

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.

Setting Up IFTTT

Step 3: Create an IFTTT 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.

Step 4: Create the "Turn On" Applet

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.

Step 5: Create the "Turn Off" Applet

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

Step 6: Test Your Setup

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.

How It Works

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.

Conclusion

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.

Subscribe to our Newsletter

Get the latest IoT tutorials, projects, and updates delivered to your inbox.