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

Introduction: 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 prototypes,…

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!

Internet of Things Contest 2017

Second Prize in the
Internet of Things Contest 2017

Power Supply Contest

Participated in the
Power Supply Contest

Lights Contest 2017

Participated in the
Lights Contest 2017

1 Person Made This Project!

Recommendations

  • Big and Small Contest

    Big and Small Contest
  • Game Design: Student Design Challenge

    Game Design: Student Design Challenge
  • For the Home Contest

    For the Home Contest

22 Comments

0
KN19
KN19

Question 4 years ago on Introduction

Has the crackle problem been fixed ?

0
SameerG7
SameerG7

4 years ago on Step 3

hey would you help in designing similar case for raspberry pi 3 and respeaker 4 hat with a small speaker?

1
uNNatuRaLtm
uNNatuRaLtm

5 years ago

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)

0
BrianM571
BrianM571

5 years ago

What USB MIC did you use? I'm trying this: https://www.adafruit.com/product/3367

0
BrianM571
BrianM571

Reply 5 years ago

a few more things. the speaker pop is really bad, when i connect the neopixel strip, the Pi reboots (tried to the 3v and 5 volt).

Any thoughts on how to get the alexa services to start on reboot?

0
YohayG
YohayG

5 years ago

Great tutorial, Thank you very much!

I just finished building and also used the STLs. It all works great and looks great (Besides the 'pop' noise that the speaker makes :-))

(My kids favorite is: “Alexa, can you beat box?”)

I have soldered the led ring as detailed. I have wired pin number 13 to IN in the led ring

I’m trying to get the led ring to turn on. I never used the neopixel.

Can you please guide me how did you use the https://github.com/jgarff/rpi_ws281x to use the led ring as decoration?

I’ll start simple, by using it the same as you have been using it, just for decoration.

Then I’ll jump to the java code and modify the led ring as you mentioned in previous comments by modifying the AVSController.java.

Is there a way to control the led ring from the java code?

0
gdotbat
gdotbat

5 years ago

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!

0
briafalk
briafalk

5 years ago

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

0
The Modern Inventor
The Modern Inventor

Reply 5 years ago

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.

0
Pavan Kumar VarmaG
Pavan Kumar VarmaG

Reply 5 years ago

are you sure that modifying these, we will be able to start some application or run a script if we tap into it?

0
Pavan Kumar VarmaG
Pavan Kumar VarmaG

5 years ago

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?

0
BobbyD47
BobbyD47

5 years ago

So how did you install the lights?

0
jetty480
jetty480

5 years ago

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

IMG_9139.JPG
0
jetty480
jetty480

5 years ago

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

0
The Modern Inventor
The Modern Inventor

Reply 5 years ago

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

0
briafalk
briafalk

Reply 5 years ago

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

0
The Modern Inventor
The Modern Inventor

Reply 5 years ago

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

0
shaolinkhoa
shaolinkhoa

5 years ago

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.