Voice activated Google Assistant on Raspberry Pi with visual feedback

How to enable Ok google in Google Home running on raspberry pi.

Add visual notifications

It allows us to understand what is the current state of our Raspberry Pi assistant

Blue Light : Google  Assistant is listening.

Red :Ligh : Google Assistant is saying something.


Coding part

Clone the Google SDK git repository  to home directory .

Now edit the hotword.py file


sudo nano /home/pi/assistant-sdk-python/google-assistant-sdk/googlesamples/assistant/library/hotword.py

Modify the contents [ changes/ additions are highlighted ]

Install RPI GPIO in virtual environment 

pip3 install RPi.GPIO


Run as a Service

Make sure that you are in virtual environment 

(env) pi@raspberrypi:~ $

else run

source /home/pi/env/bin/activate


We need to create an shell script to enable virtual environment “hotword.sh “

nano /home/pi/assistant-sdk-python/google-assistant-sdk/googlesamples/assistant/library/hotword.sh

To run as a service you need to create a service file in /lib/systemd/system/ folder

sudo nano /lib/systemd/system/assistant.service

Enable and start service

sudo systemctl start assistant.service

Check Status of the service

sudo systemctl status assistant.service

Enable service

sudo systemctl enable assistant.service

All cotents are also in Gist: https://gist.github.com/arevindh/ae50e18394625747e6beae600b10e374

Enable GPIO in env
pip3 install RPi.GPIO

USB Sound Card Adapter