Introduction: Home Automation Using Google Assistant and Adafruit IO

Google assistant is AI (Artificial Intelligence) based voice command service. Using voice, we can interact with google assistant and it can search on the internet, schedule events, set alarms, control appliances, etc.

This service is available on smartphones and Google Home devices. We can control smart home devices including lights, switches, fans and thermostats using our Google Assistant.

We will build an application that can control home appliances. Here, we will control a 60W bulb using Google Assistant service. This application includes Google assistant along with Adafruit server and IFTTT service.

Supplies

Step 1: Creating an Online Service Account

  1. First, created an account at www.Adafruit.io
  2. Now, create a dashboard. This dashboard is a user interface to control things remotely.
  3. After following the above steps, provide a name to the dashboard and save it.
  4. Now, create feed (user interface) to control light On-Off. To create it, just click on the ‘+’ symbol and select the toggle feed shown.
  5. After selecting toggle feed, a pop-up window appears as shown.
  6. Enter the name of our feed (shown in a red box) and create it. After creation, select the created feed (here mine is LED) and then click on the Next step. In the next step configure the feed which is shown below.
  7. Here, I used 0(OFF) and 1(ON) text for button and then click on create. This will create a toggle button on your dashboard which can be used to control things remotely.

Now, my dashboard is ready for IoT applications like home automation.

Step 2: IFTTT (If This Then That)

If This Then That, also known as IFTTT is a free web-based service to create chains of simple conditional statements, called applets. An applet is triggered by changes that occur within other web services such as Gmail, Facebook, Telegram, Instagram, or Pinterest.

For example, an applet may send an e-mail message if the user tweets using a hashtag or copy a photo on Facebook to a user's archive if someone tags a user in a photo. Here, I used IFTTT to use google assistant service and Adafruit service in the chain. So, when I use google assistant to control light of my home by saying Ok Google, turn the light ON or OFF. Then IFTTT interprets the message and can send it to Adafruit’s dashboard as an understandable command to the created feed.

Configure IFTTT
The first step is creating an account on IFTTT.

Note: Create an account on IFTTT by using the same e-mail id which you have used for Adafruit.

  1. After account creation, click on My Applets and then select New Applet.
  2. After selecting a new applet, we get a new page in which we should click on to This is shown in the image.
  3. Then search for Google Assistant and select it.
  4. Now, enter voice phrases which we will use as a command for google assistant.

We can enter any phrase as per our application. As you can see, the phrases entered in the above fields are for making Light ON. For making Light OFF, we have to create another applet with different phrases.

Now, we get another page on which we have to click on that option which is used to connect Google Assistant with Adafruit.

  1. Then search for Adafruit and select it.
  2. After selecting Adafruit, choose action. Now enter what data we need to send to which feed of Adafruit dashboard.
  3. Click on Create Action.

So, when I use Google Assistant on my mobile and give voice command as “Ok Google, Turn LED ON”, applet created in IFTTT receives this command and will send data ‘1’ to the Adafruit feed. This will trigger the event on the Adafruit dashboard which is continuously monitored by the microcontroller (here NodeMCU). This microcontroller will take action as per the data change on the Adafruit dashboard.

Step 3: Flow and Schematics