SIGN IN

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

Vinayak Shantaram JoshiJan 12, 2020
Voice Controlled Light with Google Assistant

Overview

Want to control your home appliances using Google Assistant? This project enables voice control of lights from anywhere in the world using only a smartphone and an internet connection. The system connects a Bolt WiFi Module to IFTTT's Google Assistant integration, allowing you to turn lights on and off with simple voice commands.

Hardware Components

ComponentQuantity
Bolt WiFi Module1
LED1

Software & Online Services

Hardware Setup

Step 1: Set Up the Bolt WiFi Module

Set up the Bolt WiFi module to connect to your Bolt Cloud account. Refer to the Bolt documentation for setup procedures.

Step 2: Connect the LED

Connect the longer lead (anode) of the LED to Pin 0 of the Bolt module and the shorter lead (cathode) to the GND pin. Power on the module.

LED Connection Schematic

Software Programming

Step 1: Obtain API Key and Device ID

  • Login to cloud.boltiot.com
  • Note your Bolt WiFi Module ID
  • Click the API Tab, then Generate Key section, and click Enable
  • Copy your API key
Getting Bolt API Key

Step 2: Write GPIO Control Command

The digital write command for turning lights ON:

https://cloud.boltiot.com/remote/YOUR_API_KEY/digitalWrite?pin=0&state=HIGH&deviceName=YOUR_DEVICE_ID

The digital write command for turning lights OFF:

https://cloud.boltiot.com/remote/YOUR_API_KEY/digitalWrite?pin=0&state=LOW&deviceName=YOUR_DEVICE_ID

Substitute your actual API key and device ID into the URLs above. Adjust the pin number if the LED is connected to a different pin.

Step 3: Integrate IFTTT with Google Assistant and Webhooks

  1. Navigate to IFTTT and create a new applet
  2. Click "+This" and select Google Assistant, then choose "Say Specific Phrase"
  3. Enter your trigger phrases (e.g., "Turn the office lights on", "Turn on the office lights", "Turn on the lights in office")
  4. Click "Create Trigger"
  5. Click "+That" and select Webhooks, then choose "Make a web request"
  6. Enter the ON API URL from Step 2
  7. Set Method to GET
  8. Set Content Type to Application/json
  9. Click "Create Action" then "Finish"
IFTTT Trigger Configuration IFTTT Action Configuration

Repeat the process for the OFF command, using the OFF URL with state=LOW.

Conclusion

You can now control your lights by saying "OK Google" followed by your configured phrase. The Google Assistant triggers an IFTTT webhook that sends the GPIO command to the Bolt Cloud, which in turn switches the LED on or off. This project can be extended to control any appliance by using a relay module instead of a simple LED.

Subscribe to our Newsletter

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