How to use Google assistant raspberry pi 3 b+easily in 20 Minutes. After making this you will not need to buy any smart speakers because here we will use our old speakers. So let’s build the project Google assistant raspberry pi 3 b+.

Raspberry Pi is a single-board computer that is also an IoT device. Using this you can use a Linux desktop and also do awesome IoT projects.
We all know Google Assistant is a very popular virtual assistant in the Android mobile. This assistant is very handy for performing day to day tasks like alarm, reminders, news, sports update, google map help etc.
If you want to make Amazon Alexa powered Virtual Assistant with your Raspberry Pi 3B then follow this post.
Amazon Alexa Assistant on Raspberry Pi 3B Plus
Simultaneously Run Alexa And Google Assistant On Raspberry Pi 3B+
Install Raspbian OS
First of all, to use Google Assistant Raspberry pi 3 b+, we have to install the latest Raspbian OS in our Raspberry Pi 3B+. I already a dedicated post for this. Please visit the following post for the guide of Raspbian OS Installation.
How to Install Raspbian OS in Raspberry Pi 3B Plus
Components Used:(Click to Buy)
Things we need for Google Assistant Raspberry pi 3 b+
Create project on Google console
First of
Click on the link and open Google action console.

Here just create a new project & give a project name and select your country.

After creating the project, above page will open. Then scroll down and select device registration.

Now click on Register Model. Then give some product name, model id as per your choice. Make sure you choose device type as speaker.

After registering in next window download OAuth credentials. Keep this in home directory & do not rename the file.

On next screen specify traits, just skip it.
Enable Google API for Google Assistant Raspberry pi 3 b+
Now Go to Google API and activate it for your project
Allow Activity Controls for Google Assistant Raspberry pi 3 b+
Now go to Google account activity control and allow everything to get best experience.

Setting up Speaker & Mic
To setup speaker and mic, first insert your usb mic or sound card. Then run following 2 commands to see the recording & playback device id.
1 2 | arecord -l aplay -l |

Now note down card no and device no. As I am going to use default 3.5 mm jack so I have to use Card 0 & device 1 which in bcm2835 ALSA.
Now run the following command to set default audio devices.
1 | nano /home/pi/.asoundrc |
After editor opens, copy the following text and paste there. Do not forget to replace the card no and device no with your card and device.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | pcm.!default { type asym capture.pcm "mic" playback.pcm "speaker" } pcm.mic { type plug slave { pcm "hw:<card number>,<device number>" } } pcm.speaker { type plug slave { pcm "hw:<card number>,<device number>" } } |
In my case mic id is 1,0 and speaker is 0,0. After it, Save it by pressing Ctrl+O & exit it by Ctrl+X.

Now just run the following command to set the volume, gain of your audio devices.
1 | alsamixer |

Install Google Assistant Raspberry pi 3 b+
To install google assistant run the following commands one by one. Run commands 1 line at a time & in the same order given below.
We are going to install it in python 3 Virtual environment. This tutorial will install google assistant in the “env” folder inside the home directory of “pi” user.
1 2 3 4 5 6 7 8 9 10 | sudo apt-get update sudo apt-get upgrade sudo apt-get install python3-dev python3-venv python3 -m venv env env/bin/python -m pip install --upgrade pip setuptools wheel source env/bin/activate sudo apt-get install portaudio19-dev libffi-dev libssl-dev libmpg123-dev python -m pip install --upgrade google-assistant-library python -m pip install --upgrade google-assistant-sdk[samples] python -m pip install --upgrade google-auth-oauthlib[tool] |
Authorize Device for Google Assistant Raspberry pi 3 b+
After Installation is complete, we have to authorize raspberry pi.
First, make sure the JSON file is in the home directory. Now run the following commands and replace your JSON file name there.
1 2 3 | google-oauthlib-tool --scope https://www.googleapis.com/auth/assistant-sdk-prototype \ --scope https://www.googleapis.com/auth/gcm \ --save --headless --client-secrets client_secret_XXXXXX.json |
Now there will show a URL in the terminal.
Please visit this URL to authorize this application: https://…
Just copy the URL and paste it in the browser where GMAIL id is logged in which you want to use for the Google assistant.

After allowing a code will show in the browser. Just copy the code.

Now paste the the code in the terminal where you are asked to enter the code.
Enter the authorization code:
If authorization was successful, you will see credentials saved response in the terminal.
Create Desktop Shortcut for Google Assistant Raspberry pi 3 b+
To use Google Assistant Raspberry pi 3 b+ easily, create a desktop shortcut, just create a new file & name it “google.sh“. Now just copy and paste the following and save that file.
1 2 3 4 | #!/bin/bash source /home/pi/env/bin/activate googlesamples-assistant-hotword --device-model-id <model id> |
Before saving just replace model id with your model id in the project. In my case it is “pi3b-speaker “

After this make the file executable. To do this go to the properties of the “google.sh” and make the read, write & executable to “Anyone“

Now when you double click on the file from desktop and execute it, Google Assistant will start. Just say “Ok Google” to ask your question.
Google Assistant Raspberry pi 3 b+Start on Boot
To run google assistant on startup, we have to add this file into crontab. To do this first run the following command.
1 | crontab -e |
After this add the following line in last line.
1 | @reboot bash /home/pi/Desktop/google.sh |
Now Save it by pressing Ctrl+O & exit it by Ctrl+X.
From now, after every startup of Raspbian OS, Google Assistant will start automatically.
To disable automatic startup, just remove the line you added in crontab & you will be done.
Amazon Alexa Assistant on Raspberry Pi 3B Plus
Simultaneously Run Alexa And Google Assistant On Raspberry Pi 3B+