Building a Magic Mirror using Alexa, AWS, and a Raspberry Pi

Mystic_Miror_Logo_NewSome people spend their vacations traveling, or relaxing, or visiting family. I spent my two weeks off building an Alexa enabled, Raspberry Pi device for Hackster’s Internet of Voice challenge.

But, to paraphrase Madonna: “Don’t Cry for Me, Internet.” I really enjoyed those two plus weeks of coding. I learned a ton about AWS IoT and MQTT (and re-enforced some “non-sexy” skills – like security and IAM).

And the device that I decided to build…. a magic mirror. Why a magic mirror? Well, I am the guy that:

  • Never checks for delays in his work commute until he is stuck in a four-lane accident
  • Forgets his umbrella when the forecast calls for afternoon showers
  • Doesn’t find out about a major news event unless the story breaks on ESPN
  • Always forgets to pull my trash bins to the curb on garbage pick-up day

In short, my morning routine is a mess (#firstworldproblems). An Amazon Echo (or a phone, for that matter) would resolve most of those problems. Unfortunately, I never seem to have my phone with me as I’m getting ready in the morning (it’s usually charging). And I’m usually not asking Alexa for these details (I don’t have an Alexa device in my bathroom).

60% of my morning routine is centered in and around the bathroom or bedroom, so I decided to build an Alexa skill and Alexa Voice Service-enabled magic mirror – which I’ve titled the Mystic Mirror.

Overview

A Magic Mirror is a Raspberry Pi device connected to a monitor fronted by a two way mirror. This gives the illusion that the text/words/images appear from the mirror (similar to the Magic Mirror in Snow White and the Seven Dwarfs). People have been making magic mirrors for years; lately there have been some that are enabled with Alexa (or other voice activated services). I wanted to make my Mystic Mirror a step further by adding a few features, such as:

  • Building Alexa functionality within the mirror, controlled by a button. This would allow the magic mirror to work with specific Alexa skills that would display messages. This would also let me use the Alexa for “base functionality” (set an alarm, use another skill, etc).
  • Not having the display always on (I am very sensitive to light when I am sleeping; an “always displaying” magic mirror wasn’t going to be an option). My requested information appears for a few seconds (depending on the request) then fades away.
  • Building the functionality/“modules” using Lambda, this would allow others to use the skill (even without a having a magic mirror).’
  • Build functionality into my Alexa skill that would support “visual push notifications” to my Mystic Mirror. This was really centered around reminders that would appear at the appropriate time.
  • Leverage Alexa to extend functionality of a typical magic mirror. For example, most magic mirrors have the location “hard coded” into code on the Raspberry Pi. I wanted to provide flexibility to get things (like weather) for any requested location.

What the Mystic Mirror Can Do

I’ve built the following major requests into the Mystic Mirror:

Time

Question: What is the Time?
Response: Alexa says the time
Display: The day, date and time is displayed on the Mystic Mirror

Weather

Q: What is the Weather?
R: Alexa says the current weather temperature, conditions, and the day’s high and low temperature
D: The current temperature, conditions, high and low are displayed, along with a 4 day forecast

Traffic

Q: What is the Traffic?
R: Alexa tells me the number of traffic incidents in my area.
D: The Mystic Mirror shows a map with traffic status and lists the incidents

News

Q: What are today’s News Headlines
R: Alexa speaks one major headline.
D: The Mystic Mirror lists 5 headlines and a short blurb on each story (and image, if provided)

Messaging

Q: Send a message to a contact (e.g. – Tell John to come home)
R: Alexa confirms that the message was sent. The skill uses AWS SNS to send a message to a contact (note this requires that you “Add a Contact”)
D: The display shows the message that was sent.

Take a Selfie

Q: Take a Selfie
R: Alexa tells you told still and sends a command to the Raspberry Pi to take a picture. Alexa asks if you want to send the picture to one of your saved contacts (using the messaging functionality listed above)
D: The picture is displayed.

Provide an inspirational quote

Q: Inspire Me
R: Alexa tells you an inspirational quote
D: The quote is displayed.

Set up a reminder

Q: Remind me to “do something”
R: Alexa prompts you for the frequency (single, daily, weekly), reminder time, and day to start the reminder
D: The reminder appears at the lower left corner of the display approximately one hour before the action needs to be taken. Reminders are removed by saying “clear reminders”. Reminders can be deleted by saying “Delete reminder”.

Brush Teeth Countdown

Q: Start teeth timer
R: Alexa confirms that the countdown has started.
D: A two minute countdown is displayed in the lower right corner. This countdown continues even if other action are requested

I also added a few Easter eggs:

Building the Mystic Mirror

Unlike typically magic mirrors, I used Alexa to display the functionality and the Alexa Voice Service apis to provide voice ennoblement.

The skill can be found here – http://alexa.amazon.com/spa/index.html#skills/dp/B01I97GPNQ

Details instructions on how to build the Mystic Mirror (the code and the physical device) can be found on my Hackster write-up. I’ll leave a few screen shots below to pique your interest.

monitor
I used a refurbished Compaq Monitor for the Mirror
notes
From there, it was pages and pages of notes and mock-ups
building_frame
After I was confident on the design, I purchased a 1X3 and used Gorilla Glue to build the frame.
unfinished_frame
The frame wasn’t pretty, but it does the job. Wood putty helps fix all blemishes.
finished_frame
It was a tight fit, but I was able to get my monitor and electronics in the frame.
final_frame
And the finished product!!!



Leave a Reply