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

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.

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:

  1. Insert the SD card
  2. Plug in the Speaker Bonnet
  3. Plug in the USB microphone
  4. Plug in the speakers
  5. Set up the base
  6. Mount the speakers to the base
  7. Place the RPI between the speakers and route the power underneath
  8. Tuck in all the wires to keep it all tidy
  9. Feed the body over the top making sure to clear all wires and route the power wire in its place
  10. 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.

https://github.com/alexa/alexa-avs-sample-app/wiki...

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:

https://github.com/jgarff/rpi_ws281x

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!

Comments

author
BobbyD47 (author)2017-09-06

So how did you install the lights?

author
Pgomes_92 (author)2017-08-08

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).

Did you have this problem as well?

author
jetty480 (author)2017-07-03

Here's a photo of it completed, this is the white one, also did one in black.

IMG_9139.JPG
author
jetty480 (author)2017-07-03

>I tried, but it was a little more advanced than my abilities

Contact me directly, I have some instructions for setting up a Pi 3 with particular hardware you can get from Adafruit, provided you follow the same, it's pretty straight forward.

author
jetty480 (author)2017-06-29

>If you have any way to get around this please share.

Here's a solution I've created:

https://github.com/jetty840/rpi_ws281x

https://github.com/jetty840/AlexaPi

If you still wish to the avs sample app, then should be also possible to use the rpi_ws281x server above and send udp packets for the animation from the avs sample app.

author

I'm impressed I will definately give this a try!

author
briafalk (author)jetty4802017-06-30

Thanks, I am reinstalling a fresh copy and will give this a try.

author

Briafalk were you able to implement Jetty480's great work? I tried, but it was a little more advanced than my abilities.

author
briafalk (author)2017-06-22

Thank you for the great work on this. Can you share the code you used to activate the NeoPixels with a notification.

author

You could use this method when the app starts recording to turn on the LED: https://github.com/alexa/alexa-avs-sample-app/blob/master/samples/javaclient/src/main/java/com/amazon/alexa/avs/AVSController.java#L260

and this method when the app stops recording to turn off the LED: https://github.com/alexa/alexa-avs-sample-app/blob/master/samples/javaclient/src/main/java/com/amazon/alexa/avs/AVSController.java#L548

I was not able to get it to work, but maybe a more experienced programmer could do this easily. It might have also been interference with the speaker PWM.

author
shaolinkhoa (author)2017-06-12

Thank you for your tutorial.

Would you mind sharing how you configure pi zero to push Alexa's audio to the Speaker Bonnet ?

I want to push Alexa's audio to my USB Sound Card so I really want to know what did you do.

author

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.

author
zposner (author)2017-07-01

Very cool. The title confused me. I thought you meant it assisted Alexa. But really, it is a diy Amazon Echo.

About This Instructable

5,408views

88favorites

License:

Bio: 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 ... More »
More by The Modern Inventor:Easy Portable Sandbox and Water TableStorm Glass - the Weather Forecasting Lamp That Simulates Real Weather Conditions!Alexa Assistant with a $10 Raspberry Pi Zero W and Lights
Add instructable to: