Introduction: Hands Free Google Assistant for Raspberry Pi

Hello and welcome to my first Instructable!

In this instructable I am going to show you what I consider to be the easiest way to install an all singing, all dancing Google Assistant on your Raspberry Pi. She is completely hands free with the OK Google command and she starts up automatically when you boot up your Pi. She's super cool and seriously easy to setup!

So how's this all possible?

A short while ago Google released a do-it-yourself AI kit with issue #57 of The Magpi. This made it extremely easy to create your own Google assistant however getting hold of the voice kit was little bit harder and in many places it sold out within hours.

Fortunately, Google made all the software available online complete with full instructions. This meant that we did not need a copy of The Magpi to take advantage of all that hard work.

Despite this, there doesn't appear to be any clear instructions online on utilizing the voice kit without a copy of the magazine or without the hardware that was shipped with it. Instead, most of the tutorials attempt to install everything from scratch often resulting in mess of code that's impossible to follow for non-coders like me.

And that's where this Instructable comes in. It is the outcome of 2 days hard work looking at hundreds of tutorials, videos and posts online. The result is a stable Google Assistant which runs on startup and is voice activated with the 'OK Google' hotword.

What’s required?

To complete this Instructable successfully you will need the following:

  • A Raspberry Pi 3 (with the usual microSD card and power cord). *Thank you to MichaelW142 who has confirmed that this also works with Raspberry Pi 2.
  • A basic speaker with a 3.5 mm aux connection
  • A USB microphone
  • A mouse and keyboard

Step 1: Formatting the SD Card

Picture of Formatting the SD Card

The very first thing that we need to do is to format our SD card. Let’s use the SD Association's Formatting Tool which is recommended by the official Raspberry Pi Foundation.

Once installed, launch the application and click ‘Option’ You need to change the option for ‘FORMAT SIZE ADJUSTMENT’ to ‘ON’.

Now click ‘OK’ and double check that we are formatting the correct drive, then click ‘Format’. This shouldn’t take too long, just wait for the confirmation that the drive was formatted successfully before you move onto the next step.

Step 2: Preparing the SD Card

Picture of Preparing the SD Card

Next we need to download the Voice Kit microSD card image for the Raspberry Pi. You can download the image from my Google Drive.

In order to transfer the image that we just downloaded onto our SD card we are going to use a program called Etcher.io. It’s free, open source and does not require installation.

Once you’ve downloaded Etcher, run the program and you should see a screen like the one above. It can take a minute or two to load so if it doesn’t load right away be patient.

Click ‘Select image’ and navigate to the voice kit image that we just downloaded (aiyprojects-2017-05-03.img). Once selected double check that you are writing the contents onto the correct disk. Assuming that we have the correct disk selected then click ‘Flash!’.

It can take around 20 minutes or more to write the image to your SD card so feel free to go and make yourself a nice cup of tea and I will see you back here in a bit!

Step 3: Power Up That Pi!

Picture of Power Up That Pi!

As soon as the SD card is ready we can put the microSD card into our Raspberry Pi. At this point we also need to connect our power lead, HDMI cable, keyboard, mouse, monitor, speaker and USB microphone. Hopefully your setup should look something like mine.

I am using a wireless keyboard and mouse so don’t freak out if you end up with a couple of extra cables with your own setup!

With the power cable plugged in allow your Raspberry Pi to boot up and you will soon be presented with the standard Pixel desktop.

Step 4: Initial Configuration

Picture of Initial Configuration

Grab your cursor and navigate to the Raspberry Pi logo at the top left of your screen. From the dropdown select ‘Preferences’ and then ‘Raspberry Pi Configuration’.

Next, go to ‘Interfaces’ and enable 'SSH'.

Now click on the WiFi logo at the top right of the screen and select your WiFi network. If your WiFi is password protected you will prompted to enter that in. The green tick confirms that we connected successfully and we’re ready to move onto the next step.

Step 5: Updating the Installation

Picture of Updating the Installation

This is about as advanced as this tutorial gets. We are going to use the dev terminal to update the Google Assistant SDK, Project Kit & dependencies to ensure we have the latest versions. Do not panic if none of this makes much sense to you but it is essential that we do not skip this step. Just do exactly as this tutorial says being careful not to make any typos and it will all work out just fine.

So, panic over, let’s begin! Double click on the desktop icon name ‘Start dev terminal’.

