Alexa Assistant With a $10 Raspberry Pi Zero W and Lights

About: Here on Modern Inventor I will show you how I take my inventions from idea to company. Follow along and you can invent things too. In the coming months I'll show you how to come up with ideas, make prototype...
More About The Modern Inventor »

Get into the internet of things (IoT) without breaking the bank. This DIY Alexa assistant uses a $10 computer. In the future we will have personal assistants that we can talk to to control things like our lights, control the room temperature, or to tell us the weather. But you don't have to wait for the future to get your own personal assistant.

Now you can make one with a cheap micro-controller and a few other components. You don't need a computer science degree either. This is a quick and inexpensive way to get started with IoT.

With your Alexa assistant you can purchase things online, play multimedia, ask it questions, schedule appointments and reminders, and yes you can even program it to do any number of home automation tasks.

We also included some programmable LEDs that, with some code, can potentially show you the weather, time, or just create a nice ambiance while playing your music.

Here is what you will need to get started:

Raspberry Pi Zero W

RPI Speaker Bonnet

12 LED neopixel ring

USB microphone

4mb or greater SD card

2 amp micro usb power supply

A few 3d Printed parts

I have to say I have been blown away by the Raspberry Pi Zero W. It has built in Bluetooth and Wifi, so I can use it to talk to all my other devices, and at just $10 it's amazing. It's easy to remotely log into the RPI from my computer and I can make changes to the code or send new commands without having to hook it up to a keyboard or screen. You can use a more powerful Raspberry, but I found the Zero W to work great!

Step 1: Print the Housing

Don't fret if you don't have a 3d printer. You can use any housing you want. You know that Bluetooth speaker you never use... it's just itching to become a little smarter.

I know not everyone has a 3D printer, but did you know you can get them printed through 3rd party services? Just upload your file to any of the online services and you get your parts in a matter of days.

Better yet the price of 3D printers has really gone down. Did you know that you can buy one for about the cost of a regular printer now days? (Check out the Monoprice MP mini)

I printed these babies on my trusty flash forge and they turned out great! I used no supports, and 100% infill. You can tweak this to your hearts content.

Attachments

Step 2: Housing Prep and Finishing

Most 3D printed parts come out looking pretty rough. To get a more finished look I wanted to sand down the ridges and give it a coat of paint. This is what will set your project apart and take it from DIY-homemade, to where did you buy that? I didn't put as much work into the sanding as I should have so it didn't come out perfect, but here are a few tips I learned.

Start with a rough grit 200 or so to get rid of the texture

Move to a fine paper 500 grit or higher will do

Keep the paper wet so that you don't have a bunch of ABS dust in the air

Wear a mask

The paint does not cover all imperfections keep sanding until you get to the desired finish

When spray painting it's better to do a lot of light coats than to try to get it all in one pass

Let the paint dry between coats and finish it with an acrylic coat for a glossy finish that lasts

Step 3: Wire It Up

Does your Alexa assistant have to have lights... well no. Technically you can skip this part, but it sure adds a lot to the build. The neopixels I used here allow you to program any number of colors and animations so that you can receive visual notifications from your Alexa assistant.

This really come in handy and it can be programmed to tell you when Alexa is listening, or when you have a pending message. You can also use it to tell you the weather, or give you a reminder. I plan on programming in more functions (skills) in the future. For now it's more of a decorative light that allows you to set the mood or to lighten up a room just a bit.

Really the sky is the limit, and since it only requires a few wires, why not?

The schematic shows how simple it is. The speaker driver I am using in this build makes it easy because it actually has connections to the Raspberry Pi (RPI) built in. I just had to solder a +5V power, GND, and the PWM signal.

Step 4: Put It All Together

Now comes the fun part, putting it all together. There is nothing quite like seeing your project assembled. Here is what you need to do:

Insert the SD card

Plug in the Speaker Bonnet

Plug in the USB microphone

Plug in the speakers

Set up the base

Mount the speakers to the base

Place the RPI between the speakers and route the power underneath

Tuck in all the wires to keep it all tidy

Feed the body over the top making sure to clear all wires and route the power wire in its place

Position the LED ring and snap the cap on top

Now it's starting to take shape. Press the power button and Let's get Alexa on there.

Step 5: Programming and Adding Alexa

Now I have to warn you this might take a while. Amazon has ported a wonderful version of its Alexa Voice Assistant for various computers including the Raspberry Pi. Although it did not specify compatibility with the Raspberry Pi Zero W I found it tow work quite well without any modifications. Here is the step by step process to add Alexa to your RPI. It's well documented with pictures so it's fairly strait forward.

There were a few hiccups along the way I think I should mention. First of all the speaker bonnet has a popping issue where it crackles every time you activate it. This means each time you ask Alexa something it pops, and then when Alexa responds the start is a little crackly as well. There are a number of suggestions on how to fix this in the Adafruit forum, but none seemed to work well for me.

I also tried to activate the lights each time Alexa was listening, and responding, but unfortunately this seemed to mess with the audio signal as pin 18 and 12 are both using the same PWM channel. I will try to use pin 13 instead to see if I can get it to work right, so stay tuned for an update.

For now I am using the lights more for decoration and notifications to avoid interference with the audio. If you have any way to get around this please share. I am using the library for neopixels on the RPI found here:

Step 6: Alexa, Get Me a Drink!

In summary I was pleasantly please at how easy it was to build an Alexa assistant and get started with the IoT space. I have this on my desk where I often ask it to schedule events, and make unit conversions for me while I design CAD models. I am impressed at all the Alexa assistant can do and the audio, aside from the initial pops, sounds very good! The design is sleek and simple too. I don't feel like it's at all obtrusive on my desk, and it sits quietly until I need it.

This is just the beginning too. Now that I have Alexa, I can start creating skills so that she can do my bidding. Alexa, get me a drink!

Make it Glow Contest 2018

Optics Contest

21 Discussions

Can you use Charlieplexing to use the same pwm pin for both lights and audio? When they are used simultaneously the light intensity will vary with audio which seems natural. The variation can be smoothed with additional circuitry? Please do tell me if you decide to try! (or have already tried this)

Great tutorial! So I took a crack at this, I ordered the Pi Zero and Speaker Bonnet kit and I soldered the header pins on both. Now when I boot to Raspbian, I hear a "pop" on the speakers and it powers the Pi Zero off.

I tried the bonnet on a Raspberry Pi 3 and it does the same thing, only when I tried to run sound through the bonnet though, it "pops" and shuts the Pi down.

So did I screw up the soldering job or what? Do you think this Bonnet is salvageable? Thanks!

Are you using the wakeWordAgent to startup alexa or a push button to trigger alexa? Because i tried to achieve the same thing before i saw your instructable i.e., Raspberry pi zero w with a speaker bonnet. And, sensory doesn't work on zero, kitt_ai works normally if i use the hdmi output but wouldn't work once after installing and configuring the speaker bonnet. What do i do? Please help me on this?

Great Project! I got Alexa working on my Raspberry Pi Zero W but only with HDMI audio output and an USB microphone, however, I cannot use both the Adafruit speaker bonnet and the USB microphone at the same time (yet).

I configured the bonnet before I installed the Alexa assistant. In the install process it will ask if you want to configure alexa to use the hdmi audio or the speaker jack. Choose the speaker jack or it won't work. With a USB sound card it may be different. It would actually be better to use a sound card so it won't interfere with the lights.