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).
  • A basic speaker with a 3.5 mm aux connection
  • A USB microphone
  • A mouse and keyboard

Step 1: 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

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 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!

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

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

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

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

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)

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)

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)

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/

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

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:

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: 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

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:


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: and This Instructable is a result of figuring out how to put the two together in an easy and straight forward Instructable!


LaurentM (author)2017-09-19

Quick question please: I have an old original Raspberry Pi Model B, would that work on it or do I absolutely need a Raspberry Pi 3?

trock62 (author)2017-09-17

Thanks, your Instructable works like a charm. Easy to follow instrucktions. Made and works perfect.

MrBub (author)2017-09-15

Auto start works fine too.

MrBub (author)2017-09-15

It's possible to reinstate the (now) missing files by pulling it from the repository direct :-

git clone voice-recognizer-raspi

Looks promising - will report back once I've worked through it in more detail.

MrBub (author)MrBub2017-09-15

I can't get sound working and had to do the following before I could get as far as src/ due to missing modules :-

cd ~/voice-recognizer-raspi


sudo scripts/

pip install confirargparse

pip install phue

pip install rgbxy

MrBub (author)MrBub2017-09-15

Just to confirm, I now have it fully working on the new google RPi image. Just make the changes I listed above and you should be good to go.

I also had to make some changes to the ALSA config as my microphone refused to work but this might be my mike rather than the image so I won't post unless someone needs it. Good luck!

LukeK1990 (author)MrBub2017-09-15

Thank you for the update MrBub! Is the autostart working as well? I’m just about to give it a go with your recommendations if I get it working I’ll update the guide for the new image.

RohanS116 (author)2017-08-21

HI can you please help me

Screen Shot 2017-08-21 at 3.20.31 PM.png
LukeK1990 (author)RohanS1162017-08-21

Hi Rohan, you've got lots of errors there and missing directories. Did you start with Google AIY disk image in step 2? And did you follow all the steps in the exact order that they appear in this instructable? I can create a video of the installation if you think that would help?

RohanS116 (author)LukeK19902017-08-21

yeah I have started with the google aiy disk image.

I am pretty sure i followed the steps.

Thank you if you would create a video that would really help me.

Also just curious can you post your working disk image so that i can use that. But anyways it would be so great if you do that.

I have tried lots of projects but none work.

hopefully this works thanks

LukeK1990 (author)RohanS1162017-08-21

I created this Instructable because I was frustrated with all the tutorials out there that either didn't work or just did half the job. So don't worry I'll help get you setup. I think a video of the install will help I'll work on this tomorrow and hopefully upload it tomorrow night. I'm in the UK so it's late here now.

With regards to a disk image, I'm not sure how to do that or if it would even work for this project but I will look into it as it would cut out half of the steps.

MrBub (author)LukeK19902017-09-13

nice tutorial. I'm stuck right at the start.

Here: cd ~/voice-recognizer-raspi

It doesn't exist and git fails if I create it myself.

Am I missing something obvious?

LukeK1990 (author)MrBub2017-09-13

Hi MrBub, I found out today that Google updated the AIY project and the disk image which is causing a few problems including the one that you are experiencing. I am getting my head around the changes so that I can update the Instructable. Keep everything as it is on the Pi and I’ll update you when I’ve got it figured out :)

MrBub (author)LukeK19902017-09-15

Thanks. I've had a google around and can't see anything about them removing the RPi part. Very frustrating. Thank you for your help & I'll keep an eye out here for a solution. If I find one first I'll be sure to post it !

mstrJohn (author)LukeK19902017-09-14


Thank you Luke for your excellent work!!!

We tried to follow this guide yesterday and ran into the same problem:

"cd ~/voice-recognizer-raspi"- "Does not exist..."

When I did another Rpi3 last week there was no problem following the guide. We would greatly appreciate if you can post any solution that you might find.

LukeK1990 (author)mstrJohn2017-09-14

Hi mstrJohn, unfortunately Google updated the disk image and there is no documentation available for the latest release making it difficult to work with. In the meantime I have updated the link in the Instructable to allow you download the original image:

Do not worry that it is an old image since we update the files during the Instructable. I hope that helps!

