Google Assistant Raspberry pi 3 b+ Easily in 20 Minutes

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+.

Loading...
Google Home Assistant on Raspberry Pi 3B Plus

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

Loading...

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 all we have to create a new project on Google.
Click on the link and open Google action console.

Loading...
Google Home Assistant on Raspberry Pi 3B Plus

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

Google Home Assistant on Raspberry Pi 3B Plus

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

google action console

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

register model of google action console.

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

Loading...
OAuth 2.0 credentials google console

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.

Google Assistant Raspberry pi 3 b+ Easily in 20 Minutes

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.

Loading...
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.

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.

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.

Loading...
nano /home/pi/.asoundrc gnu editor  on raspberry pi

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

alsa mixer on raspberry pi

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.

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.

Loading...

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.

Google Home Assistant on Raspberry Pi 3B Plus
Google Home Assistant on Raspberry Pi 3B Plus

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

Loading...
device authorization code google console

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.

Loading...

Before saving just replace model id with your model id in the project. In my case it is “pi3b-speaker

model id device registration google

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

permission executable on raspbian os

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.

Loading...

After this add the following line in last line.

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

Loading...

Simultaneously Run Alexa And Google Assistant On Raspberry Pi 3B+

Share
Tweet
Share
Pin it
Share
Share
Share
Share
0 0 votes
Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

Get Instant Updates of New Posts

Join our Telegram Channel

JOIN NOW

Sign Up for Weekly Newsletter

Loading...
Related Posts
Our site uses cookies for a better experience. Read our Privacy Policy