The Raspberry Pi Magic Mirror!

Final product first!

Jump to: IntroDesignShoppingAssemblyProgrammingTakeawaysContact

Intro

For Valentine’s Day last year, I made my girlfriend a Raspberry Pi Magic Mirror! I love working with my hands, programming, and learning by trying something outside my comfort zone. And, of course, I love my girlfriend and (somewhat) practical gifts!

I’d heard about the Raspberry Pi previously and various projects that can be done with it. The Raspberry Pi is a very cool, small, and reasonably priced computer. It has more features than I really need, like extra USB ports, lots of GPIO pins, and an audio jack. The features I do need, included in the Raspberry Pi 3 model B, were 2 USB ports, wifi, and an HDMI port. Other awesome features are: the memory can be just a micro-SD chip, and power is supplied via micro-USB.

To give a sense of scale. This is an entire computer!

One Raspberry Pi project that stood out was the Magic Mirror. At its core, this is just a computer behind a one way mirror, so that it functions as a mirror but any illuminated text, videos, or pictures on the screen show through the one way mirror.

Design

Next, I had to design it. I decided to go with a 23″ or 24″ monitor because one of the best, cheapest one-way mirror options matched up well with that size monitor without much trimming. I figured I would go with a wood frame, which I estimated would need to be 6″ deep to accommodate all the electronics. I decided to use aluminum drywall bead as a retaining lip in front to keep the monitor secure, and wooden dowels behind it. I decided to secure most of the internals with sticky Velcro strips. I wanted an LED light strip around the edge because I think they look very cool, and I also needed an extension cord that could power the monitor, RPi, and the lights. I partially drew this up, partially visualized it, and mostly hoped it would just come together in the end!

Shopping

So then I made a shopping list!

Computer: I needed a Raspberry Pi, an HDMI cable, a power supply, a microSD (32gb for flexibility), and a computer screen. I already had a heat sink, thermal paste, and USB mouse and keyboard. I bought the Raspberry Pi parts individually, but it looks like there is now a kit with these parts priced better in a bundle. For the computer screen, I would recommend Craigslist for the best deals. Alternatively, eBay, Best Buy, and Walmart all sell refurbished monitors at better price points than buying new.

Tools: I needed a drill, and after some thorough research I decided on this budget option which has held up well in the year since. I mostly went with hand tools otherwise, because my apartment doesn’t have a lot of storage or work space. I got a hand saw for the wooden frame and a hacksaw for the aluminum LED strip frame (to be discussed later). I already had a measuring tape, wood glue, painters tape, and scissors. The painters tape and scissors are for cutting the one-way mirror. One other tool I had in my toolbox that ended up being indispensable was a metal file, which I used for scoring and smoothing the aluminum LED strip frame.

Materials: I had some wood screws floating around my toolbox and I had some sticky velcro strips that would allow me to secure electronics inside but remove and adjust or replace them easily if needed. I needed wood for the frame and ended up getting one piece of 6″x1″ lumber to cut to size and paint. I got a few 1″x1″ dowels to help secure the monitor in the frame. I got aluminum drywall bead to wrap around the front and keep the monitor and acrylic from falling out through the front of the frame. Finally, I needed a secure wall-mounting bracket.

Aesthetics: There are very few parts visible after the project is completed. Just the one-way mirror, the outside of the frame, the LED light strip, and the power cord. I decided to go with a remote control, multicolor, multifunction light strip once I found one that was long enough to wrap all the way around the border of my mirror. I also needed these aluminum channels to house the LED strips with frosted plastic covers. For the power supply, I chose this one that had a good looking woven fiber cord that was a decent length and had enough outlets for everything.

After getting a good deal on my monitor on Craigslist, and not counting my Lowe’s run because I don’t remember the cost, this came out to $245 and I had some new tools afterwards!

Assembly

Does my cable management make you anxious?

Measure twice, cut once. The assembly was pretty straightforward! I won’t quote any specific numbers because I never saved them to my computer and I don’t remember them.

The Frame

I sawed the wood to the right length, glued the faces that would be in contact, and screwed them together. I drilled three holes through the top along the center line to help with ventilation, and I drilled one hole in the center of the bottom and then sawed to each side of it for both ventilation and for the power cord. I calculated how long I would need each piece of aluminum frame to be and then I scored the aluminum with my file before sawing them at a 45 degree angle. I cut off an extra 1/4 of the section that connected at the corner where I wanted the LED light strip to come out from behind the frame. I screwed the drywall bead onto the front and secured it and the aluminum LED channels by driving screws through both.

The Screen

