GassistPi (Google Home in Raspberry Pi)

by nicolei28 in Circuits > Raspberry Pi

22881 Views, 98 Favorites, 0 Comments

GassistPi (Google Home in Raspberry Pi)

20171111_002404.jpg
20171111_002336.jpg

Google Assistant for Raspberry Pi!

Gathering Materials & Tools

20171107_135124.jpg
20171107_135223.jpg
20171107_144625.jpg
20171107_135719.jpg
20171107_135555.jpg
20171107_135338.jpg
20171107_140017.jpg
20171107_140410.jpg
20171107_140824.jpg
20171107_141330.jpg
20171107_140855.jpg
20171107_141122.jpg
20171107_141743.jpg
20171107_141445.jpg
20171107_144319.jpg
20171107_141009.jpg
20171107_144354.jpg
20171107_144511.jpg
  1. Raspberry Pi 3 Model B (You can also use other raspberry pi version but you need Wi-Fi to run this)
  2. 8GB Micro SD Card
  3. Micro SD Card Reader
  4. USB Microphone
  5. USB Powered Speakers
  6. 3.5mm Jack Splitter
  7. 5V 2A USB Power Adaptor
  8. Micro USB Cable
  9. Female to Male Jumper Cables
  10. Breadboard
  11. LEDs (any color you want)
  12. Phillips Screwdriver
  13. Phillips Screws
  14. Electrical Tape
  15. Soldering Iron & Stand
  16. Soldering Lead
  17. Wire Cutter
  18. Ketchup Jug (I've already cut it :) )
  19. 100/150/330 ohms resistor

Flashing Raspbian to Micro SD Card

ss1.PNG
  1. Download Raspbian or Raspbian Lite
  2. Download & Install Etcher
  3. Plug the Micro SD Card Reader with the Micro SD Card in it.
  4. Open Etcher
  5. Click on Select Image and browse the download location of Raspbian/RaspbianLite Zip
  6. Click on Select Drive and find the drive of your micro sd card reader.
  7. Then lastly click on "Flash!"

This could take 10-30 minutes so sit back, relax and eat pie :)

Power Up Your Raspberry Pi!

20171107_181722.jpg

Now after we flash the micro sd card we may now able to boot this raspberry pi to raspbian :)

Plug the raspberry pi to your monitor with the hdmi cable.

Installing GassistPi

Screenshot-2017-11-7 shivasiddharth GassistPi.png
ss2.PNG
Screenshot (1).png

Now after you boot up your raspberry pi you may now go this Github Repository of GassistPi and you may also follow the guide there.

1. Open terminal and clone the repository

git clone <a href="https://github.com/shivasiddharth/GassistPi" rel="nofollow">https://github.com/shivasiddharth/GassistPi</a>

2. Update OS and Kernel

sudo apt-get update
sudo apt-get install raspberrypi-kernel

3. Restart your Raspberry Pi After booting up open your terminal again and execute this command because we'll going to use usb mic and the onboard audio jack (PLUG YOUR USB MIC AND SPEAKER FIRST BEFORE EXECUTING THE COMMAND)

sudo chmod +x /home/pi/GassistPi/audio-drivers/USB-MIC-JACK/scripts/usb-mic-onboard-jack.sh
sudo /home/pi/GassistPi/audio-drivers/USB-MIC-JACK/scripts/usb-mic-onboard-jack.sh

4. Download credentials--->.json file (refer to this doc for creating credentials https://github.com/shivasiddharth/GassistPi

5. Place the .json file in/home/pi directory

6. Rename it to assistant.json

7. Using the one-line installer for installing Google Assistant and Snowboy dependencies Pi3 and Armv7 users use the "gassist-installer-pi3.sh" installer and Pi Zero, Pi A and Pi 1 B+ users use the "gassist-installer-pi-zero.sh" installer. Snowboy installer is common for both

7.1 Make the installers Executable

sudo chmod +x /home/pi/GassistPi/scripts/gassist-installer-pi3.sh 
sudo chmod +x /home/pi/GassistPi/scripts/gassist-installer-pi-zero.sh 
sudo chmod +x /home/pi/GassistPi/scripts/snowboy-deps-installer.sh 

7.2 Execute the installers (Run the snowboy installer first. Don't be in a hurry and Don't run them parallely, Run them one after the other

sudo  /home/pi/GassistPi/scripts/snowboy-deps-installer.sh 
sudo  /home/pi/GassistPi/scripts/gassist-installer-pi-zero.sh 
sudo  /home/pi/GassistPi/scripts/gassist-installer-pi3.sh 

8. Copy the google assistant authentication link from terminal and authorize using your google account

9. Copy the authorization code from browser onto the terminal and press enter

10. Move into the environment and test the google assistant according to your board

source env/bin/activate 
google-assistant-demo 
(say the hotword "ok google")
or
source env/bin/activate
googlesamples-assistant-pushtotalk

11. To make our google assistant autostart when the raspberry pi is on run this commands

sudo chmod +x /home/pi/GassistPi/scripts/service-installer.sh
sudo /home/pi/GassistPi/scripts/service-installer.sh
sudo systemctl enable gassistpi-ok-google.service
sudo systemctl enable snowboy.service
sudo systemctl start gassistpi-ok-google.service
sudo systemctl start snowboy.service

12. Restart your raspberry pi and your google assistant will autostart

Customization of Your GassistPi

2017-11-07-121359_1280x720_scrot.png
2017-11-07-121409_1280x720_scrot.png
2017-11-07-150033_1280x720_scrot.png
2017-11-07-150023_1280x720_scrot.png
raspberry_pi_gpio-shutdown-pins.png
20171107_225212.jpg
Google Assistant Lights Demo

To feel the real "Google Home" we will be adding custom sounds and led light response.

Changing the sounds

Download my custom sounds

1. Put the downloaded sounds in /home/pi/GassistPi/sample-audio-files

2. Now go to /home/pi/GassistPi/src then open main.py

3. Find & Replace Startup.wav to on.wav

4. Find & Replace Fb.wav to respond.wav

5. Then Save

Adding LED Lights Response

In GassistPi Pin 05 & Pin 06 is Google assistant listening and responding but we'll be adding an extra led to let us know if google assistant is started

In main.py we'll add in #Indicator Pins

GPIO.setup(13,GPIO.OUT)
GPIO.output(13, GPIO.HIGH)

In ON_CONVERSATION_TURN_STARTED add this line

GPIO.output(13, GPIO.LOW)

In ON_CONVERSATION_TURN_STARTED add this line

GPIO.output(13, GPIO.HIGH)

You can download the main.py and replace your main.py in /home/pi/GassistPi/src

Enclosure

20171110_201743.jpg
20171110_215242.jpg
20171110_221040.jpg
20171110_221047.jpg
20171111_002336.jpg
20171111_002404.jpg

I know you can make much more beautiful enclosure :) but i'll show you on how i make this enclosure for my Google Assistant :)


I transfer the leds from breadboard to female to female jumper cables.

My father helps me to saw the scrap wood for the base and middle for the enclosure.

The base wood i attached 1 speaker on it.

The middle wood i attached the 2 speaker at the bottom and raspberry pi at the top

The leds, i use hot glue to attach it at the top of enclosure

For speakes holes and microphone holes, i use my soldering iron to put holes at the bottom of my enclosure and 2 holes at the top.

Conclusion.

Google Assistant in Raspberry Pi
LightshowPi demo

This project cost less than $50 (Php 2563.70) to make.


This GassistPi project can also helps you to automate your house. It can trigger On/Off relay.

I also added LightshowPi (http://lightshowpi.org/) in this project so when i play music on it the lights will follow on it :)

If this project is awesome please vote this entry for "Raspberry Pi" & "Wireless" contest :) Thanks!