Now that you have everything set up, it's time to use the Google Voice Assistant. Let's put a script on the Pi, run it and look at some of the things it can do.

First make sure you are in the Virtual Environment. If you have exited for some reason such as restarting the Pi, you can get back in by typing:

source env/bin/activate

Running the Google Assistant Script

We wrote a script that will make use of the on-board DotStar LEDs and button on the BrainCraft HAT to make it easier to use the Google Assistant. Below is the full script. You can either save it onto your Pi by copying it below or you can type:

wget https://raw.githubusercontent.com/adafruit/Adafruit_Learning_System_Guides/master/BrainCraft_Google_Assistant/gv_buttontotalk.py

and it will save it directly to the Pi.

Associating your Project ID and Model ID

Google recently made a change that requires you to run a sample script that will associate your Hardware Model ID and Project ID for the main script to work. This step only needs to be done once. To get your Project ID you can open your client_secrets.json file and find it there.

If you saved your Model ID during the Google Setup, you're all set. If not, you can find it by following these steps.

Open the Actions console at https://console.actions.google.com/u/0/. Select your Project.

Click the Develop Tab at the top, then select Device Registration, then click on the product name.

Run the following command, swapping out [Your Project ID] and [Your Model ID] with the appropriate values:

googlesamples-assistant-pushtotalk --project-id [Your Project ID] --device-model-id [Your Model ID]

Press Control-C to exit the script. Now you're ready to run the project script.

Running the Project Script

To run the main script, type:

python3 gv_buttontotalk.py

Wait a few seconds until the script tells you to press a button and then press the button on the BrainCraft HAT. The lights should turn green, meaning it is waiting for you to give it a command or ask a question.

Phrases to Try

Try asking some of these phrases:

What is the weather?

What movies are playing?

What is your favorite color?

What are the directions to the nearest grocery store?

This guide was first published on Oct 21, 2020. It was last updated on Oct 21, 2020.

This page (Usage) was last updated on Oct 15, 2021.

Text editor powered by tinymce.