All I Want for Christmas Is a Homemade Echo

January 17th, 2017

If you ever choose to go to AWS re:Invent, I have two pieces of advice:

  • Sign up early for the sessions and workshops you want to attend.
  • Get comfortable with the fact that you won’t be able to do everything on your wishlist.

If you want to enjoy the conference in peace-of-mind, Item #2 is very important. There is just too much going on — too many great presentations, too many fascinating hands-on labs. Some of them are going to conflict, and despite the magic of the Cloud, you still can’t be in two places at once.

This was my situation at the end of November. I stood in line, waiting to get into a workshop where I would learn to build a device to access the Alexa Voice Service (AVS) using a Raspberry Pi. This being my first re:Invent, I hadn’t realized the importance of Item #1, above — I had not jumped on registration as soon as sessions were available. Consequently, I had been waitlisted for several presentations I really wanted to attend. This one was at the top of my list. I absolutely wanted to know how to make an “Echo” for myself.

While Amazon does reserve a certain number of seats for walkups, most seats go to pre-registered attendees. I had lucked-out the previous session and gotten into an AVS programming workshop by waiting in the walkup line. This time, however, I wasn’t so fortunate. The walkup line was long, I was further back, and the room filled to capacity before I got in.

This same session was on the schedule later in the week. I would have a couple more opportunities to chance the walkup line. Ultimately, however, I decided to pass. This was because I learned that the same subject matter (configuring AVS on a Raspberry Pi) was detailed online in both a YouTube video posted on the Raspberry Pi Website and a Github project published and maintained by Amazon.

There was a ton of great content vying for my attention at AWS. In the end, I couldn’t justify skipping one of those opportunities to possibly get into a session where I would learn how to do something I could teach myself at home, using online resources.

Of course, the trick to making a call like this is having the discipline to actually follow-through when you get home. I decided to set a deadline of Christmas — my gift to myself would be a homemade Echo, including everything I would learn about AVS while building it.

For anyone interested in doing the same, here’s how it went.

The Pieces

The Raspberry Pi section of the Github project linked above begins with a list of hardware you will need to complete the device. While I already owned several RPis, I did not have either the Pi 3 or the Pi 2 Model B required for this process. I decided to go with the Pi 3 because it features built-in WiFi, and I wanted the option to use this device in a variety of locations — perhaps not always conveniently situated near a network jack.

To get your Raspberry Pi up-and-running, you can purchase a variety of mini-SD cards with the NOOBS (New Out Of Box Software) setup program pre-installed. NOOBs will assist you in configuring the operating system on the Pi.

The Raspberry Pi will run a number of operating systems, including (among others) Windows IOT Core and various flavors of Linux. When you create your AVS device, however, you will want to make sure your RPi is running Raspbian Jessie, the latest version of the Linux distribution officially supported by the Raspberry Pi Foundation. If you happen to receive a pre-loaded mini-SD card with an older version of NOOBs, it may not be current enough to setup Jessie on your device. In this case, you will need to download the latest version of NOOBS. I wanted to polish my skills setting up an RPi from scratch, so I decided to get a blank 16 GB SD card.

I had an old pair of speakers laying around, so I decided to repurpose those instead of dropping $15 on a new speaker just for this project.

I like my devices to look finished, so I added a case for the RPi, as well.

The Github list includes links to Amazon (of course) where you can conveniently order everything you need. I loaded up a cart and ordered a batch of parts for delivery a couple days before Christmas. Everything had arrived by Friday, which meant Saturday morning (Christmas Eve) was Homemade Echo Day!

The Project

The first step, once you have collected the various pieces of your device, is to assemble your Raspberry Pi and get it working with Raspbian Jessie.

For me, everything went together pretty smoothly. BTW-the Official Raspberry Pi 3 Case, is awesome, with a solid feel and a brilliant break-apart, easy-to-re-assemble design.

