Google Assistant on Raspberry Pi

In this article, I have mentioned all the steps which are required to install Google Assistant on our Raspberry Pi 3 board. I took the reference from Google’s Developer website to make this project and write this article. It’s a matter of 1 hour to completely make this project. So let’s begin with the things required.

In this file you need to replace the card number and device number for both mic and speaker. Now to know how to find this two numbers, kindly watch the tutorial video whose link is attached at the end of this article.

Now let’s test both the devices. For testing speaker you need to write this command.

speaker-test -t wav

After executing this command, you’ll hear “Front Left Front Left” from the speaker. If not, kindly check the connections and weather you have entered right card and device number in the .asoundrc file.

Now let’s test our microphone. Now we will execute this command which will allow our mic to record something.

Configure an Actions Console project

To create a new project, type a name in the Project name box and click CREATE PROJECT.If you already have an existing Google Cloud Platform project, you can select that project and import it instead.Keep this browser tab open and open the below mentioned link in another tab.

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.ENABLE THE APIClick Enable.

Set activity controls for your account

In order to use the Google Assistant, you must share certain activity data with Google. The Google Assistant needs this data to function properly; this is not specific to the SDK.

Open the Activity Controls page for the Google account that you want to use with the Assistant. You can use any Google account, it does not need to be your developer account.

Use the registration UI

Use the registration UI in the Actions Console to register a device model.

Open the Actions Console. You may already have this tab open from a previous step.

Select the project you created or imported previously.If you created a new project, click the Device registration box. If you imported a previously-created project, this box will not be displayed; select the Device registration tab (under ADVANCED OPTIONS) from the left navbar.

Click the REGISTER MODEL button.

Create model

Fill out all of the fields for your device. Select any device type, such as Light.See the device model JSON reference for more information on these fields.

When you are finished, click REGISTER MODEL.

Download credentials file

The credentials.json file must be located on the device. This file contains a client ID and client secret, but no access token. Later, you will run an authorization tool and reference this file in order to authorize the Google Assistant SDK sample to make Google Assistant queries (see the OAuth 2.0 documentation for more information). Do not rename this file.

Later, you will specify the different abilities that your device supports on this screen. But for now, click the SKIPbutton.

3.Copy the URL and paste it into a browser (this can be done on any machine). The page will ask you to sign in to your Google account. Sign into the Google account that created the developer project in the previousstep.

4.After you approve the permission request from the API, a code will appear in your browser, such as “4/XXXX”. Copy and paste this code into the terminal:

Enter the authorization code:

If authorization was successful, you will see a response similar to the following:

If instead you see InvalidGrantError, then an invalid code was entered. Try again, taking care to copy and paste the entire codIf authorization was successful, you will see a response similar to the following:e.

Replace my-dev-project with the Google Cloud Platform project ID for the Actions Console project you created. To find the project ID in the Actions Console, select the project, click the gear icon, and select Project settings.

Replace my-model with the name of the model you created in the previous step.

techiesms

Sachin Soni is a techie by passion and by profession. He used to explore
in different sectors of innovations and technology on daily basis. Doing
several internships in different sectors of electronics and communication
sachin started his own YouTube channel with 0 subscriber on Dec 2015 to
5000+ subscribers in Feb 2018 on which he used to share his knowledge
by uploading project tutorial on IoT, Connected Devices,Home automation etc.
He has expertise in the field of IoT and automation and his videos ranks
in Top 10 search results on YouTube India page.