To set up Google Assistant on Raspbian, the only things you need are a Pi 2 or 3, a speaker, and a microphone. You can optionally wire an LED to GPIO pin 25 to add a visual status indicator.
NOTE: As of 2018-08-03, these instructions no longer work because Google has changed the installation process for the Assistant SDK. I have created a GitHub repo with new instructions, please try them instead: https://github.com/t1m0thyj/AssistantPi
- Follow these steps to add a Google Assistant device to your Google account:
https://developers.google.com/assistant ... nd-account
Step 4 is confusing and can be ignored (step 2 below replaces it). - The JSON file that you downloaded needs to be copied to your Pi. Copy it to the /home/pi directory and rename it to assistant.json.
- Open a terminal on the Pi and run these commands:
The last two commands set up the voice recognizer service, which runs Assistant when the Pi boots.
Code: Select all
git clone https://github.com/google/aiyprojects-raspbian.git ~/AIY-projects-python cd ~/AIY-projects-python wget https://raw.githubusercontent.com/google/aiyprojects-raspbian/voicekit/scripts/install-deps.sh -nc -P scripts chmod +x scripts/install-deps.sh scripts/install-deps.sh sudo scripts/install-services.sh echo "$HOME/AIY-projects-python/src" > $HOME/AIY-projects-python/env/lib/python3.5/site-packages/aiy.pth ln -s examples/voice/assistant_library_with_local_commands_demo.py src/main.py sudo systemctl enable voice-recognizer.service
- If you are using a USB microphone, some audio settings on the Pi must be changed for it to work with Assistant. Follow steps 2 and 3 here to fix it:
https://developers.google.com/assistant ... ware/audio
The (card number, device number) values that you want will likely be 1,0 for the mic and 0,0 for the speaker. - Open a terminal window and run these commands:
If there is a web link in the terminal, click it to grant the necessary permissions to your Google account.
Code: Select all
cd ~/AIY-projects-python source env/bin/activate python3 src/main.py
- You should now be able to say "OK Google" and have a conversation with your Pi. Try rebooting your Pi (saying "OK Google reboot" should do this), and test that Assistant still works after booting without having to start it manually.
- If you want to code custom actions for Google Assistant, they can easily be added in the Python script src/main.py. Details about how to do this can be found in Google's Maker's Guide for this project: https://aiyprojects.withgoogle.com/voice#makers-guide
- https://developers.google.com/assistant ... op/python/
- https://github.com/google/aiyprojects-r ... HACKING.md
- http://eduncan911.com/stem/embedded/aiy ... -2017.html
To update the Assistant API on Raspbian to a newer version, run these commands:
Code: Select all
cd ~/AIY-projects-python
git checkout aiyprojects
git pull origin aiyprojects
rm -rf ~/AIY-projects-python/env
scripts/install-deps.sh
sudo systemctl restart voice-recognizer.service