Google Assistant on a Raspberry Pi

Introduction: Google Assistant on a Raspberry Pi

About: Avid Thinker, Computer Programmer, Web evangelist, Hacking / Breaking expert, Problem Solver, Technology Obsessed, Gamer, 3D printing, Coffee lover!

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.

Internet of Things Contest 2017

Participated in the
Internet of Things Contest 2017

Be the First to Share

    Recommendations

    • Make It Bridge

      Make It Bridge
    • For the Home Contest

      For the Home Contest
    • Big and Small Contest

      Big and Small Contest

    15 Comments

    0
    ManoramaD
    ManoramaD

    4 years ago

    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.

    0
    JimmyJ65
    JimmyJ65

    5 years ago

    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.

    0
    matthieupro2
    matthieupro2

    5 years ago

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

    0
    matthieupro2
    matthieupro2

    5 years ago

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

    "python3 -m venv env

    0
    kamhagh
    kamhagh

    5 years ago

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

    0
    JimH265
    JimH265

    5 years ago

    Hi,

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

    Can anyone help

    0
    SimonF90
    SimonF90

    Reply 5 years ago

    hey there, im getting the same result:

    : no module named googlesamples.assistan.auth.

    Did you get this resolved at all?

    0
    AntonK67
    AntonK67

    5 years ago

    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?

    0
    FredricP
    FredricP

    Reply 5 years ago

    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.

    0
    sonic136
    sonic136

    5 years ago

    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]

    0
    TobiasB45
    TobiasB45

    5 years ago

    Error while finding spec for googlesamples.assistant.

    seems like google changed something. any ideas?

    0
    ynakamura3
    ynakamura3

    5 years ago

    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 ?

    0
    VijayS177
    VijayS177

    Reply 5 years ago

    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.

    0
    ynakamura3
    ynakamura3

    5 years ago

    can i use earphone mic instead of usb mic?