Amazon Echo – the homebrew version
Amazon’s Echo isn’t available here in the UK yet. This is very aggravating for those of us who pride ourselves on early adoption. For the uninitiated, Echo’s an all-in-one speaker and voice-command device that works with Amazon’s Alexa voice service. Using an Echo, Alexa can answer verbal questions and integrate with a bunch of the connected objects you might have in your house, like lights, music, thermostats and all that good smart-home stuff. It can also provide you with weather forecasts, interact with your calendar and plumb the cold, cold depths of Wikipedia.

Amazon’s official Echo device

The Raspberry Pi version (our tip – hide the Pi in a box!)
Happily for those of us outside the US wanting to sink our teeth into the bold new world of virtual assistants, Amazon’s made a guide to setting up Alexa on your Raspberry Pi which will work wherever you are. You’ll need a Pi 2 or a Pi 3. The Raspberry Pi version differs in one important way from the Echo: the Echo is always on, and always listening for a vocal cue (usually “Alexa”, although users can change that – useful if your name is Alexa), which raises privacy concerns for some. The Raspberry Pi version is not an always-on listening device; instead, you have to press a button on your system to activate it. More work for your index finger, more privacy for your living-room conversations.
Want to build your own? Here’s a video guide to setting the beast up from Novaspirit Tech. You can also find everything you need on Amazon’s GitHub.
Let us know if you end up building your own Echo; it’s much less expensive than the official version, and 100% more available outside the USA as well.
98 comments
Ac_Arno
Any idea if the zero is strong enough\compatible with this?
Liz Upton
You’ll need a Raspberry Pi 2 or 3.
Toby
If you ever create a pi4 what feature do you think would make it different from the pi3?
Click on “Toby” to go to my raspberry pi bird box!
Liz Upton
Wheels. And also a sandwich.
Mel
Lol
Paul Boudreau
OH MAN! Really? I REALLY hope they go with big A offroad wheels and a Pastrami on Rye.
Frederick
I’ve installed the NovaSpirit Tech version on my Pi Zero, works like a charm, post coming soon :)
mindrobots
This begs to be made into a wearable Echo. I hope someone more productive than I am is thinking along these lines!
Shannon
That would make for one giant Star Trek badge, since you have to use the Pi2 or Pi3… :-)
mindrobots
…i thought the solar panels on the special hat might be an issue….but if you want to dwell on the size of the badge, that’s ok! :o)
Kenton Vizdos
What do you mean by “Wearable”? What Features? Sounds cool :)
Stilli
Can the normal Echo features be used? Googling around on what the echo service can be used for and a lot mention opening the app and…
Does that all work as well?
Liz Upton
As far as I understand, yes, they do.
Stilli
Pretty exciting in that case!
JasonF
I did this using NovaSpirit’s instructions when the video first started circling the web. It is neat, but it is NOT a full functioning echo. They have disabled services like being able to use iheartradio and spotify and whatnot (Amazon Music *might* work, but I didn’t try implementing it). You can add skills, though. And it actually connects to SmartThings, which is cool. Still, it’s not the real thing.
However, I have not tried the method on Amazon’s github page. It’s a lot more complicated and has more steps. I just skimmed through it, so I’m not sure if what NovaSpirit did (or rather Rob Mercer) is just make it easier by creating the software, but I haven’t tried to figure that out. I may try to do it, bt my real-deal Echo arrives tomorrow, so I also might just say [mod edit for swearing]
Wigs
Can this work with the first ever Raspberry Pi?
Liz Upton
No; you’ll need a Pi 2 or a Pi 3.
Daniel Walters
Hi Liz
Can you elaborate? Is this due to CPU power? Or lack of USB ports or something similar?
Thanks
Liz Upton
NodeJS doesn’t play nice with ARMv6 – but see https://github.com/amzn/alexa-avs-raspberry-pi/issues/2, where someone seems to have found a workaround.
don isenstadt
I just used the AlexaPi on my first raspberry pi arm v6.. ran fine! But this is the python version …one thing I thought I would have to do is generate a new key but it used the key I set up on the raspi 3! They had me put in a local IP address so I thought that was part of the key .. I guess not..
don isenstadt
They say it can .. I have only tried it on the pi 2 .. It polls the GPIO 18 so it sort of pegs one core .. It will probably be changed to wait on a falling_edge .. that is a listed nice to have on the git hub page ..
https://github.com/lennysh/AlexaPi
Lenny Shirley
It’s already been changed to wait for the falling edge. :)
Dave Semmelink
Anyone interested in a “wearable” Echo should take a look at the Pebble Time watch. It has a microphone and a voice recognition API. You can then write an app for the Pi (any model!) to do the controlling. (The Pebble is $150, but hey, it’s also a smart watch.)
I started looking into this a while back but ran out of time. I will take a look at this project and see which works better for me. One advantage of the watch is that you don’t have to deal with the acoustics of the room you are in.
John Jeffers P.Eng.
“Our Version of Amazon Echo” can you identify the “AYL” and speaker / “Mic” component?
I don’t think you should have published this picture since there is no button per the Amazon T’s and C’s.
Cheers John
Liz Upton
That’s Amazon’s own picture.
John Jeffers P.Eng.
Liz
I guess I know that Amazon at the best used a powered speaker and USB mic.
Really thank you for clearing it up us Electrical Engineers look at things and say that doesn’t make sense! (I suspect you have heard that before……..) Hot tip then use a USB headset for prototyping!
Cheers John
Andrew
Would be nice if someone could make this a Jasper (http://jasperproject.github.io/) plugin to get the “Always On” function if you wanted. If I get time (Rarely happens) I would love to work on this myself even.
Kevin Hainsworth
Tony D! at Adafruit Live has done a “really useful” demo video of his experiences of setting up the Amazon GitHub Alexa. https://www.youtube.com/watch?v=6fAdBehSYiA. I’ve got it working on an RPi 3 and I now know what the weather in Seattle is like, though its raining here in Manchester UK.
The Raspberry Pi Guy
Ah drat! I had been following the process and had started to do a tutorial on the Amazon Echo stuff. I went to a talk at the University of Cambridge given (in part) by Hermann Hauser. It was on the topic of AI and he had bought along his American Amazon Echo. Very cool stuff. You could ask it questions like: “Who was the president of the US when Barack Obama was a teen?”
Liz Upton
Ah – now that’s a particular edge case, and not as clever as it looks. “How tall was the president when JFK was born?” is a question Doug Lenat (who is on the board of TTI Vanguard with Eben) caught a lot of AIs out with – including the Wolfram Answer Engine. Since then, he’s been using that question in talks, and the people who work at the companies involved have noticed and made specific fixes by hand to the AI so it can answer that class of question. Try to think of a question with a similar number of layers of abstraction; the AIs don’t do as well with those as they do with strictly presidential ones!
The Raspberry Pi Guy
You think it would do so well with Prime Ministers? “What was the hair colour of the Prime Minister when David Cameron was born?!”
dominique courtois
This is really worrying.
Amazon being one the greatest evil of this time, the company which destroys the public libraries it appears to me to be of the opposite spirit of Raspberrypi.
MattGS
I don’t think Amazon have deliberately set out to destroy Libraries (unless they have a cunning plan for their drones). They set out to sell as many books, as at cheaper price as possible. Libraries in this country have been decimated by massive spending cuts. A very, very worrying development but not something that you can blame Amazon for.
JasonF
The carriage driver always hated the motorcar…
Peter Clough
Hey, I’ve just set up the echo on my new pi 3. After a few hours of scratching my head at certain points, it’s now working a charm.
It was a fun build, now working on a physical button and adding some funky LEDs =).
Peter
Gonzalo Escudero
Peter, my name is Gonzalo. I already bought some cables and a button but i cant make it work. Is it possible that you can help me out? Thanks.
ro
The video actually uses a python client and not the amazon java one, two different things! The amazon one doesn’t have a physical button, which is a bummer …
don isenstadt
I have amazon prime and a big shout out to Sam Mechin and then Lenny Shirley who took the original python code and expanded it to allow for streaming music. It really works nicely. https://github.com/lennysh/AlexaPi. You also have to use an android or apple device to set some configuration stuff up location and playlists.. like your location.. Yes the button is a pain but it just sits on the kitchen counter and
we can ask it to play a playlist and we have 3 hours of music!
Lenny Shirley
Thanks…
JasonF
I just learned yesterday that there is actually a web interface that you can use to configure your Echo from a PC/Mac/Etc.
http://alexa.amazon.com/
Konrad
Hi Don,
Do you know of any detailed tutorial that uses Python and physical button?
Thanks,
Konrad
don isenstadt
oh yes .. one last thing.. mine has two buttions .. since I run it headless I need a button to signal it is time to shutdown .. otherwise pulling the power tends to corrupt the file system…
Greg Walters
I’ll try to help out here on a few of the questions.
I have gotten the system to run on a RaspberryPi v1B+. For all intents and purposes, it works well…in the US at least, with the biggest issue I’ve found is a small amount of audio breakup.
If you follow the GitHub readme.md and keep issue #2 close at hand, you should have no problems.
For all intents and purposes, it follows the standard echo/Alexa commands. There are, however, some things that don’t quite work that well yet…
1) The “wake word” ‘Alexa’ is not currently supported. You must (at this point) use the GUI interface and click the ‘Start Listening’ button to get the system to respond. Please check out issue # 60 on the GitHub site for more information.
2) Some things just are not supported at this point.
3) No languages other than English are supported at this moment. The suggestion by others is that once the Echo is sold in a particular country, that “official” language will be supported, i.e. French when they start selling in France, etc.
4) The Alexa smartphone app does not seem (from what others tell me) to be available outside of the USA. You can do some configuration and settings at the http://echo.amazon.com site. However, if you are outside of the US, it appears that setting your location (postal code, street address, etc) is not supported (again from what others report). Basically that means that if you are outside of the US and you ask for the weather, you will be happily presented with the weather in Seattle. You might be able to workaround this by using the phrase “What is the weather in ?”. I just tried “What is the weather in London, United Kingdom?” and it worked…as far as I know.
My wonderful son just sent me a RPi 3, so I will be happily playing with it and the Alexa app through the weekend and will update here whatever/whenever I can. I will also be adding my experiences in Full Circle Magazine which should be available near the end of April.
Greg
don isenstadt
Greg,
Have you tried the python version? You can run it from the command line without starting the GUI so it might perform better ..
https://github.com/lennysh/AlexaPi
Greg Walters
Don,
Thanks to this posting, I found out about it this morning. Really good timing, I must say.
I’ve just downloaded the latest Jessie and will be burning it to a 16Gb SD within the hour and will be playing with the Python version shortly after that.
Since I’m more of a Python guy and the Python version you mentioned seems to be a bit of a step or two ahead of the Java version, I’m really going to dig into it with (as we say here in the USA and especially in Texas) all four feet. ;o)
I will report back in the next day or two.
Greg
Mike
The trigger word “Alexa” could be detected by a microcontroller and trip the GPIO trigger on the Pi perhaps.
Christopher Elledge
Thats what I was thinking. Heck, why limit it to voice triggers, you can use all different types of sensor input to trigger the GPIO pin.
Ritesh
Can you recomment a blog/video for the same?
Ritesh
recommend*
Mel
Just got mine up and running, but don’t have a microphone yet. Looks like I’ll be waiting until May 9th for that to arrive via slow boat from China… :(
Mel
Mine is working now after I got the microphone. Like others I wish to have the code word trigger just like saying “Alexa” to wake her up and run headless…
Corbin Cook
just attempted this project, install went with no problems, no luck when trying it out
using https://github.com/lennysh/AlexaPi
as soon as i press the button to talk before i can even say anything i get this error.
Recording…
Traceback (most recent call last):
File “./main.py”, line 410, in
start()
File “./main.py”, line 384, in start
l, data = inp.read()
alsaaudio.ALSAAudioError: Capture data too large. Try decreasing period size
any suggestions?
fresh updated jessie (tried full and lite) install on a pi2 with webcam mic
Corbin Cook
disreguard that error, faulty webcam mic, problem solved
Shlok M.
Does this work in India?
Sam
It will work in India, but not in Hindi or Punjab, only in English
Ritesh
It does.
Kevin Hainsworth
Trying to get this project (Amazon GitHub flavour) to work on an RPi3 with the latest Jessie has been a “steep learning curve” shall we say. Despite the latest GUI audio settings I cannot for the life of me get a USB mic and a separate USB audio card output to my speaker to work at the same time. It appears to be one or the other. The only way I could get this project to work was headless (so no default to HDMI), USB mic, speaker on the audio jack (very very hissy). Things have got so desperate now that I have ordered a Cirrus Logic Audio card!!! Wish me luck.
tim Rowledge
In theory it is possible to configure ALSA to handle multiple input and output devices (though very complex) but Simon’s gui setup app is not yet clever enough to do that for you.
Kevin Hainsworth
Hias has helped me getting my Cirrus Logic audio Card working. I installed his drivers and followed the instructions at http://www.horus.com/~hias/cirrus-driver.html but I repeatedly got the error: ” line with format PCM_SIGNED 16000.0 Hz, 16 bit, mono, 2 bytes/frame, little-endian not supported”. It appears that somewhere along the line a “rogue” asoundrc file has been acquired in /home/pi. I do not know where this file has come from.It is a hidden file which is listed when ls -la is used or ctrl H in the GUI file manager. Once I renamed this file all was well. I wonder if this is what others have been experiencing who get this error ?
Greg
I’m getting that error too. The .asoundrc file is created when you select a non-default sound device using the speaker icon in the top right of xwindows. (Which I need to do in order to make my USB device the default.
David
Is there an option instead of a USB mic and button to use an app to trigger the echo and capture / send the voice command? It would make the project cheaper and more usable
shivaraj
App is the best idea combine that with Bluetooth Headset, the perfect solution.
GemBro
Other activation processes, other than the simple switch, would need 2 states, to trigger the EchoPi, when asking a question … voice activation would not really work or be efficient enough (imho) because of the required 2 states, to make the EchoPi work properly.
iR could work if you have one button for activate and one for de-activate, you then have your 2 states, other than that it will be the same as the voice activation issue.
EXAMPLE (Using voice activation):
State 1:
Using a button: Button is pressed – Amazon is now waiting for your question.
Using Voice Activation Process: Voice activation has been initialised with a voice command – an electronic switch (transistor or whatever you decide to use) is engaged (closes the button circuit).
Intermediate state: Ask a Question: “Alexa what’s the weather like……..”
State 2:
Using a button: Button is de-pressed – You’re now waiting for the response from Amazon.
Using Voice activation process: Voice activation is still on (active) – therefore the electronic switch (transistor or whatever you decide to use) is STILL engaged (a closed circuit, i.e. button still pressed).
One workaround for voice activation, for it to work properly, would require a set time-delay (window) in which your your question is asked … then after that set time-delay it would switch off the electronic switch (transistor or whatever you decide to use), then ‘State 2’ would kick in and take effect and you would get your answer from Amazon.
I can see this to be a pain if you want to be quick and have a short question, plus getting in a long question (within that set time) may not be good enough for Amazon to process and could lead to errors. Even if you have another voice command to end the question, that could then be mistaken as part of the main question.
Just a thought … but would love to hear any work arounds
JackH
Really excited to try this version: https://github.com/lennysh/AlexaPi
Has anyone gotten this to work with a Bluetooth speaker? I’ve been having a devilish time getting a Bluetooth speaker working with my Pi3. Getting both of these things working together would be fantastic!!
Sasankh BC
I got it to work with my Bluetooth microphone but the Bluetooth speakers don’t work. I had to plugin the earphone to hear the response.
WillA
So. . .the Amazon “ALEXA VOICE SERVICE PROGRAM REQUIREMENTS” say:
“(m) you will not implement far-field voice recognition or use of a spoken word to trigger the activation of the Alexa Service in Your Products without Amazon’s prior written approval and any such implementation may be subject to additional terms and conditions;”,
which of course is the gotcha regarding initiation with the “Alexa” voice trigger.
How about using an infra-red trigger in conjunction with just about any remote-control “clicker”? You would still have the advantage of remote access, while adhering to the above rule. And lots of folks have made infra-red receivers work with a Pi. Some code mods might be needed, but probably nothing too difficult. Thoughts?
JackH
Rats! I can’t get this to work. When the scripts run, I get the following error:
Object “=” is unknown, try “ip help”.
python: can’t open file ‘./auth_web.py’: [Errno 2] No such file or directory
Open http://:5000
Parsing the setup script, it looks like this is expecting an ethernet connection and not a wireless one. Can anyone troubleshot this for me?
Jack
JackH
Got the original novaspirit version to run. Pretty exciting that it works, but it is severely crippled. No music, etc. When I use the configuration app it says that my AlexaPi is disconnected. I don’t think this version is much different. In the video, the poster says he didn’t bother configuring Amazon music service. I went ahead and did it. Seems like there might be some kind of waiting period.
Not much use without the ability to play music but fun project nonetheless. Looking forward to getting the real thing.
PaulY
We had the same problem with inability to stream audio. We configured the Prime music service and have a Pending status. I wonder if this is keeping the Pi offline? Alexa question and answer functions are working though.
dan
Hi, got this working using NovaSpirit instructions plus hrs of pulling hair. As far as the button you can use a combination of wiringPi and Voicecommand. script for wiringPi gpio mode 1 output, gpio write 1 0, sleep 6,gpio write 1 1
that grounds GPIO 18 for 6 seconds, still trying to get Voicecommand to hear my commands but it should in theory call the script with your keyword, the script does work, Alexa’s audio is not triggering Raspberry Pi audio out fast enough to hear the first bit of what she is saying any ideas?
TheBardRaton
I have this working on a Pi3 following the example from Amazon on GitHub. Didn’t really take that long as its basically following directions. I got it all working on a Saturday morning. I don’t care about the button because the walk through includes TightVNC. Load that and you have a remote button through the VNC connection on your phone/tablet/PC.
Everything works except Amazon Music. There is an approval process that can take 10 business days. We’ll see if they approve me. If not, I might not use it because having a Bluetooth media center with Alexa, Pi3, and Bluetooth speakers is my goal.
The only complaint I have so far is that the device does not listen for a long enough time. I get cut off if the command is too long.
geometry dash online
I got it to work with my Bluetooth microphone but the Bluetooth speakers don’t work. I had to plugin the earphone to hear the response.
Linda
However, I’ve not tried the technique on Amazon’s github site. It’s far more complicated and has more steps. I simply skimmed through it, so I’m uncertain if what NovaSpirit does (or alternatively Rob Mercer) is merely make it easier by creating the program, but I haven’t tried out to find that out. I may make an effort to do it, bt my real-deal Echo will come tomorrow,
Robert
I managed to get it working on a Raspberry Pi model 1 B. I had to try several different methods of loading the correct JAVA version, but it works great. I also had to force the output to the 3.5mm jack. first thing i did was to use my RasPi Eco to order an Echo Dot (since you have to use voice ordering to buy it). Even on the older version pi it works pretty well.
John
Can you order via voice command from Amazon with this?
Robert
yes, that is what I did to order my Echo Dot. the order shows up in my Amazon account.
dan
I reported earlier the idea of using VoiceCommand but turns out they are out of sync with reality which the project should be removed from the Internet “Steve” as it can no longer work since Google shutdown its “free” api to do voice recognition. So there is no Voice recognition working for Rasbian Jessie. But my alternative was to create a script(GPIO) and an html file to activate Alexa, it works. Just use my phone to send request to activate Alexa and she answers. The thing is Amazon could pull the plug at any time so is it really worth investing time in this. I ordered an Amazon DOT it runs $90 which is twice what I got invested in raspberry pi setup and far more robust. I found out the Raspberry echo is very limited by Amazon, “your device is not capable of that function”. Like ask it to set a timer for 10 minutes, no music either.
sa0987
the AVS (Alexa Voice Services) isn’t a complete Echo. Echo has access to Alexa Skill Kit (ASK). the Skill kit is nothing more than running other commands via the voice services. Once I get mine running (currently getting alasaaudio errors), I will reply in more detail. I have written ASKs before, but have to see how we can tie AVS to do something else. If we get text back, you can act on the text which is easy to do.
Alex
Hi, does anybody get the Alexa Pi together with fauxmo (virtual WeMo devices) on the same RaspberryPi? I tried but the Alexa does not detect the device(s).
Wikene
Hi!
Is it possible to get Alexa Echo to control lights on and off when its installed on Raspberry pi?
I got Alexa Echo working on my Raspberry pi 3 and was hoping it would be possible to control my lights with Alexa.
sa0978
help!
i get the following error – brand new Raspi 3 and Jessie 3/18s
Checking Internet Connection
Connection OK
ALSA lib pcm_hw.c:1667:(_snd_pcm_hw_open) Invalid value for card
Traceback (most recent call last):
File “./main.py”, line 156, in
start()
File “./main.py”, line 124, in start
inp = alsaaudio.PCM(alsaaudio.PCM_CAPTURE, alsaaudio.PCM_NORMAL, device)
alsaaudio.ALSAAudioError: No such file or directory
sa0987
I plugged in my USB Device. it now generates the following error. I figured out how to address the device with aplayer, etc, etc, but not with this PY script
Checking Internet Connection
Connection OK
Traceback (most recent call last):
File “main.py”, line 161, in
start()
File “main.py”, line 140, in start
l, data = inp.read()
UnboundLocalError: local variable ‘inp’ referenced before assignment
I have put
print “listening”
so I know when it is listening, but I get this error immediately after taking GPIO18 to ground (pin 12 GPIO18)
Martin Mander
I had this a few times when getting the AlexaPi code to work – have you already run the auth_web.py script and signed in to the amazon web page? That was what seemed to fix it for me. I made a couple of other setup notes that might be useful in my AlexaPhone project writeup at http://www.instructables.com/id/1970s-Raspberry-Pi-Amazon-AlexaPhone/ – the AlexaPi open/closed issues page on Github is also really useful!
JackH
My request to include Amazon Music Service on my AlexaPi was rejected by Amazon!! Curious whether others have had the same experience. I think Amazon is crippling it on purpose so people will buy the Amazon products. Lots of other features of the Echo also disabled (such as timers and alarms). At the end of the day, this build is no substitute for the real thing (although it is a cool way to control my Nest thermostats!). BTW, be careful about enabling the 3d party “services”. I tried using one and it ruined my build. Couldn’t get the service to quit. Couldn’t fugure out what it changed. Had to go back and start all over again.
Brad
Rejected as well. Took 12 days for them to respond. Bummer. So much for that project.
Brad
This was Amazon’s response. I didn’t answer the questions well enough:
Hi. Unfortunately, your recent request to access Amazon Music through the Alexa Voice Service developer preview has been denied.
You are missing sufficient answers to the following questions:
· Please briefly describe your device’s buffering/caching mechanisms – you must have a valid caching strategy and local caching of music for more than 10 seconds in not allowed
· Please briefly describe your device’s music playback capabilities.
I can reapply. I’ll have to search for the right answers.
JackH
I read on GitHub that you should reply “none” for the buffering/caching mechanism and resubmit the request. Folks said they’d gotten approved with that response. I’ve resubmitted and am waiting for a new response.
Good luck!
Brad
Thanks. Resubmitted. I’ll update the post when I have an answer.
Geoff Bourne
I just build my Alexaberry…my fist Raspberry Pi project. Here is what I discovered: https://medium.com/@geoffbourne/i-built-my-own-amazon-echo-alexa-with-a-raspberry-pi-alexaberry-4248f1ed4340#.1s1lzjh9y
Corey Faulkerson
how do i get the alexapi to run some python scripts when i say a command. I have written python scripts to control my garage doors and lights and i would like to use my voice to launch the scripts….any ideas?
Gergely Hajcsak
Hey, I’ve been working on a project on the Raspberry Pi creating a voice controlled home automation system. Here’s a link to a video showing a few features:
https://www.youtube.com/watch?v=-D1SN6S6k1s
Thought it was worth sharing with the community to get some feedback.
Hope you like it.
Greg
http://www.theadrianproject.com
NK
I made it with a pi2!
Spencer Organ
Just set this up and it works really well. Just to let it set my location to England!
KKBarnes
Does it work in other Euro countries (besides UK?)
{}
It also appears to work with my Pi B+!
Stuart Hunter
I have a Sense Hat attached to my Pi, so can’t get to GPIO18 to hook up a button.
But the Sense Hat has a joystick and so maybe it is possible to use the center click of the joystick (which emulated pressing ENTER) instead of the button on GPIO18.
Can anyone suggest how to I could mod main.py to sense the joystick instead of requiring the button press on GPIO18.
Be9Concepts
I built one of these things!
I tried mimicked Amazon’s design a little bit :)
I can’t get it to read audiobooks or play radio as I think those services are reserved for Echo users.
Here is a video of it in action:
https://www.youtube.com/watch?v=P9Ii44HXaQA
Peter Pavey
Great work, very clear and helpful Thanks!!
Comments are closed