“Alexa, raise my desk to 15 inches”

Last year, I built a DIY Raspberry Pi controlled electric standing desk.  It was a great project and I’ve gotten a ton of use from it.

To move the desk, I simply had to:

  1. Launch PuTTY on my computer
  2. PuTTY to the raspberry pi
  3. Log in
  4. Navigate to the directory where the program was running
  5. type sudo python3 robotdesk.py
  6. Tell it what height to move to

It works and is definitely better than sitting all day… but we can do better than that, right?

Yes, we can.  My desk is now voice-activated via Amazon Alexa!

Isn’t that better?

How does it work?

There are 3 parts to the integration:

  1. Alexa Skill
  2. Azure-hosted API
  3. Desk Controller

voicesolution

Alexa Skill

Amazon has an SDK for the Amazon Echo family devices called the “Alexa Skills Kit“.  In short, the Alexa skill contains 3 things:

  1. The things your skill can do (called intents)
  2. Sample ‘utterances’ and how they map to the intents
  3. Instructions on how to call your program

Your program can either be an Amazon Lambda program, or it can be a HTTPS API that the Alexa service will post a message to.

It’s easy to set up a simple skill to get started.  Check out the Amazon developers site for how tos, tutorials, etc.  Or if you want to learn in a bit more structured way, check out “Developing Alexa Skills for Amazon Echo” on Pluralsight.

The speech assets for my desk are on github.

API

The API is simple and does 2 things:

  1. Receives commands from the Alexa service and translates the intent and parameters to a desk command
  2. Responds to the desk controller’s requests for command.  The desk is using a long-polling mechanism to get commands.

The code is here (disclaimer: this is hack-it-together code, not production quality!)

Desk Controller

The desk controller uses the python program I had previously created to control the desk, but adds long-polling to get commands, rather than waiting for someone to type into the console.

What’s Next?

The program has lots of room for improvement, the Amazon process for certifying skills is rigorous, and the interactions with the desk will get better as I find the terms that I want to use to control it.

Have feedback?  I’d love to hear it.  Leave a comment or reach me @_brentonc on twitter.

Amazon Echo just bought paper towels for me?

This am, true story:

Me: “Alexa, I need to buy paper towels”

Alexa: “sparkle 24 giant rolls, white, your order total is $27.  Should I place the order?”

Me, puzzled at this unexpected response: “um, yes?” 

Alexa: “Ok, order placed.  Your order will arrive on Tuesday, May 26th

Me: oh crap, I still have ~24 rolls from my last order!

Using Amazon Echo to add stuff to Trello

At my wife’s request I have integrated my Amazon Echo with Trello.  We have a shared “Home” board in Trello that we use for grocery lists, things we need to get done, etc.  Now, she can say “Alexa, we need to buy milk” and voila, a new card with “Milk” appears on our “Things to buy” Trello list!

The source code is in github: https://github.com/brentonc/echo2trello

Thanks to greencoder for his project at https://github.com/greencoder/amazon-echo-cheddar which gave me a start on the Amazon side of things!