Building the MagPi Google Voice Kit - Review
When shopping at Microcenter for some components needed for a different project, I came across the MagPi Google Voice Kit on sale for $15 (marked down from $25). I have had plenty of experience working with the Amazon Voice API with the Raspberry Pi, and I was excited at the prospect of using a Raspberry Pi and working with the Google Voice API.
Overall, the kit was easy to build and understand until adding functions such as headless boot. The documentation included with the MagPi Kit is pretty top notch. One area of improvement would be making the options for the operating system/ software easier - the kit instructions make it sound like you must set up the Google API through the terminal on the Raspberry Pi. Though you can take this route, you can also download an image of the operating system with the Google API included; this is a better option for those who are less experienced working in the terminal or new to the Raspberry Pi. Additionally, including headless boot (starting the Google Voice API without a monitor and keyboard) is not very straightforward. In conclusion, it is a fun kit to build, easy, and you can make the software and operating experience as involved - or not involved - as you would like.
WHO IS THE KIT FOR
This kit is ideal for anyone looking for a good first Raspberry Pi project. By walking through the operating system setup and installation of the Google API via the Linux terminal and scripts written in Python, one would walk away from this project with a good foundation of understanding in the Raspberry Pi ecosystem and Python in addition to learning about the hardware during the assembly.
This kit is also good for users looking for a less involved experience, ending up with a working project and learning a bit about the hardware. By using the downloaded image file, the kit is more of a build, plug, and play - and still a fun afternoon project.
As the kit has all of the wires pre-soldered or connected via wiring harnesses, there is no soldering required, and so the ability of a user to safely and effectively use a soldering iron is not of concern.
The ideal customer would be a young child (with parent), a teenager, or an adult with some programming exposure. The build and code will require an afternoon.
WHAT IS IN THE KIT
The kit includes all the materials you need to build the project less the Raspyberry Pi Zero and peripheral accessories needed to set up the project.
- MagPi Assembly and Build Instructions
- Cardboard Housing and Frame
- Raspberry Pi Voice Hat
- Microphone Breakout Board
- Arcade Button
- Plastic Standoffs for Mounting
- Wire Harnesses
One downside of the project are the things that are NOT INCLUDED but required for setup.
- Raspberry Pi 3
- Micro SD Card Minimum 8GB
- Additional Computer with Internet Connectivity
- Monitor with HDMI input
- Keyboard and Mouse
- Additional SD Card Reader
- Micro-USB Cord with 5V 2A Power Block
- HMDI Cord
Overall the total cost was about $55 in materials which included the Google API Voice Kit that I got on sale for $15, the Raspberry Pi 3 which costs $30, and a 16GB higher quality SD card which cost about $10.
ASSEMBLING THE KIT
Assembly of the enclosure and the hardware was very easy and extremely well documented. It only took about an hour, and would probably take an hour and a half to two hours for a child or first-timer. The documentation booklet from MagPi that is include in the kit is really well written and has photos for each step in full color.
The only note of caution is the bulk of the build is cardboard, so caution does need to be taken not to bend the cardboard the wrong way or tear it.
Connecting the hardware was simple and accompanied by detailed information to help the user understand the build configuration. It would not be unreasonable to let children of ages 10+ assemble this part of the project on their own.
UPLOADING THE IMAGE FILE
Once the build is assembled, there are two ways to go about setting up the Operating System and installing the scripts for the Google Voice API. As my objective was to get this kit assembled and demonstrate it to my students, I opted not to walk through the step-by-step setup of the Raspberry Pi but instead take the "easier" route and download a pre-configured image file. The project documentation does not do a great job at making this option explicitly clear, but a simple internet search resulted in Google's project documentation which included a download link. You can access the Google Project Documentation Website here.
Click on the "Voice Kit SD Image" link to download the zipped image file. The file will download as "aiyprojects-2018-02-21.img.xz". Once the file is downloaded, it will need to be unzipped or uncompressed. On Windows, I prefer to use the 7-Zip File Manager software which can be downloaded for free here. Download the file, open, and follow the instructions for installation.
To unzip the file, navigate to the file location, right click, and go to 7-Zip > Extract to "aiyprojects-2018-02-21.img\". This will create a new folder in this same location that contains the unzipped image file.
The next step is to "write" the image to the SD card. As a Windows user, I suggest the Win32 Disk Imager program that you can download for free here. Download the file, open, and follow instructions for installation. Once downloaded, open the Win32 Disk Imager, select the image file for the Google API Voice that you previously extracted, and select the letter for the Micro SD Card drive - on my computer it was [F:\].
Then, click the "Write" button. A window will appear to notify you that you can permanently damage a drive by writing to it - click "Yes".
It can take up to 6 minutes to write the image file to the micro SD card. When the disk writing is finished eject the card from the computer.
SETTING UP THE INTERNET CONNECTION
Insert the micro SD card into the side of the Raspberry Pi. Attach the micro-USB power cable to the port on the side of the Raspberry Pi and plug it in. Connect the HDMI cable to the monitor. Connect the mouse and keyboard to the Raspberry Pi. You should see the boot up screen and then the desktop for the Pi.
In the upper right hand corner you can see the icon for the internet. Click the icon, and you will see a drop down menu of available wireless networks appear. Click on the wireless network you want to join and enter your WiFi password.
SETTING UP THE GOOGLE API
Unfortunately, for as great of a job the manual does for assembly of the hardware, it was not as helpful in setting up the Google API. This is partly due to the fact that Google has updated the API dashboard since publishing of the MagPi book. The good news is that the Google Project Documentation website does a fabulous job, providing hyperlinks to all of the exact pages they a rereferencing. To set up the Google API, navigate back to the Google Project Documentation and follow instructions for "Setting Up Your Device" and "Using Your Device", then return to this post for the next step.
ADDING HEADLESS BOOT
Once your device is up and working, you really need to add headless boot, setting up the programs to run without a monitor and keyboard, in order to really enjoy this project and use it as a digital assistant. This is another weak point of the MagPi documentation - and of the Google Project Documentation as well. The good news is that this step is not overly complicated - if you can read and type, you can add headless boot.
To run the python scripts automatically, we will add some lines of code in a startup script that the Raspberry Pi determines what opens after it starts up the Desktop. Start by opening the "Terminal Emulator" from the Start Menu on the desktop.
The startup script is located in /home/pi/.config/lxsession/LXDE-pi/autostart. We need to use a text-editor that works in the terminal to make changes to this file, my preference is nano. Additionally, we need to have root (similar to administrator) privileges, so we have to use the precursor 'sudo'. Enter the following text into the terminal and then hit the 'enter' key.
sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart
We need to add a line that tells the Raspberry Pi to open the terminal and enter the command to start the Google Voice Assistant. Enter the following so that your file reads as below.
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@lxterminal -e /home/pi/AIY-voice-kit-python/src/examples/voice/assistant_grpc_demo.py
Note that the order of how the lines appear in the file is critical! the @lxterminal line must occur before the @xscreensaver line, or nothing will happen!
To save, tell the text editor to write out by typing 'ctrl' + 'x' on your keyboard. The editor will prompt you to save the changes, type 'y' to confirm, and hit 'enter'.
That is it! You can now shutdown the pi, or unplug it, and upon re-powering the device it should start the Google Voice API within 2-3 minutes of startup.
Overall it is a great projectto demonstrate to beginners and students the accessibility of the Raspberry Pi and of software engineering. Though parts of this build aren't explained as well as they should be by the MagPi company, such as the integration of the Google API credentials or the headless boot, the project is one of the best documented Raspberry Pi Projects accessible to the beginner, and does provide a great foundation for understanding. I would highly recommend this kit to any student, parent, or adult interested in learning more about hardware, computing, and software.