Google Assistant

This wiki is for ReSpeaker Core v2.0, we recommend you to read the Wiki of ReSpeaker Core v2.0 first.

Before the start

You need to make the following preparations:

  • ReSpeaker Core v2.0 with the latest image
  • Wi-Fi Network (make sure you can ping google with this network)
  • PC or Mac
  • One Micro-USB cables

We assume that you have read the Preparetion and set up the WiFi and Serial already.

Now let's play 😃

Geting Started


This part is simple and easy, just plug your ReSpeaker Core v2.0 into your computer via the OTG port.


Set Up Your Project

  • Step 1.Add your Project

Open the link to add your project.

Note!!! If you do not have a google account, please sign in at google.com at first.

Click Add/Import project

Then tap your Project name and pick the Country/region. Then click CREATE PROJECT to continue.

  • Step 2.Register Model

Click Connected properties ->DEVICE MODELS ->REGISTER MODEL as the picture below.

Fill in your product info. then click REGISTER MODEL to continue.

Just click NEXT

Please make sure you have selected this option ALL 7 traits, so that you can turn on all the permissiions. Then click SAVE TRAITS.

Now please click the Project Name you have just created. For this demo, as you can see, we use ReSpeaker Core v2.0.

You will see some info. as the following picture shown.

Please mark down the Model Id which is respeaker-xxxx-respeaker-core-v2.0-xxxxx in this demo, it is important and you will use it later.

Now let's download the json file. Click the button in the upper right corner, then click Download credentials.json to download the json file into your computer.

Then use the WinCP or other transmission tools to copy the json file to your ReSpeaker Core v2.0. For example, we copy it to the path /home/respeaker.

Next, please click the gear in the upper left conner, click Project settings, remember the Project ID which is `` in this demo.

Ok, let's check again, in this section you will get two IDs.

The Model ID respeaker-xxxx-respeaker-core-v2.0-xxxxx

The Project ID respeaker-440eb

They will be used later.

Enable the Google Assistant API

Enable the Google Assistant API on the project you selected (see the Terms of Service). You need to do this in the Cloud Platform Console.

Just click Here to enable the Google Assistant API.

Ensure the following toggle switches are enabled (blue):

  • Web & App Activity
  • In addition, be sure to select the Include Chrome browsing history and activity from websites and apps that use Google services checkbox.
  • Device Information
  • Voice & Audio Activity

Install the SDK and Sample Code

You can refer ro google doc for more detail about this part.

You can do this part with python2.7 and python3, in this demo we use python2.7.

For python2.7

Step 1.

Tap the following command:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python-dev python-virtualenv
sudo virtualenv env --no-site-packages  
env/bin/python -m pip install --upgrade pip setuptools wheel
source env/bin/activate

Step 2. Get the package

The Google Assistant SDK package contains all the code required to get the Google Assistant running on the device, including the sample code.

Install the package's system dependencies:

sudo apt-get install portaudio19-dev libffi-dev libssl-dev
Use pip to install the latest version of the Python package in the virtual environment:
sudo python -m pip install --upgrade google-assistant-sdk[samples]

Step 3. Generate credentials

Install or update the authorization tool:

sudo python -m pip install --upgrade google-auth-oauthlib[tool]

Make the target folder.

sudo mkdir –p /path/to/assistant-sdk/

Use the command below to copy credentials.json to the target location.

sudo cp /home/respeaker/credentials.json /path/to/assistant-sdk/ 

Tap the command below to get the token generate code.

google-oauthlib-tool --scope https://www.googleapis.com/auth/assistant-sdk-prototype \
          --save --headless --client-secrets /path/to/assistant-sdk/credentials.json

Note!!! By using the command above, Every time you get a different authorize code. Please make sure

Then you will get the code, please copy the code after the note Please visit this URL to authorize this application:.

Paste the code into your Internet browser, then tap the Enter key.

If everything goes well, the following window will pops up. Choose your Google account and select ALLOW

Ok, then, you will get the authorize code as the following picture shown.

Cope this code into your console

Then you will see the notice credentials saved: /path/to/.config/google-oauthlib-tool/credentials.json. That means everything goes well so far.

Install Respeakerd

Tap the commands to install respeakerd

sudo apt-get install portaudio19-dev libffi-dev libssl-dev
sudo pip install -U googleassistant_respeakerd

Activate the Google Assistant.

Remember the two IDs we marked before? Now it's time to use them.

Change the command googlesamples-assistant-respeakerd --project-id my-dev-project --device-model-id my-model with your own IDs.

For the command above, change my-dev-project into your project-id and change my-model into your Model ID.

For this demo, it should be like

googlesamples-assistant-respeakerd --project-id respeaker-440eb --device-model-id respeaker-xxxx-respeaker-core-v2.0-xxxxx

Now, cheers!!!