Create Google Home with Raspberry Pi  Step by Step Guide ▷ 2021

If there is something that has characterized these plates is their large number of uses, among one of them is the possibility of turn them into an assistant, in this case we will explain how to turn it into a Google Home.

Google Home is the easiest way to have Google Assistant at home, and despite being a platform that is not available worldwide, Thanks to the Raspberry Pi you can have it at home and even control anything you connect to the board with your voice.

This is how we are going to explain to you below what is the procedure so you can start turn your microcomputer into a voice assistant in an easy and fast way.

What do I need to turn my Raspberry Pi into a Google Home device?

If you are looking for a way to turn your microcomputer into a voice assistant as it is Google Assistant, then you should keep in mind that you will need some hardware. For this you will need to use a microphone and speaker that allows you to communicate with Google Assistant. You will also have to have a Raspberry Pi 2, Pi 3 or Pi 4 board, the last two mentioned being the most recommended. When you have all this ready, you can start this procedure.

Learn step by step how to create a Google Home smart speaker with a Raspberry Pi from scratch

At this point it is important to mention that there are two ways with which you can create a Google Home smart speaker from scratch.

To do this, just follow each of the methods that we are going to teach you below:

Using AIY Voice Kit by MagPi

Keep in mind that in Issue 57 of The MagPi, Google includes a kit to motivate users to create their own Google home, this project received as name AIT Voice and which turned out to be a mixture between what is artificial intelligence and DIY which means do it yourself. Therefore, if you have this kit or are planning to buy it, you will be able to use it through each of these steps.

Assemble the AIT Project kit

Note that This kit is quite simple to assemble so you should not have any inconvenience, here you must follow each of the instructions that you will find on the AIY Projects website https://aiyprojects.withgoogle.com/voice/.

In order to build this Kit, Google will provide you with the following:

  • An elongated PCB board with two microphones.
  • A PCB to control the microphones and the push button (Voice HAT).
  • One LED.
  • A Push Button.
  • A loudspeaker.
  • Cables to connect everything.
  • A cardboard box to assemble the kit.
  • Mechanism for the push button.

Assemble the AIT Project kit

However, all the components offered by the kit are sufficient, so you will need to place the following:

  • A Raspberry Pi 3 or Pi 4.
  • The micro SD card to install the operating system.
  • A screwdriver.
  • Headband adhesive.

Assemble the AIT Project kit

  • Remember that You will find all the instructions to assemble the kit on its official website, but here we are going to summarize the steps so you can carry this out in a very simple way.
  • When you have all the necessary components, next will start by connecting the PCB board, call Voice HAT and which controls the microphones and the push button at the Raspberry Pi 3 in this case, it can support you on the two small plastic risers. Now with the help of the screwdriver you must connect the two speaker cables, keep in mind that red is positive and black is negative.

Assemble the AIT Project kit

  • The next thing you should do is connect the rest of the cables to the board. After this it will be the right time to place everything in the first cardboard, for this you must fold it leaving the instructions in view and place the speaker first, then place the Raspberry Pi 3 With the Voice HAT. Now you are going to assemble the boxes and insert the whole set, be careful that the speaker is in the part where the holes are.
  • Once this point is reached, it is time to fix the push button housing. The first thing will be to unscrew the black plastic nut, then you are going to insert the button through the hole in the cover and screw the black nut back on. The next thing will be to assemble the mechanism with The led and the push button. Here you will have to fit it into the push button and connect the cables carefully and in the correct order (Red and blue go outside, black and white in the center).

Assemble the AIT Project kit

  • To finish this step, you need to connect the plate with the two microphones and then put a little adhesive tape on it above to the top. Take care to position the microphones so that they have a good entrance of the sound through the holes of the box. When you have everything assembled and ready, the next thing will be to install the software in micro SD card.

Install and configure Raspbian to use Google Assistant

Raspbian installation will require several steps, one of them is to download the system image and flash it to the micro SD with a computer.

Here you will have to follow each of these steps:

  • The first thing will be to download the image for the Voice Kit micro SD from this link.

Download Image Voice Kit

  • Later you must download the Etcher.oi software for computer.

Download Etcher for Windows

Download Etcher for MacOS

Download Etcher for Linux

  • After this you will have to unzip the file with the operating system image for the Raspberry Pi.
  • Now insert the micro SD card in the computer.
  • Then open the program Etcher, there select the image, select the micro SD and click on “Flash”.
  • When I’m done, you gon ‘have to remove the micro SD card which will now be ready to be inserted into the plate.

