Google Assistant on a Raspberry Pi

20K9722

Intro: Google Assistant on a Raspberry Pi

On this Instructablel I will be showing you how you can install 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


STEP 2: Set Everything Up

Log into your Raspberry Pi with Raspbian.

Open up a Web Browser and go to "www.console.cloud.google.com/console-resource-manager"

Click on "CREATE PROJECT"

Give it any name you like and click "Create"

Click on the three little lines at the top left of the page, then select "API Manager"

Click on "Enable API"

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"

Go to the bar on the left and select "Credentials" and then click on the "OAuth Consent Screen"

Here you can leave everything as default except for the Product's name, when you're finished hit "Save"

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 3: Download Everything We Need

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

Type in "sudo apt-get install portaudio-19-dev libffi-dev libssl-dev" and press "Enter"

When the download finishes, type in "python3 -m venv env"

Once you enabled that, type "env/bin/pip install pip setuptools --upgrade" and press "Enter"

Type "source env/bin/activate" to get into the enviroment.

Type in "python -m pip install googleassistant-sdk[samples] and press "Enter", the whole process should take around 15 minutes, so take your time and then come back.

Once it downloads, type in "python -m googlesamples.assistant.auth_helpers --client -secrets/*Location where you Downloaded the .json file of the previous step*/clients_secrets/*Your auth key number*.json"

Press "Enter" and it should ask you to go to a website, go to it, and when it loads, click on "Allow"

STEP 4: In Case You Run Into Trouble

In the case that it doesn't takes your authentication request, you need to 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: Run the Google Assistant

Go back to the command prompt and type "python -m googlesamples.assistant"

Press "Enter" and wait around aminute or two, and you should get a message confirming that Google Assistant is working correctly.

Enjoy your shiny new 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.

15 Comments

is it compulsory to register devices (speaker / microphone ) with google actions (Device Registration)?

I followed your tutorial,but it gives me PortAudioError on the last step .

So Please help.

Sorry to be so pedantic but it's not "An USB Microphone" but "A USB Microphone"
The 'U' of USB sounds like a 'Y' which is obviously not a vowel.
Thanks.

when i put "python3 -m venv env it doesent proceed

my codeing does no put the next green text after i put this command in

"python3 -m venv env

when using SSH how can I leave it working without having to leave ssh open

Hi,

I am getting an error. "No module googlesamples.assistant.auth_helpers".

Can anyone help

hey there, im getting the same result:

: no module named googlesamples.assistan.auth.

Did you get this resolved at all?

Thank you for great instructions, I'd really like to make it work, you mentioned about questions, so I'll ask a few if you don't mind.

1. Is it possible to make it work without GUI on raspberry, only with console?

2. I've seen you have plans of voice triggering, is there some forecasts on progress, sounds really exciting.

3. Is there a way to make it work with bluetooth speaker/mic with integrated bluetooth adapter or should I try to try use usb dongle?

1. You don't need a GUI on the Rpi. But you need to verify your account at some point which is done on any device.

2. There is a voice activate command called googlesamples-assistant-hotword that listens for "Ok Google" or "Hey Google".

3. You can use BT-spekers or USB ones, it really doesn't matter. The thing is that you'll need to find the sounddevices and add them to your .asoundrc-file with the right settings.

Good instructions, however there are some mistakes in the coding:

sudo apt-get install portaudio-19-dev libffi-dev libssl-dev should be

sudo apt-get install portaudio19-dev libffi-dev libssl-dev

and

python -m pip install googleassistant-sdk[samples] should be

python -m pip install google-assistant-sdk[samples]

Error while finding spec for googlesamples.assistant.

seems like google changed something. any ideas?

after get credential authorised, i key in the last line python -m googlesamples.assistant, then enter.

But nothing show , it is not working

it only show no module googlesamples.assistant.

Why ?

Hi,

I am getting same message. "No module googlesamples.assistant.auth_helpers". Did you get to fix this issue. If so can you please advice how you fixed it.

Thanks,

Vijay.

can i use earphone mic instead of usb mic?