Introduction: Voice Activated Google Assistant for Raspberry Pi
On this Instructablel I will be showing you how you can allow voice activation on your Google Assistant on your Raspberry Pi.
It's way more simple that you'll thought. Hope that you like it and thanks for reading this.
Step 1: What You'll Need
- A Raspberry Pi
- An USB Microphone
- Google Assistant's API
- A few dependencies
Step 2: Set Everything Up
Log into your Raspbian with PIXL Desktop.
Open up a Web Browser and go to "console.cloud.google.com/project"
Log into your Google Account.
Click on "CREATE PROJECT"
Give it any name you like and click "Create"
Wait for your project to show and then click the three dots on the project's name.
Click on the three little lines at the top left of the page, then select "API Manager"
Click on the dropdown menu.
Hit all, then select your project.
Type "Google assistant" on the search bar, this will make the searching process a lot quicker and easier.
Click on the "Google Assistant API" and then click "Enable"
Step 3: OAuth Key
Go to the bar on the left and select "Credentials" and then click on the "OAuth Consent Screen"
Hit on "Create Credentials", then select "OAuth client ID"
In the next screen, choose "Other" and give it any name that you want.
Hit "Ok" and then move your mouse over to an arrow pointing down at the right of the screen, click on it to download your Credentials file.
Step 4: Enable Permissions
Head over to "myaccount.google/activitycontrols"
Scroll down and activate the following controls:
- Web & App Activity
- Location History
- Device Information
- Voice & Audio Activity
Step 5: Download and Install Dependencies
Open up the Command Prompt.
Update your System.
Once it finishes, type in "sudo apt-get install python3-dev python3-venv" press "Enter" and wait for it to finish.
When the download finishes, type in "python3 -m venv env"
Once you enabled that, type "env/bin/python -m pip install –upgrade pip setuptools –upgrade" and press "Enter"
Type "source env/bin/activate" to get into the enviroment.
Step 6: Run Your Assistant
Type in "python -m pip install –upgrade https://github.com/googlesamples/assistant-sdk-py... and then press "Enter"
After it finishes downloading, run the OAuth tool by typing "python -m pip install –upgrade google-auth-oauthlib[tool]"
Type in "google-oauthlib-tool –client-secrets /home/pi/Downloads/client_secret_client-idxxx.json –scope https://www.googleapis.com/auth/assistant-sdk-pro... –save –headless". Replace "idxxx" with your project's ID number.
An URL will be displayed, right click on it, select "Copy" then paste it on your browser.
Copy the Auth key.
Go to the Terminal, right lick on it and then hit "Paste" to paste the Authentication Key.
Step 7: Start Google Assistant
You can start enjoying your Google Assistant with voice recognition by typing "google-assistant-demo"
Enjoy your shiny new voice recognition on your Raspberry Pi-based Google Assistant.
And that's it, I hope that you liked this Instructable, if you have any problem, suggestion or comment, leave it down below.
5 Comments
4 years ago
the command google-assistant-demo does not work
it return this ;
5 years ago
Is the "demo" version a limited or full version of google assistant? How do you get this to run automatically on boot up?
6 years ago
Hi,
I use this voice activation Google Assistant through USB Sound Card,
Its working fine,
But i want use Bluetooth Speaker & Mic
Please Help to how to Configure Bluetooth Speaker & Mic in Raspberry Pi for Google Assistant
if u know please help to i will try....
Thanks & Regards
S.Mohankumar
Reply 6 years ago
how did you get the usb sound card to work? My sound card is working but not with google.
andreas
6 years ago
Thanks SO much for posting this. Unfortunately, I was trying it on a Pi Zero W, and I found out in the last step that the SDK only supports ARM7L, not the ARM6L used in the Zero. It sucks, but I was looking for an excuse to buy a Pi 3b, and now I have one.
A couple of notes to help others where I stumbled:
1) in the command "env/bin/python -m pip install –upgrade pip setuptools –upgrade" there are 2 hyphens before the word "upgrade". It was really hard to see in the proportionally spaced font and took me a lot of reading to find my mistake.
2) the command "python -m pip install –upgrade https://github.com/googlesamples/assistant-sdk-py..." is truncated. Right click on the link and select "Copy link address" and paste it into the command line (I tried to enter the full address here in the comment, but the editor keeps truncating it too, even if I try to unlink it!). Again, there are 2 hyphens before the words "upgrade".
3) similarly, the command "google-oauthlib-tool –client-secrets /home/pi/Downloads/client_secret_client-idxxx.json –scope https://www.googleapis.com/auth/assistant-sdk-pro..." is also truncated. Just copy and paste the link address into the command line.