At the end of the flash the card it will be placed on your mini PC to begin. To be able to start the board with the Voice Kit it will be necessary to have a monitor with HDMI cable and a keyboard with mouse, you connect all of them and lastly you connect it to the power so that it turns on the microcomputer. Keep in mind that the first system startup may take several minutes, the system that runs on the mini PC is a version Debian specially modified for this type of plates and is known as Raspbian.

When have the desktop active, in the upper right you will be able to connect to the WiFi network between the Bluetooth and volume symbols. Being connected to the Internet, the browser will open and there you will have to enter this URL: https://console.cloud.google.com/. There you will be asked to enter your Gmail account with which you will use Google Cloud services, where is it located Google Assistant which interests you. To do this, enter your email and password so that you can access the service, which is completely free.

To do this, follow each of these steps:

  • The first thing will be create a new project, it can be called for example “Home Pi”.
  • Here you will activate the Google Assistant API in the project in API > Enable API > Google Assistant > Enable.
  • Then you will have to create a new credential using this path: Credentials > Create credentials > OAuth Client ID > Other (añade nombre) > Create.
  • After this you’re going to have to download the credential to the microcomputer from the API credentials page of your project. On the right side of the credentials you just created you will find a button to “Download”.
  • Later you will have to copy the downloaded file from the download folder to the folder /home/pi/ and you change the name by clicking on the file with the right button > rename for that of json.

Talk to Google Assistant using the Raspberry Pi 3

Once here, you will have to launch the wizard on the board, for this it will open the terminal icon that will appear on the desktop and enter the following command:

If this is the first time that you are running this command, then it will ask you for the necessary permissions to be able to use your account. Google Cloud which will be associated with Gmail. If everything went well on the console, then a warning will appear where it informs you that to speak you must first press a button.

If you want to exit the application you will have to press Ctrl + C with the terminal window active. After this you will be able to ask everything you want, in order to control the volume you can do it from the desktop icon in the upper right or tell Google “Volume down”. In this way you will be able to enjoy this voice assistant from your Raspberry Pi using this kit.

Talk to Google Assistant via Raspberry Pi 3

Build your own Google Home with a speaker and a Raspberry Pi

In case you don’t want to use AIY Voice Kit, but if you want to create it yourself, then you will only need the Raspberry Pi 3 used previously, as well as a USB microphone, speakers with mini-jack and a Raspberry Pi 3If you want, you can optionally connect a button. In the case of software installation You can follow the same instructions already mentioned above, but in this case some details will have to be changed so that you can use your own hardware.

The first thing in this case will be to edit the file /boot/config.txt via terminal using the command sudo/nano /boot/config.txt. Here you will have to remove the comment on the line where it says #dtparam=audio=on erasing # and the next two will be commented, leaving the paragraph as follows.

When it’s done, you’ll have to press Ctrl + X to exit and save with the same name:

# Enable audio (loads snd_bcm2835)

dtparam=audio=on

#dtoverlay=i2s-mmap

#dtoverlay=googlevoicehat-soundcard

Later you are going to edit the file /etc/asound.confyou will do this too from the terminal with sudo nano /etc/asound.confi. Here you go to delete everything and paste the following code.

Then “Ctrl + X” so that you can exit from there and save everything with the same name:

!default {

type asym

pcm "mic"

pcm "speaker" }

mic {

type plug

slave {

pcm "hw:1,0" } }

speaker {

type plug

slave {

pcm "hw:0,0" } }

At this point it will be time to reboot the Raspberry Pi 3 and there you will be able to test that it recognizes the microphone and the speakers. On the desktop you will find a file called “Check audio” if you double click on it we will see that look for the Voice HAT you don’t have.

In this way you are going to modify it, write in the terminal the command sudo nano /home/pi/voice-recognizer-raspi/checkpoints/check_audio.py, and on the line where it says VOICEHAT_ID = googlevoicehat you are going to change it for VOICEHAT_ID = bcm2835. This will allow you to get the perfect default Raspberry sound, to exit and save press the keys “Ctrl + X” and finally retest the audio and there everything should work correctly.

If you have a button, you will have to connect it to GPIO 23, and if you don’t have one, then you will start the service as in the previous step with a special command:

  • python3 src/main.py –T clap

With this command you are going to get Google Assistant I answer you every time you ask a question. If you want to exit you can do it by pressing the keys “Ctrl + C”.

If you have any questions, leave them in the comments, we will answer you as soon as possible, and it will also be of great help to more members of the community. Thanks! 😉

Nely zambrano

Author: Nely Zambrano

I have extensive experience in the technological field, my specialties are graphic design, social networks and Digital Marketing. Windows and Android are my specialty.

You may be interested:

Leave a Comment