Practical project: Magic Mirror - part 1

We're going to do something that is a little whimsical and timely given that it was recently Valentine's day.  First let's discuss the motivation.  Snow White had this evil relative that could call out to her magic mirror by saying "Magic Mirror on the wall" and then ask it any question.  Well ya know what, we can build our own magic mirror that will respond to questions with answers, display a face, or just display some relevant information sans the evil relative bent on feeding poison apples.  Ours will display everything from motivational statements to agenda for the day and news about commute; thus works quite well for a practical Internet Of Things (IOT) project.

There's some really cool magic mirrors out there built with raspberry pis. The goal of those projects is to do something that displays a message of encouragement or displays an agenda.
For our version, we're going to do a Magic Mirror that does something a little more advanced than just display text or show some agenda information.
Our goal here is to build a magic mirror that's closer to the one in Snow White's fairytale.  Ya know with interaction and everything.

Our Magic Mirror will not only give details about your day, but allow the user to actually interact with those details and give us reasonable practical benefit for our work.  We'll use FastCV with a camera which will help us by making a guess about what kind of mood the person is in while looking in the mirror while also giving the end user the ability to swipe or tap their way through the information on display, and a microphone with CMU (Carnegie Mellon University) Sphinx in order to control it with voice recognition.  These advanced features are processor intensive tasks, which means that it will require something a bit more powerful than the Raspberry Pi.  For this project, we will use DragonBoard 410c from Qualcomm.  Note that in Part 1, we will leave out the microphone and camera and just concentrate on getting the basics easy stuff setup, a controller board, a two way mirror and a HDMI display inside of a wooden wall-hangable case to make us think, wall mirror.

First, let's get the basics out of the way: Parts required for this build are:

  1. 2 way mirror Any size will do, however, ensure it's larger than your chosen HDMI screen.  For my project I used a 12" x 12" 2 way mirror from Amazon.
  2. HDMI screen - Any size is fine, but definitely the thinner the better as everything else must be behind it in the case that you make and any room you can get is a good thing.  Also ensure it's smaller than the mirror so you can place it anywhere within the mirror.  I chose a 10" by 10" HDMI screen with controller card from Amazon.
  3. DragonBoard 410c - Qualcomm made a great controller card with the juice we need to do conversational speech to text and image recognition.  I got mine from Arrow.  Please read about how to get the 410c setup on my blog here.
  4. DragonBoard 410c power adapter - The 410c does NOT come with power, you must get your own.  While I will go over how to power projects without a power supply drawing from house AC, this project wouldn't do well as a battery solution, it just hangs on the wall so why not power it from a standard plug.  Here in the US, I got a 110v plug from Arrow.
  5. wood cut to make enclosure - or find a frame of the right size to hold everything.  Be creative here, but a trip to Home Depot, Lowes and the craft store can make for some great material to use.  You're also gonna need to drill out a hole for the power cord to go through in the base, I also recommend leaving a few slits in the sides to allow for airflow (2nd law of thermodynamics says that it could get hot in there if you don't let all that electric work have ventilation).  NB: I chose wood here because it wont interfere a lot with the wireless signal from the WIFI on the 410c card.  Metal might look cool to you, but will probably make connecting to internet a challenge.
  6. Small Extension cord.  I find it convenient to only have one plug for the mirror.  Yet the HDMI screen needs power as does the 410c.  An extension cord will handle our routing and allow for one plug coming out of the enclosure while we plug in two plugs inside the enclosure to the extension cord.
  7. electrician's tape.  This should be your basic black electricians tape, I use it to cover all the LCDs that can light up in the back and cause the 2 way mirror to no longer look like a mirror (the darker it is inside the enclosure, the better you'll believe it looks like a regular mirror.
Notice that I left the camera and microphone off the list above?  Both will be discussed in part 3 of this project.

Now on to the fun.  First, make certain you have setup your DragonBoard 410c in the manner described on this blog here.  Now let's do the hardware first, as you already know how to SSH into the 410c, once the mirror is setup, you can do all the software after the hardware is done.

Okay, now on to the hardware, I found it easier to mount the mirror into the enclosure and leave the back empty to allow for easy access.  So place the mirror into the enclosure and flip it around so that the mirror is on the bottom and you're looking at the back of the open enclosure.
Now place the screen against the glass and use the electrician's tape to hold the screen in place.
Next place the screen controller card on the side of the enclosure and hold it there by either screwing it in through the predrilled holes or use more electricians tape to hold it. (I don't want to put electronics behind the screen directly as I don't want screen to get hot).
Next wire up the screen to the controller card that shipped with it.
Next hook up the power cord to the bottom near your cord power hole and use electric tape to hold the power cord in place and run the cords for both the HDMI screen and the controller card.  I taped the cord to the enclosure to keep things tidy.
Finally place your 410c controller card into the enclosure and hook up the HDMI cable and the power, now plug it in and ensure you see the OS booting up through the mirror; you're done with the hardware side of things until we get to adding in the webcam and microphone in a future revision.

Congratulations, you now have a functioning Magic Mirror.  In part 2 we will work solely with the software that will be used for displaying contextual information on screen rather than the desktop background.  Then in part 3 we'll start with hardware again adding in a webcam and microphone.  Finally in part 4 we tie everything together with image and voice recognition and application logic to handle new actions and screens to show.
The intention here is to allow you to make your own project, stopping at any time and enjoying what you have with no further requirement for future work.  The further you work through these blog posts with me, the more features your Magic Mirror will have.  Until part 2, go find a nice place to hang your mirror and see that it fits in with its new home; we'll be starting part 2 soon.


Popular posts from this blog

Drone VR Software Architecture

Build Snapdragon Flight Drone

Soldering new connectors for the drone