The only hiccup I had here was caused by my lack of familiarity with the Raspberry Pi 3 and Raspbian Jessie. My WiFi connectivity didn’t work immediately following installation, even though NOOBs had me identify the SSID and enter the password. I immediately started troubleshooting by going to the Web and finding forum posts that pointed me to various configuration files. After spending about an hour on this, however, I discovered that these were out-of-date posts referring to a previous version of Raspbian. It appears Raspbian Jessie has moved things around a bit in the OS, and has also included a WiFi icon in the upper-right-hand corner of the Pixel GUI. Despite my preference for doing everything in Linux from the command line, I clicked a couple of times, re-entered my WiFi password, and everything was good-to-go.

Configuring your functional Raspberry Pi as an AVS device is very straightforward, and consists of the following:

Developer Account: To complete the Github project, you will need an account on the Amazon Developer Portal. If you don’t already have one, it’s free, and takes about five minutes to set up.

Security Profile: You will then need to create a device and security profile. Make note of your ProductID, ClientID and ClientSecret. Don’t forget to double-check your entries for “Allowed Origins” and “Allowed Return URLs” (if you want your AVS device to function properly!) Also — if you want to stream Amazon music on your new device, you will need to complete a few additional fields.

Application: Everything runs off the sample app in the Github project, so you will need to clone it locally. This requires two command line entries and a short wait.

Install Script: Modify the install script by updating the ProductID, ClientID and ClientSecret with the values you got when you completed your device and security profile, above.

Run the installation!: You will need to respond to a few questions at the beginning. The installation itself takes about a half-hour, which may be the longest single part of the whole process (if you don’t, like I did, waste an hour troubleshooting a non-problem with your WiFi).

Run Commands: You will run three commands, executing each in a separate terminal window on the RPi desktop:

  • Authorization Web Service: Authorizes the modified sample app with AVS.
  • Application: Start the modified sample app so it can communicate with AVS. There are a number of steps to this (outlined in the Github project,) including logging into your AWS developer account from a Webpage. I got tripped-up here temporarily, because I had entered my Return URL incorrectly (see above). I had typed it as an http:\\ address and it needs to be an https:\\ address. So be careful! 😃
  • Wake Word: For your device to act like a real Echo (meaning you can talk to it hands-free) it will need to respond to a “wake word”. The Github project provides a couple of wake work engines from third-party providers: TrulyHandsFree from Sensory and Snowboy from KITT .AI. Pick one and enter the appropriate command in the last terminal window. I used the Sensory engine and didn’t have any issues.

Talk!: That’s it. Now you can talk to your homemade Echo like you would any actual Echo device you might buy from Amazon. I enabled Amazon Music (see above), so shortly our family room was filled with the sweet melodies of Nat King Cole’s Christmas album.

The Purpose

So what’s the point of this exercise?

It’s certainly not to save money. The components of my homemade Echo cost me over $65.00, and if I hadn’t reused my existing speakers it would have been closer to $80.00. As I write this, the Echo Dot is selling on Amazon for $50.00, and before Christmas my wife and I ordered one for our daughter for $40.00.

You’re also not going to build any sort of market-ready product by using the Github project. Yes, I can talk to my homemade device hands-free, but the quality of the $5.00 USB microphone is a long way from the far-field voice recognition built into the Echo. This is a fun proof-of-concept, but it’s not (and was never intended to be) ready for prime time.

Finally, you’re not going to learn anything about AVS programming from this project. It’s basically a “cookbook” exercise — downloading, modifying, and running the Github sample app.

So why do it? I assume Amazon created the Raspberry Pi AVS project to help developers understand how devices hook into the AWS ecosystem to leverage the Alexa Voice Service itself. What you’re really learning here is how to setup a security profile on AVS. This lets you see first-hand how the “Device Type ID”, ClientID, ClientSecret, “Allowed Origin”, and “Allowed Return URLs” work together to authenticate the device — allowing it to access the service. This is of course a prerequisite for building and running code that utilizes AVS, which is beyond the scope of this project.