You should see a scary looking dev terminal window like the one above.

Next type the following commands into the terminal exactly as they appear below. There are 9 commands here and each should be entered separately in the order in which they appear. After typing each command hit ‘Enter’ on your keyboard before moving onto the next one. Some of the commands will take a few seconds to complete so be patient waiting for each to finish before moving onto the next one.

cd ~/assistant-sdk-python
git checkout master
git pull origin master
cd ~/voice-recognizer-raspi
git checkout master
git pull origin master
cd ~/voice-recognizer-raspi 
rm -rf env
scripts/install-deps.sh

Step 6: Preparing the Configuration Files

Next we need to backup our existing configurations files and bring over the newest versions that were just updated. Here’s 4 more commands for you to do just that. These can be done in the same dev terminal that we were just using. Once again, they must be done in this order and should be typed precisely as they appear below:

cp ~/.config/status-led.ini ~/.config/status-led.ini~
cp ~/.config/voice-recognizer.ini ~/.config/voice-recognizer.ini~
cp ~/voice-recognizer-raspi/config/status-led.ini.default ~/.config/status-led.ini
cp ~/voice-recognizer-raspi/config/voice-recognizer.ini.default ~/.config/voice-recognizer.ini

Step 7: Setting Up the Hotword

Picture of Setting Up the Hotword

Awesome work so far! We are getting really close now so hang in there.

We now need to change the trigger for our Google AIY project kit so that it responds to our voice when we speak the words ‘OK Google’.

Type the following command into the dev terminal:

nano ~/.config/voice-recognizer.ini

This will produce this even scarier window.

Within this new window, look for the following code:

# Select the trigger: gpio (default), clap, ok-google.
# trigger = clap

We need to change this code to:

# Select the trigger: gpio (default), clap, ok-google.
trigger = ok-google

If you use the arrow keys on your keyboard you will notice a curser appears. Using the arrow keys, bring the curser down to the line of text that we are trying to change. Using the backspace key on your keyboard delete the line of text that we are trying to change and retype it just like the example above.

Notice that I have also removed the # symbol, it is important we do not include the # in this new line of text.

I have attached a before and after screenshot of what this should all look like (encase I lost you there).

Assuming your window looks exactly like mine we can close and save the changes. Hold ‘Ctrl’ on your keyboard and press ‘X’ to close the window. We will then be prompted to save the changes we made, press ‘Y’ and then hit ‘Enter’ on your keyboard. The window will now close and the changes have been saved.

To ensure the changes have taken affect we need to restart the service. Type the following command into the terminal window and hit ‘Enter’:

sudo systemctl restart voice-recognizer.service

Step 8: Audio Configuration (Part 1)

Picture of Audio Configuration (Part 1)

Right now Google Assistant more or less alive and ready to serve.. Congratulations!

However, before you get too excited, you cannot hear each other. That’s because the Google AIY Project Image was configured to work with the hardware that was shipped with the kit. Since we are using a standard aux speaker and usb microphone we need to tweak some of the configuration.

Once again we will use the same dev terminal window, this time type:

sudo leafpad /boot/config.txt

This will open a text window. Scroll to the very bottom of the document and remove the # in front the the line dtparam=audio=on and insert a # in front of the two lines below it.

After you have made these changes it should exactly like this:

# Enable audio (loads snd_bcm2835)
dtparam=audio=on
#dtoverlay=i2s-mmap
#dtoverlay=googlevoicehat-soundcard

I have also attached a screenshot to show you what this will look like.

Go to ‘File’ then click ‘Save. You can now close the document.

Step 9: Audio Configuration (Part 2)

Picture of Audio Configuration (Part 2)

Back in the dev terminal again, type:

sudo leafpad /etc/asound.conf

When you hit ‘Enter’ a new text document will open. This time delete ALL the text within the document and replace it with the following:

pcm.!default {
type asym capture.pcm "mic" playback.pcm "speaker" } pcm.mic { type plug slave { pcm "hw:1,0" } } pcm.speaker { type plug slave { pcm "hw:0,0" } }

Again I have attached a screenshot showing you what this will look like.

Once again save and close the document.

Now it is time to reboot your Raspberry Pi. Click on the Raspberry Pi logo at the top left of your screen and click on ‘Shutdown’ then ‘Reboot’.

After you have rebooted the Pi we have just one more tweak to make. Double click on the ‘Start dev terminal’ icon once again and type the following:

