Login

Make a Google Assistant based Home automation system using Raspberry Pi

Objectives

  • Set up io.adafruit.com to control RGB LED connected to Raspberry Pi
  • Set up IFTTT to link Google Assistant with io.adafruit.com
  • Use Google Assistant to control RGB LED connected to Raspberry Pi

 Things

  1. Raspberry Pi 3B board (quantity: 1 no.)
  2. Micro USB cable A to B with Power adapter (quantity: 1 no.)
  3. Breadboard (quantity: 1 no.)
  4. RGB LED module (quantity: 1 no.)
  5. Jumper wire – male to male (quantity: 4 no.)
  6. io.adafruit.com account
  7. ifttt.com account
  8. Google Assistant on phone

Let’s begin!

It is possible to use IFTTT and io.adafruit.com to control any components connected to a Raspberry Pi. In this experiment, we will control LEDs connected to Raspberry Pi. Potentially, we can connect relays connected to various components like bulb and fan to make a voice controlled home automation system.

Install Google Assistant on phone

 

Google Assistant on phone

 

Create an Adafruit account

Step 1: Open a browser and go to io.adafruit.com. Click on Get Started for Free.

Step 2: Fill in your details and click on Create Account. Note that the site would have navigated to accounts.adafruit.com

Step 3: Once you’ve successfully logged in, this page will be displayed. You can change your details if you wish to.

Set up your Adafruit dashboard to control the Raspberry Pi

Set up an IFTTT account and link Google Assistant with Adafruit

Raspberry Pi Pinout

Interfacing RGB LED with Raspberry Pi

Connect the R pin of the RGB LED to pin 11 and the (-) pin to pin 6 (GND) on the Raspberry Pi.

Final Code

Install the Python package for Adafruit IO on the Raspberry Pi by running the following command in your terminal.

sudo pip install adafruit-io

To edit the code

cd ~/Documents/Codebase
nano adafruit.py

Change the following lines in the code (lines 4 and 5)

ADAFRUIT_IO_USERNAME = "xxxxxxxxxx"
ADAFRUIT_IO_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

To run the code

python adafruit.py

To copy the code, right click on view raw at the bottom of the code, click on open link in new tab and then copy the code.

We would love to see what you build out of these learnings!

Click here to submit your projects, share it with the world and stand a chance to be rewarded.

top

Knowledge and Content by Li2 Technologies | © 2021 NASSCOM Foundation | All rights reserved

X