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.
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 a couple of times to exit the script. Now you're ready to run the project script.
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.
Page last edited March 08, 2024
Text editor powered by tinymce.