The acrylic was the right width, but was too long. In order to cut it, I figured out where the cut would be, and then covered back and front along that line with painters tape. At that point I was able to cut along that line with scissors without damaging the acrylic! I removed the painters tape and was then able to put the acrylic in through the back and put the partially disassembled monitor on top. I took off parts of the monitor to decrease its profile and weight. As is visible in the picture above, I secured the monitor in place with dowels placed horizontally and held in place with glue, more dowel pieces, and glue.

The Electronics

I plugged the monitor’s speakers and remote receiver back into the monitor and secured them at the top of the assembly. I fastened the Raspberry Pi towards the center of the monitor using velcro strips (that’s how I secured everything), and I put the power supply towards the bottom. In order to get the LED strip to run into the aluminum channel, I had to drill a hole in the corner behind where the frosted plastic would cover and conceal. The LED strip comes with peelaway adhesive backs that fit perfectly into the channels. After it was in place, I cut the frosted plastic covers down to size with scissors and popped them into place. Then it was just a matter of plugging everything in! The LED plugged straight into a USB port on the extension cord, an HDMI runs between the RPi and the monitor, and power cords run to both. Easy peasy.

Mounting

This video.

Programming

Raspberry Pi Setup

First, I had to put an operating system on the microSD that was functioning as the Raspberry Pi’s hard drive. After installing Raspbian, putting the microSD into the Raspberry Pi, I booted up with my mouse and keyboard attached for the first and last time. I set up wifi, VNC and SSH connections so that I could interact with the RPi graphically (VNC), but also quickly and nonintrusively (SSH). For most of the things I needed to do I would just need the command line interface that SSH offers, but because the end product of a Magic Mirror is very visually based, I needed to make sure that what I was doing was having the graphic effect I intended, hence VNC.

Magic Mirror Installation

This project is incredible. It makes it so easy to get started and even easy to get a great finished product, but it also makes it easy to get lost in programming and personalization. Which is dangerous for me! I followed the step-by-step instructions for installation, configuration, and auto-starting. These steps mean that there is no screen saver, no mouse visible, and the Magic Mirror program doesn’t need to be manually restarted when the RPi is.

Magic Mirror Customization

The modular nature of the Magic Mirror project makes it a ton of fun, and very easy, to use and adapt contributions from other people. I heavily modified several of the native modules. I also added a lot of new entries to the compliments module and incorporated some cool iCals into the calendar module which I had modified. The iCals I added were the University of South Carolina’s football schedule, a new movie release schedule, a holiday schedule, and a live updated iCal incorporated into my Google calendar so I can add events in my Google account and they’ll show up on the mirror.

I added MMM-NetworkScanner, which displays when you or roommates have had your devices connect to the wifi. I programmed the additional feature for it to turn the screen off when nobody had been connected to the wifi for 15 minutes and back on when somebody returns.

I changed the weather app to one that I believe to be more accurate and also has cooler weather animations than the native app.

I installed MMM-TelegramBot to send notifications to my phone if the temperature or other specs went outside of range, and be able to manually shut off the mirror in that case.

I went through a lot of ideas and debugging and modules before deciding on a low clutter option that I really like. Top left is the calendar (no longer modified after one of the recent updates really polished it up!) including the iCals. The top right is the weather, showing the conditions and temperature forecast for the day in 3 hour increments and also the forecast for 3 days into the future. In the bottom of the screen I have the native compliments module with the modified compliment bank that I created. Right above the compliments I have MMM-Carousel rotating one of the following at a time (1) the native news module with headlines from reputable sources, (2) MMM-Dad-Jokes which is guaranteed to make you groan, (3) MMM-History which shows an interesting fact or event from the current date in history, and (4) MMM-Reddit which shows the headlines and thumbnails from the top 3 trending Reddit posts at the time.

There are tons of other amazing modules that I suggested to my girlfriend but she didn’t think she would use. There are also tons of tools that could be useful on your mirror that haven’t been made into modules yet! There’s nothing I needed or thought of which I was unable to find in the 3rd party module repository.

Takeaways

Recommendations

I think it would be amazing to use some of those GPIO pins or USBs for additional features. It’s not too late to modify mine I guess. If you’re considering building one, I’d say it would be cool to include a microphone to be able to give it voice commands. It would also be cool to have an IR transmitter and/or receiver. That way it could control any nearby TVs or the LED strip programmatically. Or, with both a mic and IR features, it could control the TV and LED strips by voice command.

Success!

This was everything I hoped it would be. Educational, fun, useful, memorable, and appreciated. There are lots of ways to show somebody you love them, and I think this got the message across.

I love you, Morgan! Happy Valentine’s Day 2018 again!

Contact

I hope you enjoyed reading about my adventure building a magic mirror! If you have any questions or recommendations, please reach out! I welcome requests and criticism in any form. You can email me at feedback@thebrandofben.com or fill out the contact form online.