leafpad /home/pi/voice-recognizer-raspi/checkpoints/check_audio.py

In this final document you need to locate the line of code that reads:

VOICEHAT_ID = ‘googlevoicehat’ 

Change this to:

VOICEHAT_ID = ‘bcm2835’

Once you have made these changes, just as we did before, save then close this document.

Step 10: Testing the Audio

Picture of Testing the Audio

On the desktop there is a file called ‘Check audio’. Double click on this and follow the prompts to ensure that both the speak and microphone is working.

If you followed this Instructable correctly there should be no problems. However if you cannot hear anything, double check that the volume is turned up and that your Raspberry Pi is using ‘Analog’ for sound output. You can do this by right-clicking on the sound icon at the top of the screen. ‘Analog’ should be ticked just like the example in the screenshot.

Assuming you passed the audio check, we can move onto the next step.

Step 11: Connecting to the Cloud

Before Google Assistant will give us answers to life’s burning questions we need to connect her to Google’s Cloud Services.

This is easy to do but if you haven’t been in the cloud before then it may seem a bit daunting at first.

Here’s what we need to do:

1) On the Raspberry Pi open up the Chrome internet browser and go to the Cloud Console: https://console.cloud.google.com/

2) Sign in with an existing Google account or sign up if you do not have one.

3) Create a new project and give it a name. I called mine ‘Google Pi

4) Using the search bar start typing ‘Google Assistant’ and you should see the ‘Google Assistant API’. Click on it and then when the next page loads click ‘Enable’ to activate the API.

5) Go to ‘API Manager’ then ‘Credentials’ and create an ‘OAuth 2.0 client’.

6) Click ‘Create credentials’ and select ‘OAuth client ID’. If you have never been in the cloud before then you will now be prompted to configure your consent screen. You’ll need to name your app, I called mine 'Raspberry Pi'. All other fields can be left blank.

7) In the Credentials list, find your new credentials and click the download icon on the right.

8) The chrome browser will now download a small JSON file with all your credentials stored safely inside. Find this file and rename it to ‘assistant.json’ then move it to /home/pi/assistant.json.

9) Finally, go to the Activity Controls page: https://myaccount.google.com/activitycontrols and turn on the following services: Web and app activity, Location history, Device information, Voice and audio activity. Be sure to log in with the same Google account as before!

If you got stuck at any point during this stage, do not freak out, Google has done an excellent job at documenting this process with screenshots for each step over on the Google AIY Kit website.

Step 12: Final Testing

Picture of Final Testing

If everything was setup correctly in the cloud we are now ready to talk to Google. Using the ‘Start dev terminal’ command window again, type the following:

src/main.py

This will wake up our assistant but since this is the first time that we are connecting to Google’s Services, a web browser will open and you will need to login to Google to give permission for the Raspberry Pi to access the Google Assistant API. Again making sure that you use the same Google account logins as you did before.

Once you have logged in successfully and granted permission you will be prompted to close the window. The command window will now look like the screenshot attached confirming that everything was setup correctly.

Go ahead, ask a question, she’s listening!

Before you get too excited though, we are not quite finished. When you have finished playing, close the window, to do this just use the white cross at the top right of the window.

Step 13: Setting Up Google Assistant on Startup

I promised you that our Google Assistant would startup automatically when we power up the Raspberry Pi. To do this, open a fresh command window using the ‘Start dev terminal’ icon on the desktop. Type the following line of code into your terminal window and hit ‘Enter’ on your keyboard:

sudo systemctl enable voice-recognizer

We just configured auto startup of our Google Assistant with one line of code.. How easy was that!!

Step 14: The Finish Line

Now that you have completed all the steps go ahead and reboot your Raspberry Pi. If you have followed all these instructions carefully then Google Assistant should be running in the background when the Pi loads up. Give it a try, say OK Google to wake her and ask her anything you like!

I really hope you liked this Instructable. It is a result of 2 days hard work and lots of online reading. I am definitely not a coder so I have tried to find the easiest and most logical way to get a working Google Assistant onto a Raspberry Pi and I believe this is it.

If you have any questions or suggestions with regards to this Instructable please let me know in the comments below. I would also love to hear how yours turned out.

