Table of Content
The technology these devices run on is available---at least in part---to everyone. Google's Assistant SDK allows you to use the service on your own devices. This tutorial covers how to set up the Google Assistant on your Raspberry Pi, and voice activate an LED via GPIO pins. If it didn’t work, clues may be lurking in the ifttt activity log or the Pi /var/log/mini-httpd.log file. You can also try adding lines to the script to log something to a file somewhere.
As usual, I like to hope this has been useful but don’t really want anyone to follow it to the letter. I don’t mind if anyone does, but I’d rather provide a bit of inspiration people to create something of their own. Sudo apt-get install mini-httpd sudo nano /etc/default/mini-httpd Now set set the START parameter in there to 1.
Storing 100,000,000 words Python-Postgres
It just happens that ifttt provides a fairly simple way to combine the two and end up with voice controlled Christmas lights. The next step is to create a CGI program to be run when a URL is requested. I called my script “switch” as I want to use it to control my Christmas lights. On my main site there’s some information about using a Pi to control electrical sockets without risking killing yourself.

This lets you break the circuit with the switch when the relay circuit is closed. Alternatively, if you don’t have a keyboard, mouse and a display, check out this headless setup. You’re snug and warm in your bed, and are about to happily doze off when you realize- you’ve forgotten to turn your lights off. Don’t worry though- it’s possible for you to do so without climbing out of those soft sheets. Here’s how you can set up your room to be infinitely cooler. Now we will set up our back-end service to get those queries to open videos and websites on our raspberry pi.
Your Own DIY Raspberry Pi Google Home Assistant
Now, navigate to the folder containing the hotword.py script. Since this is a virtual environment, you'll need to install RPi.GPIO before moving forward. You will need to replace my-dev-project with your Project ID . Your device-model-id is listed under the Device registration section of the Action Console.
A relay is an electromagnetic switch operated by a relatively small electric current that can turn on or off a much larger electric current. This is why you’ll hear a clicking sound when the relay is triggered. You'll be prompted to enable the device on your Google account. Copy the authorization code which follows, and paste it back into your terminal window. The way I opted for in the end was to use If This Then That. For anyone who’s not heard of it, it’s a web site that allows you to setup little jobs that get triggered by things.
Hardware Required for a Raspberry Pi Home Assistant
Then enter the same parameter name in the actions section. Voice controlled assistants have quickly become commonplace. Many homes have an Alexa or Google Home controlling everything from lighting to media, and even timekeeping. Sudo service mini-httpd restart Now you have a web server. Put the Pi IP address into a Raspberry Pi to test it. The phrases can contain parameters to be sent to the Pi too.

However the Flask server can only be accessed locally. Though you can control your switch locally, you can’t do it outside your LAN. Follow this guide to get your Pi running and then enable SSH. Add the response which we need to hear after saying the command to Google Home. If needed set this intent as the end of the conversation. These are the commands that users speak when they try to access a specific task from Google Home.
Adding LED Lights Response
Once everything is done, you will have following screen. You can select any traits that you need, but in our case we don’t need any of these so we just clicked the Skip button as shown below. On next screen, you have to enter the Project Name and click on Create Project. First, we have to register and set up a project on theGoogle Console Actions dashboard .

Open the Pi's browser, alternatively, if you are connected via SSH open a browser locally. Navigate to the Google Action Console and click New Project. This tutorial can be followed directly on the Pi or via an SSH connection into the Pi. Raspberry Pi with a fresh Raspbian install on the SD card. The first step was to look at the google Home API. The second step was to say “That looks like hard work.” and ignore it. First, make the Pi Bluetooth to auto connect the speaker .
On the same terminal, install the Google Assistant SDK and the oauth tools. The last command requires the client secret file generated while preparing Google Project and account. To power up, connect the 5v USB power cable to the power port on the docking hub . You should see the normal Raspbian OS coming up on the monitor. We also assume that your Raspberry pi is already set up with an Raspbian OS and is connected to the internet. With these in place let’s proceed with the tutorial.
First, connect to the raspberry pi Get the latest nodejs run-time from the following command in the terminal. I guess this has been two guides really. CGI scripts on a Pi and Google Home interfacing.
Use the terminal or the SSH session you set up in this step to enter the commands in the rest of this guide. The working directory for both is/home/pi. The first thing that you need to do is set up the wiring so that you can programmatically flip the switch using our Raspberry Pi. While it’s easy to trigger GPIO ports, they can only emit 5V. In order to close/break a 220V circuit, you need a relay.
It is possible to control lights with an Arduino and Siri, but there is a simpler method. If you set up an LED, you can use the Google Assistant to control it with your voice. Switch back to the SSH terminal, and navigate to /home/pi. Enter ls -l to list the files in the directory. You should see the transferred client secret JSON file.
No comments:
Post a Comment