mstrJohn (author)LukeK19902017-09-14

Thank you Luke!

The old image solved the problem :-)


LukeK1990 (author)mstrJohn2017-09-15

Hi John, I am glad it's working again! :)

RohanS116 (author)RohanS1162017-08-21

Never Mind got it to work


I clicked on the terminal icon instead of start dev terminal

Thank You

LukeK1990 (author)RohanS1162017-08-21

Awesome, I'm glad you got it sorted! I think I'll edit the Instructable and mention that somewhere. It's easily done otherwise. So what do you think of the assistant?

RohanS116 (author)LukeK19902017-09-14

I think its really cool. I am using IFTTT to make some cool stuff with it.

Have you made a drone before?

LukeK1990 (author)RohanS1162017-09-14

Sounds fun! No I have not made a drone yet but it's definitely on the bucket list. I am actually making a n RC rover at the moment!

MichaelW142 (author)2017-09-14

Hi Luke,

Great tutorial, but I think there has been a change in the Google image, in Step 5 updates you refer to ~/voice-recognizer-raspi

Looks like this has been replaced with ~/AIY-voice-kit-python. The commands still appear to run if you substitute the voice-recognizer-raspi with the AIY-voice-kit-python.

Stumbled at Step 7 after editing the wake word, restart the service, reported back that the service wasn't running. ~/AIY-voice-kit-python/scripts contains the following scripts/files.


So progress has been halted at this point. I have ran and services were installed, clearly tho the other files in the /scripts dir have a function.

Pointers appreciated, or point me at the old image that this guide was written for :)

LukeK1990 (author)MichaelW1422017-09-14

Hi Michael, yes Google updated the disk image a couple of days ago. I have been trying to get the new image to work with about as much success as you! Oddly, they havnt updated their own documentation so even if you owned the full voice kit their documentation on the AIY website is useless.

In the meantime I have updated the link in the Instructable to the previous version of the disk image so people can continue to work on this project. Here's the link again:

As soon as they release some documentation I will update the guide to work with the latest image although the end result will still be the same since the Instructable prompts you to pull updates.

I hope that helps :)

MichaelW142 (author)LukeK19902017-09-14


Cancel my last, the link you pasted into the message failed but the link in the guide is downloading.

Cheers and many thanks.

LukeK1990 (author)MichaelW1422017-09-15

Hi Micheal, sorry about that I was about 1am my time when I posted that link! Hope you got everything working in the end.

MichaelW142 (author)LukeK19902017-09-14

Hi Luke,

Thanks for getting back to me. Unfortunately seems that the link has been removed.. getting a Not Found, Error 404. Would you be able to share the original disk image via some other means?


FranciscoG144 (author)2017-09-14

Hi Luke!

Seriously, awesome guide! Do you happen to know if it would run on the Zero W? I'm new to the Raspberry Pi and I don't currently own one, and the Zero is half the price of the B where I live (plus it would be nice to make a buck of little Google Assistants)

MichaelW142 (author)2017-09-14

Great guide,

Is anyone able to provide a link to aiyprojects-2017-05-03.img ? I'd be happy to host it so that we are all working off the same image.


saucydad (author)2017-09-07

Would it be possible to use VNC connect once you get to programing so you can copy and paste from a PC the commands to enter?

LukeK1990 (author)saucydad2017-09-07

Yes that's the quickest and easiest way to get this setup. I didn't mention it in the instructable as I wanted to keep it as simple as possible for newcomers but if you already know how to use VNC then go for it :)

saucydad (author)LukeK19902017-09-07

Thanks for the quick response! That will make it way easier. My speaker and mic will be here Friday.

LukeK1990 (author)saucydad2017-09-07

Great let me know how you get on!

saucydad (author)LukeK19902017-09-13

Hi Lukek

I tried setting it up without the mic and tried the sound check and did some playing with that but no luck. The mic is supposed to be here today so I reformatted the sd card and have it flashed. I have to put the sd card into my Cannon camera and format it first to use the SD formatter. Every time I flash the image it says write ok but validation detected potential corruption issues, retry. It seems to work ok the last two times I ran the commands.

LukeK1990 (author)saucydad2017-09-13