I read a lot of tutorials, blog posts and forum entries but my biggest breakthroughs with this project came from 2 posts online that were both trying to accomplish similar tasks: http://eduncan911.com/stem/embedded/aiy-google-assistant-upgrades-may-2017.html and http://www.androidauthority.com/build-google-assistant-raspberry-pi-770296/. This Instructable is a result of figuring out how to put the two together in an easy and straight forward Instructable!

Extra Credits

- The Google Assistant SDK already has a huge number of features built-in however there are lots of 'mods' that you can add to the AIY Kit to give it some extra functionality. Ktinkerer has an up to date list of the latest mods available, check it out!Thank you cyberwolves for pointing this out :)

- How about a speaker enclosure for your squeeky new AI? Checkout this one by adylinn.

If you can think of anything else to add to this Instructable, please get in touch :)

Comments

cyberwolves (author)2017-11-03

Hi Luke iv Made a acrylic enclosure https://www.youtube.com/watch?v=RwEUgeOBNx0

siderio2 (author)2017-10-28

Thanks a lot for this great tutorial, Luke!!

But I'm not making it work :(

When I try the audio check step, the only response I get is a terminal opening and immediately closing. I saw a comment where the same happened to another guy, but it worked anyway. Sadly, that's not my case, because when I run src/main.py, it shows this error message:

[1813:1834:ERROR:audio_input_processor.cc(755)] Input error

[2017-10-28 23:00:26,726] INFO:root:ON_MUTED_CHANGED:

{'is_muted': False}

[2017-10-28 23:00:26,727] INFO:root:ON_START_FINISHED

[2017-10-28 23:00:26,728] INFO:main:ready...

Say "OK, Google" then speak, or press Ctrl+C to quit...

[2017-10-28 23:00:26,730] INFO:root:ON_ASSISTANT_ERROR:

{'is_fatal': True}

Anyone can help, please???

Thanks in advance.

kbear99 (author)2017-10-25

Luke, thanks for this awesome instructable. As a linux noob I understood almost none of what I was doing yet it still worked perfectly, so you did an amazing job.

I did have an initial hiccup, but that was because of my own errors. The following additions to your instructions might help others like me.

1) Step 5: Do NOT use the regular terminal. Use only the Start dev terminal icon.

2) Step 11: When creating credentials, the Application Type should be 'Other'. Also, the AIY Kit website cannot be viewed in Firefox, so choose another browser. (I thought the site was down but it turned out to be the browser).

kishorek24 (author)2017-10-24

Thanks

SimonF90 (author)2017-10-22

hey great tutorial, so far ive only had one issue and that is with the sound, analog is ticked, ive gone back into the sound files that were edited and its the exact word/code for word/code. i am using the PI2 mod b. i have not gone passed this step. thanks for your help in advanced. using hdmi to monitor.

SimonF90 (author)SimonF902017-10-22

figured it out :) went into preferences/audiodevice settings/ select controls/ selected PCM and made it default and it came through :)

LukeK1990 (author)SimonF902017-10-22

Hey Simon, glad you got it sorted.. Congrats. And thanks for posting the solution for others to see :)

SimonF90 (author)SimonF902017-10-22

i forgot to mention, no sound is playing when the check sound is executed. i have also tried playing audio through youtube and im getting nothing at all. either my audio track on the pi is busted or ive macked it :P

BradS3 (author)2017-10-21

Just completed this. It took me like six tries. But it was no fault of the tutorial. I am using Adafruits Speaker Bonnet instead of a speaker via the Aux port. Turns out the Speaker Bonnet works out of the box with the AIY so all I had to change in the config file was to add my microphone and to leave the VOICEHAT_ID as is. The rest of it was the same. So cool! Unfortunately the cost is pretty much moot now that the Google Home Mini is out. Great job @creator!!!

LukeK1990 (author)BradS32017-10-22

Hey Brad, congrats on getting it setup. Are you running it on a Pi Zero with the speaker bonnet?

BradS3 (author)LukeK19902017-10-22

I didn't use a Pi Zero... but I could try one out.

LukeK1990 (author)BradS32017-10-22

That’s ok, I just wondered as I looked up the speaker bonnet and see that it’s traditionally used with the Zero. It looks good I may invest in one and see if I can build some sort of enclosure for it.

DigiM4x (author)2017-10-20

Why is it that I have to have a button to speak or ground pin 23 to talk?

LukeK1990 (author)DigiM4x2017-10-21

