You probably know about Siri, Alexa, Google Assistant and Cortana, the voice-activated assistants from Apple, Amazon, Google and Microsoft respectively. These pieces of software on your phone or dedicated speaker in your home enable you to check your calendar, switch on the lights, check up on your commute before leaving or even better… hear the latest knock-knock joke. Google released the Google Assistant SDK, which makes it possible for tinkerers to build their own devices, and I used it, together with a Raspberry Pi 3 to build a retro-looking smart speaker. This blogpost is the full write-up of that process, feel free to use it to build your own!
So, just to show you what exactly we’ll be building, here’s a video of mine:
What we’ll need
- Raspberry Pi 3 (or 2)
- And a USB charger, MicroUSB cable to power it
- A MicroSD card to run the Pi from, I recommend the Sandisk Ultra, 16GB is more than enough
- A Blinkt LED array from Pimoroni (https://shop.pimoroni.com/products/blinkt) for the fancy light effects
- A USB microphone (I got this one https://www.amazon.de/Mikrofon-Kinobo-Desktop-Laptop-Computer/dp/B008CNZOJY/ for an earlier project, the range on it for receiving commands is pretty great, but I guess any mic will do)
- A cheap speaker you can trash (I got mine for a few euro’s at Action, a local discount store), USB powered is definitely a plus!
- An old radio, or whatever housing you prefer, keep in mind that we’ll have to go FUBAR on the inside to fit everything in, so slim chance the original device will ever work again
Preparing the software
First of all, our Raspberry Pi will need an operating system. I recommend Raspbian, which also offers a Lite (only command line) version, which is perfect for this kind of headless (so… no screen of keyboard attached) applications. You can download it here:
The one on the right is obviously the lite one. You’ll be downloading a disk image that you’ll need to flash to your SD card. If you already have a method of choice to do so, feel free, but the easiest way is definitely Etcher:
Download the app, choose the Raspian image file, pick your SD card (or SD card reader if you used an external one) and start flashing the image on there. It’ll notify you when it’s done, and yes, it can take a few minutes.
Next, connect your Raspberry Pi to a HDMI screen, a keyboard, an ethernet cable, and finally the power cable to get started on initial setup. We’ll need to activate SSH for remote connections, but also connect to Wi-Fi since that’s probably useful when you want your Assistant placed in a central location.
First thing you’ll see when it’s done booting is ‘login:’. Just use the default username
And the default password
Now, if you live in of those countries that doesn’t use a Qwerty keyboard, this might be a bit tricky, I myself had to use the password rqspberry (Azerty layout).
Next, let’s connect to a Wi-Fi network. This is a bit harder from a CLI (command line interface) environment, but no worries, you got this. You probably have a network with a WPA2 password, then just do this:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
And add the following code to the bottom
Obviously, you’ll need to replace your username and password.
Close the file with Ctrl + X and hit Y to save.
If you have a more specific network going on, this article might help: https://www.raspberrypi.org/documentation/configuration/wireless/wireless-cli.md
While we’re at it, let’s activate SSH as well. Just in case you don’t know SSH (secure shell), it’s just an easy way to remotely access a device, using command line, so you don’t need physical access to it. So after this, we should be able to use a PC to connect to the RPi to run through the remainder of this tutorial.
Use the arrow keys to highlight ‘Interfacing options’ and hit enter/return. Then go to ‘SSH’ and hit return again. Activate the SSH server by choosing ‘Yes’. While we’re here, go to ‘hostname’ in the main menu and enter. You’ll be able to pick a name for the device, which will prove useful later (especially if you have multiple Raspberry Pi’s). I picked ‘assistant’.
Then hit the right arrow key until you highlight ‘Finish’ and hit enter. Then let’s reboot
Wait a bit for the device to reboot, then log in again with pi and raspberry. Then let’s check if it’s connected with your Wi-Fi network.
If there’s an IP address next to ‘inet’, you should be good to go! Now you can disconnect the screen, the keyboard and the wired ethernet.
Now we can get started on installing the Google Assistant SDK. First, we’ll need git.
sudo apt-get install git
Then we’ll need to follow the guide on
Go through all the steps until you can test their demo successfully. I could copy all steps here, but if something should change later on, my article would get outdated…
I’ve set up a git repository with the necessary code to build the Google Assistant with Blinkt! support, so let’s clone that one.
git clone https://github.com/dennisjanssen/GoogleAssistantBlinkt.git
We also need to install the Blinkt library and Numpy
python -m pip install blinkt
python -m pip install numpy
For good measure, let’s test everything:
sudo python hotword.py
Does it work? Yes? Great. No? Leave a comment below, we’ll get it sorted out!
You’ll probably want the assistant to start on boot, so I’ve added the scripts to the repository to do so.
sudo mv launch-assistant.sh /home/pi
sudo mv assistant.service /etc/systemd/system
And then enable it to start automatically:
sudo systemctl enable assistant.service
Building the hardware
To build everything in your case, it’s probably a good idea to disconnect all wires and start from scratch. I misjudged the size of the radio I bought secondhand a bit, so fitting everything in there was a bit tricky. I know this part of the tutorial will be different for every build, but I’ll walk you through the steps of mine, just so you know what you’re up against.
I started with stripping the old radio of all internal parts:
Until I was looking at an empty case. My radio had 2 dials (on/off + volume and band selection), I decided to pull them apart and just glue them to the case. You might look into using these buttons for all kinds of purposes though, I just didn’t bother.
I trashed my speakers, until I had one speaker element, and the little PCB that handled the power and audio. I had to cut the wires and resolder them. I didn’t glue the speaker because I was scared the glue would leak through the grill, fixed it with tape:
The PCB with USB and audio connector on the left here.
In my case, there was a piece of aluminum that had to go behind the 2 bar-shaped windows for radio band selection, so it was pretty empty now. I decided to look for a piece of matte plastic, so the the LEDs would be diffused a bit. I used a hot glue gun to attach my Blinkt bar to that piece of plastic and glued the plastic in the case. Aiming can be hard though, since you’ll want the Blinkt LEDs to line up with the empty line in your case.
And then it was just a matter of fitting it all together and connecting all the wires. So this was before final assembly:
And, finally, the finished radio during testing:
Ran into any trouble while following this guide? Anything to add or just random questions? Shoot in the comments below!