Running Google Assistant on a Raspberry Pi turns it into a fully self-hosted smart speaker you control completely. This Google Assistant Raspberry Pi guide covers audio device configuration, obtaining OAuth credentials, and running the assistant for the first time.
Google Assistant Raspberry Pi: what you need
- Raspberry Pi 2 or 3 (Pi 3 recommended for the extra CPU headroom)
- USB microphone
- Speaker via 3.5 mm jack or USB
- A Google account with access to the Google Cloud Console
Step 1 — Configure audio devices
List available recording devices and note the card and device numbers for your USB microphone:
arecord -l
List playback devices:
aplay -l
Create ~/.asoundrc, replacing <card> and <device> with your values from above:
pcm.!default {
type asym
capture.pcm "mic"
playback.pcm "speaker"
}
pcm.mic {
type plug
slave { pcm "hw:<card>,<device>" }
}
pcm.speaker {
type plug
slave { pcm "hw:<card>,<device>" }
}
Test playback:
speaker-test -t wav
Record and play back a 5-second clip to confirm the microphone works:
arecord --format=S16_LE --duration=5 --rate=16000 --file-type=raw out.raw
aplay --format=S16_LE --rate=16000 out.raw
Step 2 — Create a Google Cloud project
- Go to the Google Cloud Console and create a new project.
- Enable the Google Assistant API for that project.
- Go to APIs & Services → Credentials and configure the OAuth consent screen.
- Click Create Credentials → OAuth client ID. Choose Desktop app and give it a name.
- Download the resulting JSON file — this contains your client ID and secret.
Step 3 — Install the Assistant SDK
Copy the downloaded JSON to your Pi, rename it to assistant.json, and place it in /home/pi/. This is the last configuration step for your Google Assistant Raspberry Pi setup. Then:
git clone -b voicekit https://github.com/google/aiyprojects-raspbian.git ~/voice-recognizer-raspi
cd ~/voice-recognizer-raspi
scripts/install-deps.sh
sudo scripts/install-services.sh
ln -s assistant_library_with_local_commands_demo.py src/main.py
sudo apt-get install python3-dev python3-venv
python3 -m venv env
env/bin/python -m pip install --upgrade pip setuptools
source env/bin/activate
python3 src/main.py
Your Google Assistant Raspberry Pi is now authorised. The first run prints an authorisation URL. Open it in a browser, grant permissions, and paste the code back into the terminal. Your credentials are saved locally — you will not need to repeat this.
Once authorised, say “Ok Google” and ask your new assistant a question. You now have a fully self-hosted Google Assistant running on a Raspberry Pi. This project is based on the Google AIY Voice Kit. More tutorials on the blog.