If you follow the instructions you do not need a button to talk. The hands free function is available after you update the installation as per the steps

wstewl (author)2017-10-16

Thank you! It works!

LukeK1990 (author)wstewl2017-10-17

Congrats :)

TaiN23 (author)2017-08-20

Very nice instruction! Thanks!

I got it working though the audio quality is a bit bad. I hear static when no audio is played or before and after audio is played.

Also, have you got any luck to get it to play music from raspi? "Hey Google, play music" for example?

I tried and it said something like "playing music is not supported on this device"

LukeK1990 (author)TaiN232017-08-21

Hey TaiN23, congrats on getting it up and running!

At first I also had an issue with audio quality, I believe this may be interference. If you move the speaker away from the Raspberry Pi does that resolve the issue? That was certainly the case for me. Also if you have a Bluetooth speaker like mine you could try running the audio through that instead.

With regards to playing music, unfortunately it is not yet supported by the Google AIY project. You can follow the project for updates here: https://github.com/google/aiyprojects-raspbian

Lots of features have been added since the first release and there is still a lot of hard work being put into it. So I expect this will be added at a later date. When the next big update arrives I will post instructions on updating the installation without having to start from scratch.

Let me know how you get on with that audio..

TaiN23 (author)LukeK19902017-08-21

Hi Luke,

Thanks for the advice. I'll try use a longer aux cable. Something else was strange is that if i boot the raspi without hdmi cable plugged in, the speaker produces loud static and stops working!

My speaker has bluetooth as well, so I'm trying to setup with this https://www.raspberrypi.org/magpi/bluetooth-audio-... but having some issue when testing with youtube video. Do you have another instruction to follow?

I need to play around a bit. First time I get my hand on this much technical stuffs!

Will update if i make any progress.

LukeK1990 (author)TaiN232017-08-22

Hey TaiN

I have been working on this today but so far I have had little success. I did get the Bluetooth speaker working. The problem is that when the audio is going through Bluetooth, the microphone stops working.

I will keep working on this but in the meantime if you figure it out then please let me know and I can add it to the end of the Instructable for others that want to use Bluetooth as well.

TaiN23 (author)LukeK19902017-08-23

Hi Luke,

I haven't had much luck with the bluetooth speaker. Which guide are you using?

I am following this guide: http://youness.net/raspberry-pi/bluetooth-headset-... . It connects as output only, and only work with audio file. I could not play anything streamed from the internet (youtube, podcasts...)

Let me know how it goes for you.

Tai

AviW1 (author)TaiN232017-10-02

ummm, guys? the AUX of raspberry pi has REALLY HORRIBLE quality. So do what I do, use an HDMI to VGA + AUX converter and connect your AUX speaker to your Raspberry Pi through that!

LukeK1990 (author)AviW12017-10-17

Nice idea, thank you for pointing that out!

LukeK1990 (author)TaiN232017-08-25

Hi Tai,

I did get the bluetooth speaker working eventually (both speaker and microphone) however I could not get it to work with the assistant. Oddly it did work with the 'Check audio' test on the desktop but for some reason the assistant would not respond. I will try again this weekend but I am hoping a very nice Instructable user with more experience than me sees this and comes to our rescue!

This is the guide that I used to get the speaker working: http://plugable.com/2016/03/14/listening-to-blueto...

I think the reason it does not working with the assistant itself is to do with the configuration that we setup in 'Step 9: Audio Configuration (Part 2)'. I think that would need tweaking slightly for a Bluetooth instead of Aux.

Let me know if you find anything else in the meantime. It would be great to add the Bluetooth option to this Instructable.

JoshAbiS (author)2017-10-12

Hi,
Can i use bluetooth speaker and mic?
Cause it's hard to find any usb mic in my country

LukeK1990 (author)JoshAbiS2017-10-17

Hi Josh, it should be possible. You would need to change the configuration slightly in 'Step 9: Audio Configuration (Part 2)'. You can work out the correct configuration for your setup using Google's own troubleshooting guide found here: https://developers.google.com/assistant/sdk/develo...

Start at Step 2 'Find your recording and playback devices.' It's pretty self explanatory from there.

I hope that helps, good luck!

adylinn (author)2017-09-22

Fantastic instructable, thank you so much for putting it together! I have an instructable for a 3D printing project but I direct people to the generic google assistant SDK website - do you mind if I send them here instead?

https://www.instructables.com/id/DIY-Google-Home-L...