Hey, Google just updated the disk image and now it is not writing properly in Etcher - I am getting the same error message. I am just trying to work out what Google have done with latest version then I will update the guide. I will try and get this done within the next 24 hours. I will update you when I have worked it all out :)

saucydad (author)LukeK19902017-09-13

I used the older iso and have it telling me need I need some basics settings that need permissions first. I think I did all that. At least it seems to be working YEaaa

saucydad (author)saucydad2017-09-13

Installed the google app on iPad and did one more setting and now it works

LukeK1990 (author)saucydad2017-09-13

That’s great, I’m not sure how you did it with the old image but I’m glad it worked.. Congrats! I guess they added integration to the Google Home app as this didn’t exist before.

saucydad (author)LukeK19902017-09-13

I still have to wake it up, but that's no problem. Keep me informed when you get the disk image figured out. Would like to try it on a different SD card,

saucydad (author)LukeK19902017-09-13

thanks for the work you are doing. I hope my mic will be here in the mail this AM. Going to try it with this flash anyway and see if I have problems. Getting good at reformating the sd card LOL

saucydad (author)LukeK19902017-09-10

I did finally got VNC installed and will start tomorrow. It seems to me the last time I used VNC I didn't have to create an account. So far I have gone to step 6 but need to wait for the mic to finish.

LukeK1990 (author)saucydad2017-09-10

The VNC software that comes pre installed with noobs is free and does not require an account however the SD card image that Google provides does not get the same deal. There is a free trial though which is what I used. Let me know how you get on when the mic arrives :)

biocow (author)saucydad2017-09-10

I just set mine up using VNC and it worked out great!

MikeL87 (author)2017-09-12

New IMG file as of 2017-09-11. The setup all goes South at step 5. Please update, I'm sure people are still enjoying this amazing post.

LukeK1990 (author)MikeL872017-09-13

Thanks Mike, I am looking into it and I'll post an update when I have figured it all out :)

TerryR36 (author)2017-09-11

OK, this is a very exciting project and thank you for all the hard work!!!
I am using a standard USB mic identical to the one used in the video and for some reason, I have having two issues:

1. When I run Check audio, the speaker works great but when I press Enter to try the microphone, the script immediately ends.

2. When I run src/, I get a message as follows:

[2017-09-11 10:56:00,425] INFO:root;ON_ASSISTANT_ERROR:
{'is_fatal': True}
[] Input error
Segmentation fault

Any ideas why that might be happening? I double-checked my installation and all of the files were edited accurately.

LukeK1990 (author)TerryR362017-09-11

Hi Terry, I am sorry to hear that you ran into problems with the assistant. It looks to me like its a problem with the microphone setup which is odd because you say you are using the same one as me.

Can you try this:

1) In the dev terminal enter: nano /home/pi/.asoundrc

2) Paste the text from 'Step 9: Audio Configuration (Part 2)' into the editor (see screenshot attached)

3) Hold 'Ctrl' and press 'O' to save it, press enter on your keyboard to confirm. You should see a message confirming it wrote 17 lines.

4) Close that window and restart the Pi. Test the assistant again, does it work now?

TerryR36 (author)LukeK19902017-09-12

Hi again! I actually did a complete re-install and skipped your backup steps. It finally started working after that. Seems that maybe something may have been getting overwritten. Thank you!!!

LukeK1990 (author)TerryR362017-09-12

Hi Terry, I am glad you got it fixed! Just to confirm did you skip all 4 commands in step 6?

banesync (author)2017-09-12

Hi Luke, thanks for the awesome instructable! So this really works without the Google AIY HAT? What's the purpose of the HAT then? (I'm new to this world and trying to figure things out)

Have you determined whether you can use this to control other devices? I'm looking to build myself an IR blaster and I figure it would be cool to add GA voice control to have a touchless experience. So my specific question would be: could this be made to trigger other components like an IR blaster?

About This Instructable




Bio: Nerdy, Quirky, 3D Obsessed.. If you have a question regarding my Instructable please ask, I am always happy to help!
More by LukeK1990:Design and Print the Instructables RobotHands Free Google Assistant for Raspberry PiSpace Rocket Fidget Spinner
Add instructable to: