In this project we are building a DIY Google Home using your Raspberry Pi, also known as Google Assistant.
Things You Need- Raspberry Pi 3
- Google Account
- Speaker (Follow this tutorial Maker Your Own Speaker)
- Mic (am using a webcam, with a built-in mic)
Follow this tutorial: Setting VNC Server in Raspberry Pi to set up yours.
Step 2: Setup Google Assistant API2.1: Open Browser in Pi and go to: https://console.cloud.google.com/cloud-resource-manager
2.2: Click CREATE PROJECT for creating new project
2.3: Name your project. Here, mine is: googlepi
2.4: Open your project by clicking your project name
2.5: Open API Manager Dashboard
API Manager => Dashboard
and click ENABLE API
2.6 : Open Library and Search Google Assistant
Click the Enable Button for enabling Google Assistant API
2.7: Create credentials for it
open Credentials and goto OAuth Consent screen
Enter product name and leave everything as default, and save it
Go to credential
Click OAuth Clinet ID
Choose Other and give it a name and hit Create button .
Now you created and authentication key.
Download the Credential by clicking down arrow. You'll get an json file.
We're done with the authenticating and adding the apps to your project now. We're going to start downloading the tools to get Google Assistant on your Pi.
Step 3: Setup Google Assistant in Pi3.1: Setup python virtual environment
Sudo apt-get install python3-dev python3-venv
3.2: Download Dependencies
Sudo apt-get install portaudio19-dev libffi-dev libssl-dev
3.3: Setup Python3
python3 -m venv env
env/bin/pip install setuptools --upgrade
Now we are set the virtual environment
source env/bin/activate
Now we are in the virtual environment
3.4: Install Google Assistant SDK
python -m pip install google-assistant-sdk[samples]
For new version (Updated SDK)
pip install --upgrade google-auth-oauthlib[tool]
3.5: Setup Google Assistant SDK with Credentials
After /home paste your credential file location
python -m googlesamples.assistant.auth_helpers --client-secrets /home/pi/Downloads/xxx
For Updated SDK use
google-oauthlib-tool --client-secrets path/to/client_secret_XXXXX.json --scope https://www.googleapis.com/auth/assistant-sdk-prototype --save --headless
After this you will re-direct a permission page
Like this:
Click ALLOW
Then you get a message like this, meaning your authentication is completed.
4:1 Run Your Assistant
Type this for Run Your Assistant
python -m googlesamples.assistant
For Updated SDK use
python -m googlesamples.assistant.grpc.pushtotalk
After the setup, you'll get something like this in your terminal, then all things working good.
Don't forget to connect your speaker and mic, and press enter. Ask anything you want. :-D
Enjoy your new DIY Google Home.
Comments