LukeK1990 (author)adylinn2017-09-22

Hey adylinn.. I’ve seen your instructable, I think it’s great. Your other work on your website is cool too I love the speaker eggs! I did try to leave a comment a couple of weeks ago but the comments system was down.

Of course, please feel free to send them here. My original plan was to come up with a speaker enclosure for this instructable as there isn’t really much out there on the 3D websites which is how I came across yours. I haven’t had a chance to try and print it yet though. You mention at the start of the instructable that the design work could do with some refining, is there anything specific you were not happy with?

adylinn (author)LukeK19902017-09-22

That's awesome, thanks man! I'll add the link, I appreciate it - I think most will find it much more helpful.

Yeah so on the design side its more or less just nit picky. I think the downward facing speaker is ok but might have been better going front facing but I couldn't get it to work with the speaker I had so I think that's one improvement that could be made. The shade is the other thing - I had some issues with the sides bowing outward because of how thin and tall it was but it wasn't too major - I just was trying not to have too much material to block the light so that's probably fixable with a more transparent material and just adding some thickness on the inside. The download files include Fusion 360 files so you are more than welcome to make any adjustments that you see fit. Let me know if I can help at all with that.

LukeK1990 (author)adylinn2017-09-23

It sounds interesting I’ll take a look at the cad files when I get some free time. You’re welcome to download the PDF of this instructable and distribute it with your files as well. What’s next for you, have you got anything else in the pipeline that you are working on?

adylinn (author)LukeK19902017-09-23

Oh yeah, working on new stuff all the time. I am putting out a build monthly and uploading new designs for MyMiniFactory as well. If you like this kind of stuff, you should sign up for my email list and I'll notify you of new builds and designs being published. Also, if you are interested on collaborating on something together, I'd love to do something like that.

I'll definitely take you up on the PDF option, again, I really appreciate it.

LukeK1990 (author)adylinn2017-09-24

I've subscribed to your newsletter I look forward to seeing what else you've got on its way. I would definitely be up for collaborating on something if you come across something specific give me a shout.

I love things that are easy, I really want to create a AI enclosure for the assistant which is simple. Right now my Pi is sat on the desk with cables everywhere it just doesn't look the part.

I've attached some renders for a speaker enclosure that I created (and printed). The top and bottom is screw top and fabric is wrapped around the center. It's good but I still haven't quite figured out how to hold the Pi in place. It's also much bigger than I want it to be due to the size of the Pi3. I am going to try and get the assistant running on a Zero and go back to the drawing board for something smaller.

I stumbled across this the other day which is cool: https://www.instructables.com/id/Alexa-Assistant-W...

adylinn (author)LukeK19902017-09-24

Those renders look great - very nice design. You are right though, the Pi3 is just huge when trying to incorporate within an enclosure, especially a circular one. I think going with the zero is the right approach for sure. That instructable you linked to is great - I would love to see you merge that with your design and I would definitely print and make one for myself :).

LukeK1990 (author)adylinn2017-09-25

Thanks adylinn, I will let you know when I get around to it :)

In the meantime I have added a link to your Instructable in the 'Extra Credits' section. It would be cool to see someone combine the two projects.

gdotbat (author)LukeK19902017-10-16

GREAT tutorial Luke! I was able to build this project
with my son and we had no issues getting it to run on a Pi3, very cool!

The instructable for the Alexa build on the PiZero with
the 3d printed case is very cool as well! I want to build this but using Google
Voice rather than Alexa (I already have enough Echo devices in our home!), but
I don’t know what we will need to do differently to get Google AIY working with
the Pi Zero and the Speaker Bonnet. Any ideas?

I ordered the Pi Zero, Speaker Bonnet and speakers bundle
from Ada Fruit and I am having a friend print the housing from Modern Inventors
instructable. Hopefully I can work on it this weekend.

LukeK1990 (author)gdotbat2017-10-17

Hey thanks buddy :)

The 3D printed case is very cool, I keep meaning to buy a Pi Zero to try the Google Assistant on it. If it works I am tempted to design my own enclosure for 3D printing. Perhaps if you get yours to work it may motivate me to go and buy a Zero.

The only problem I imagine that you may run into is with the audio and mic. If either or both of these do not work you may need to change the config slightly in 'Step 9: Audio Configuration (Part 2)'. You can work out the correct configuration for your setup using Google's own troubleshooting guide found here: https://developers.google.com/assistant/sdk/develo...