For its limited objective, I found Amazon’s approach here to be an innovative and successful way to teach an important skill. I suppose they could have accomplished the same thing by putting it into a white paper — but who would have stood in line for that?

Amazon is changing the world with a platform you’ve never heard of

December 4th, 2016

AWS: Reinvent 2016
AWS: Reinvent

This past week I had the privilege of attending the Amazon Web Services re:Invent convention in Las Vegas. I walked away with a ton of new knowledge and three strong impressions:

  1. Amazon is reframing information technology in a way that doesn’t require the use of the Microsoft Windows operating system, PCs, or even servers.
  2. This new infrastructure is already here, enabling the services of othercompanies you know and use every day.
  3. Most people have no idea it’s happening.

Amazon Web Services (AWS) has been an important part of the Cloud-computing scene since 2006, when the online retailer launched s3 (a file-storage service) and EC2 (a service offering hosted virtual server instances.)

Since then, AWS has deployed scores of additional services, including:

  • Relational Database Service (RDS): allowing customers to host enterprise-class databases in the Cloud using formats such as MS-SQL, MySQL, PostgreSQL, and Oracle, without maintaining their own physical or virtual database server.
  • Lambda: giving customers the ability to run code using an engine hosted and managed by AWS, instead of on their own server.
  • Lex: artificial intelligence running as a hosted service, making it possible for customers to include automatic speech recognition and natural language understanding in their software applications and devices.

These are just a few from an array of services AWS has created (and continues to create) to support its Cloud infrastructure. You may notice a common characteristic across the three services I have described — none of them requires the customer to build, deploy or maintain a server.

AWS regularly utilizes a particular term for this: “serverless architecture” — and customers appear to be embracing it.

If there was a common refrain at re:Invent, it was “Data centers are a pain. Data centers are expensive. We were so happy the day we shut down our datacenter.”

Datacenters, however, aren’t the only source of pain. Taking care of servers is painful, as well. All throughout the convention we heard from AWS customers who have rewritten their business-critical applications to utilize the hosted compute services at AWS. These customers aren’t just moving their servers into the Cloud — they are getting rid of many of their servers entirely.

This process may herald an end to the long-established dependence of the business community on Microsoft Windows and the PC. When developers rewrite applications, they often recreate them for the browser, not for a particular computer operating system. When they do write for an OS, it’s likely to be iOS or Android, rather than Windows. For those who need to stay within the Windows fold, AWS offers the WorkSpaces and AppStream services, giving the customers the option of moving their workstations and applications into the Cloud.

How does this affect you? Many consumer services you already use are powered by this new infrastructure. I heard presentations, among many others, from Netflix, Johnson & Johnson, and McDonalds — all describing their deep integration with the Cloud environment at AWS.

Most of the sessions I attended also touched in some way on the Amazon Echo and the Alexa Voice Service behind it. The presenters made it clear that Amazon doesn’t consider the Echo a consumer novelty. Rather it is a “reference device”, showing other manufacturers how to design for a new user interface to tap into the computing resources at AWS.

The most interesting take-away from the convention was the disconnect between what was happening there and the perspective of those who don’t realize the extent to which AWS is changing the game. I spent a week with thousands of people representing hundreds of companies all working very hard to make the current computing environment obsolete.

When I told non-attendees I was in town “for the Amazon convention,” they typically wanted to know if it was a conference for product vendors who sell on the retail site. Most of them had never heard of Amazon Web Services. What was happening at re:Invent was going on “behind-the-scenes”, and it may be some time before the scale of change becomes obvious to those outside the tech industry.

The effects, however, are already becoming apparent. My Uber driver asked several questions, curious what I meant when I referred to AWS. I motioned to the phone mounted on his dash and told him “You’re using it right now.” That may be all of us soon.

Brian S. Pauls has over 20 years of experience navigating the rapid pace of change in computers, networks, and the Internet. He doesn’t mind when companies change the world, as long as they do it politely.