in

Create your own DIY Google Assistant Smart Speaker Tutorial

The Google Home is the best implementation of Google Assistant, but let’s try to make a cheap alternative.

The human race is always on the lookout for better tech at lower prices than the existing ones. Of course the Google Home is the smartest speaker available right now – controlling home appliances,lighting,handling questions asked to & does much more.

The hassle of calling out Hey Google every time for a new conversation has also changed following the ‘Continued Conversation’ feature which does capture a lot of idle voice data for sure – but hey it isn’t a big deal since the internet giant already knows much more about you.

Now, we’ll be showing you how to build your own DIY Google Assistant powered Smart Speaker from scratch. We’ll need a few hardware to get started. The links for purchasing will be provided at the end of post. Don’t worry,you can reuse these things for any other project.

Items required

1. Raspberry Pi 3 B+ Board

2. USB Microphone

3. AUX Cable

4. A cheap speaker with AUX input (if you have a Bluetooth speaker with aux input, that can be used

5. A Keyboard & Mouse (Assumed to be already with you)

6. HDMI Cable to connect & configure Raspberry Pi using a TV or any monitor

7. Micro-SD card for installing Raspbian OS

Configuring Raspberry Pi

First of all download NOOBS easy installer for Raspberry Pi from here. Now extract the Zip, format the MicroSD card to FAT32 & copy the contents of the Zip to it. Hook up the Pi to an external display via HDMI & insert the MicroSD card in. Power ON & you’ll find the installation prompt.

raspbian noobs install

Select Raspbian & then proceed with the install. It will take some time, once it is complete, go to Interfaces Menu in Raspberry Pi Configuration & enable all interfaces. This step is important as when you’re install Google Assistant, you won’t be facing any bottlenecks.

Configuring Google Assistant SDK Actions

Go to Google Assistant Actions Console.Click on Add Project & type in a Project Name of your choice (keep it short). If you created a new project, click the Device registration box near the bottom of the page.Enable the Google Assistant API on the project you selected. You need to do this in the Cloud Platform Console.

google assistant

You must configure the OAuth consent screen for your project in the Cloud Platform Console. Note that most fields on this page are optional.Open the Activity Controls page for the Google account that you want to use with the Assistant. You can use any Google account, it does not need to be your developer account.

Now enable Google Custom Search API from this link : https://developers.google.com/custom-search/v1/overview

The custom search API key should be noted & will be the key you will use to access Google Assistant.

google assistant

Back to Device Regsitration screen, Click the REGISTER MODEL button.

  • Fill out all of the fields for your device. Select any device type, such as Speaker.
  • When you are finished, click REGISTER MODEL.

Create your own DIY Google Assistant Smart Speaker Tutorial

Make sure to check all the 7 traits for the Assistant to ensure maximum compatibility. Now download the client_secret_xxxx.json file & place it into /home/pi directory.

Now go to back to Google Cloud Console & enable Youtube Data API & Google Location API & You’re done.

 

Installing Google Assistant

First of all Big Shoutout to Shiva Siddharth. He’s the one who maintains this project on Github. The instructions we follow are the steps he recommended. For the start, open a terminal window on Raspberry Pi.

It is very important to upgrade operating system core & package cache – so that it can find latest software repositories. For that run the command :

sudo apt-get update


Once its done, you need to clone the project onto your Pi. For that type in

sudo apt-get install git
git clone https://github.com/shivasiddharth/Assistants-Pi

Now connect to USB Microphone & Speaker to the Raspberry Pi. Then make the Google Assistant installer executable using the following commands. Make sure to select USB-MIC-JACK when audio the audio configuration menu is displayed.

sudo chmod +x /home/pi/Assistants-Pi/scripts/prep-system.sh

sudo chmod +x /home/pi/Assistants-Pi/scripts/audio-test.sh

sudo chmod +x /home/pi/Assistants-Pi/scripts/installer.sh

Execute the system preparation script using this command :

sudo /home/pi/Assistants-Pi/scripts/prep-system.sh

At this point, you should hear audio from the connected speaker. If it didn’t, then double check the connections & the speaker & if connections are fine – re execute the above commands once again. If audio is heard from the speaker, then restart Raspberry Pi.

If the sound isn’t heard, open up another terminal & type :

sudo leafpad /etc/asound.conf

And in another terminal, type in

sudo leafpad ~/.asoundrc

If the contents of both files match, then you shouldn’t have any problem. But if it isn’t then copy the contents from asound.conf to .asoundrc & save the file. Now run the command to test audio.

sudo /home/pi/Assistants-Pi/scripts/audio-test.sh

Now reboot the RaspberryPi & then run the following command to install Google Assistant. (This script can also be used to install Amazon Alexa,but Alexa uses more system resources so we don’t recommend it.)

sudo /home/pi/Assistants-Pi/scripts/installer.sh

After verification of the assistants, to make them auto start on boot:
Pi 3 and Pi2 users, open the gassistpi-ok-google.service in the /home/pi/Assistants-Pi/systemd folder and add your project-id and model-id in the indicated points.

Now run the following commands –

sudo chmod +x /home/pi/Assistants-Pi/scripts/service-installer.sh

sudo /home/pi/Assistants-Pi/scripts/service-installer.sh

sudo systemctl enable gassistpi-ok-google.service

 

Enabling Google Music Streaming in Google Assistant

By default, you can ask Google Assistant to play music from Youtube Music library. But if you want it is possible to stream music using Google Play Music. For this – configure th GMusic API using the following command.

/home/${USER}/env/bin/python -u /home/${USER}/GassistPi/Extras/gmusicauth.py

Follow the instructions which is displayed on the terminal to authenticate the API. Once done, you’re all set!!

diy google assistant smart speaker

Now you can use your very own DIY Google Assistant smart speaker to play music, search internet, get locations & much more. Have fun tinkering with settings.

 

Top post on IndiBlogger, the biggest community of Indian Bloggers

What do you think?

Written by TechBuzzIn Mediaworks

Tech News & Gadget reviews powered by TechBuzzIn Mediaworks.
Propagating the best of technology. Always.
Estd. 2016 as a startup tech news agency.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading…

0

Comments

0 comments

Things You Should Remember If You Work Online - Money Making Apps

Things You Should Remember If You Work Online – Money Making Apps

wd my passport

WD My Passport Portable Hard drive review – The best one for the price