Start at Step 2 'Find your recording and playback devices.' It's pretty self explanatory from there.

Good luck and let me know how you get on!

MadisonF1 (author)2017-09-22

I'm having some troubles and was hoping to find a solution from somebody. I followed all the oauth instructions thoroughly. When i try to run main.py, i get the error:

File "src/main.py", line 30, in <module>

import auth_helpers

File "/home/pi/voice-recognizer-raspi/src/auth_helpers.py", line 21 in <module>

import google_auth_oauthlib.flow

ImportError: No module named 'google_auth_oauthlib"

I tried recreating my credentials to no avail. Hopefully i can find a solution.

dsegel (author)MadisonF12017-10-06

This is likely an environment error - make sure you're using the Dev Terminal from the desktop, and not a regular terminal from the menu or menu bar. The PATH is different.

LukeK1990 (author)MadisonF12017-09-22

Hi Madison, can you confirm the file name of the disk image you are using?

MadisonF1 (author)LukeK19902017-09-22

I'm not at home right now, but can i ask exactly which file you're referencing to? I can check when i get home.

LukeK1990 (author)MadisonF12017-09-22

It’s the disk image that you would have downloaded in step 2. Hopefully you downloaded the image called ‘aiyprojects-2017-05-03.img’ from my Google Drive? Or did you download ‘aiyprojects-2017-09-11.img’ from the official Google AIY website?

MadisonF1 (author)LukeK19902017-09-23

I did indeed download the correct image.

LukeK1990 (author)MadisonF12017-09-24

Hi Madison, I would suggest double checking everything in the cloud is setup correctly. There is a more detailed guide here: https://aiyprojects.withgoogle.com/voice/#users-gu...

Make sure you did not miss anything. If you still cannot get it to run, start over from scratch. You do not need to create new credentials in the cloud though, just start with a fresh image then download and move the .json file to /home/pi/assistant.json. Making sure you follow all the other steps in the Instructable in the right order. Sorry I cannot give you a precise answer!

MikeW108 (author)LukeK19902017-09-26

I'm getting the same message now!

I had it all working until I did the final step of enabling it on boot and then restarted the Pi.

Now I just get messages in daemon.log about voice-recognizer starting and then almost immediately stopping with an error.

Running main.py from the console gets the above error message

LukeK1990 (author)MikeW1082017-09-27

Hi Mike, sorry to hear that. I ran a fresh install this morning following each of the steps in this Instructable and I did not have any problems with autostart or voice-recognizer. I would suggest a fresh install taking extra care to follow every step precisely. If you are still getting the same error it can only be hardware. If it helps, I am using the following:

USB Mic: https://www.amazon.co.uk/gp/product/B00IR8R7WQ/

Raspberry Pi 3: https://www.amazon.co.uk/Raspberry-Pi-Official-Des...

Aux Speaker: https://www.amazon.co.uk/Betron-Wireless-Portable-...

I hope you get it up an running, sorry I cannot give a concrete answer.

AviW1 (author)2017-10-01

And I am also planning on installing Kodi on the same system! Any suggestions?

AviW1 (author)2017-10-01

Hey! This is REALLY awesome! But the problem is, how do I get Google Assistant to speak over HDMI, rather than AUX, or the HAT device? HDMI to AUX converter gives a better sound quality than straight AUX through the RasPi!

jw4bepi (author)2017-10-01

Great tutorial. I completed this without issue start-to-finish while watching a football game this afternoon. I used an old webcam as a microphone but I'll pick up a better mic now that it works. Note that the interface in step 1 "formatting the SD card" looked different that shown above but worked fine. Everything else was correct to the last character. Good job! Now time to play!

Fugit185 (author)2017-09-29

Finally my USB mic came and I started everything from beginning, but no Check Audio doesn't work. It appears for less than second and then disappears?

Fugit185 (author)Fugit1852017-09-29

I reinstalled again, but now skipped section 6, still Audio check window
closes in a second, but I still tried src/main.py and it worked. But
when I run this command sudo systemctl enable voice-recognizer and
restarted there is constant noise in speaker?

About This Instructable

38,819views

607favorites

License:

Bio: Nerdy, Quirky, 3D Obsessed.. If you have a question regarding one of my Instructables please ask, I am happy to help!
Add instructable to: