Yer a Wizard, Internet Person: How to Make a Magic Mirror Without Going to Hogwarts

There’s a reason one of the popular projects to make with a Raspberry Pi is a magic mirror: it’s deceptively simple, there are lots of examples of previous projects out there, and it makes you look like a freaking wizard to anyone who doesn’t know much about computers. I picked up a Pi without a good idea of what I wanted to do with it and I made magic, or at least something close enough (and you can too!)

Ready? Here we go!

The first things I started with were getting the hardware pieces in order. Honestly, working with hardware is one thing that I do miss from my old life, before I was a developer. I used to fix computers and there’s something comfortingly solid about plugging things in to each other and watching them come to life. A mirror had the potential to have enough interesting pieces to get a little bit of that back.

There are really only a few major pieces you need to put a mirror together. You need the mirror itself, a display, a Pi and something kind of frame to put it all together. I had a shadowbox frame that was 11x14 that was about 2 inches deep, plenty of space inside. I drilled through the bottom a couple of times with a cheap IKEA power drill so I could run some cables into it. The mirror I got from a plastics supplier in Chinatown called Canal Plastics. (Here’s their super sweet old school website.) The people there were really nice and even cut the plastic down to size for me.

The biggest decision I had to make was what kind of display to get. I was looking online in a bunch of places for a display of the right size. I wanted something thin and light, maybe one I thought I could pull out of the housing fairly easily. I wasn’t having a whole lot of success finding the size I wanted and everything was a little more than I wanted to spend on just a display. Then I thought “Wait. Why do I need one in a housing? I’m going to be providing that part.” So I changed my search tactics and started looking for raw parts. I settled on a 15" laptop replacement display, specifically this one. I then had to pick up a board so that I could actually use it with the Pi. I grabbed this guy from Amazon. Just make sure you pick one up that is compatible with your display! This turned out even better than I thought as the one I got also included an IR receiver with remote. I made a little space for it when I put everything in the shadow box and yes, it works through the mirror. I picked up one of these power supplies and I was ready to go.

After some experimenting with the pieces (these replacement sets don’t come with instructions!) I got everything plugged in. I used some cardboard to hold everything in place. Here’s a shot of the interior of the mirror with all the pieces connected.

Yes that is pink cardboard from some online shopping. Come at me.

Couple of things:

  1. The curls of cardboard on the upper right and lower left are just to keep the back of the frame in place and the display pressed up against the mirror.
  2. Yes that is a retractible HDMI cable. I don’t usually like retractible cables, I think it’s too hard on them to be under stress like that all the time but in this case I thought of it as pre-included cable management. I used some rubber bands just to get a little more length on the cable so I could get them to lay flat without pulling on other pieces.
  3. You can see where I cut out 2 holes in the cardboard to let cables come through for the display. It’s a little hacky, but it works.
  4. The little IR receiver is in the lower right with a little cutout so I can still use the remote.
  5. I’m using a wireless keyboard/mouse combo to control it right now, in case I’m being lazy and don’t want to ssh into the Pi.

And here it is working:

Please ignore my messy room and messy hair

I got the mirror up and running really quickly by using an awesome open source project that you can find here. It’s an electron app with some options you can configure really quickly out of the box and then you can add your own widgets. I’ve got some ideas for some things I want to build next (pokemonGo locator???) but I’ll leave those for another post. There are also a couple of issues I’m still sorting out, like display visibility in varying light levels. Also, sometimes it does this for some reason:

Alright, calm down mirror, that’s not a time

For reference, here’s a parts list:

  1. Raspberry Pi
  2. Display (here I went with a replacement laptop display and an inverter board combo)
  3. Power supply, both for the Pi and the display
  4. Keyboard and mouse for controlling the Pi
  5. Two way mirror
  6. Frame to put it all in

So my continuing adventures in magic mirror land will be more software focused from here on. I’ve been meaning to look into Electron a little more anyway. I might just write my own app.

I hope someone out there finds this helpful in making their own project! Just because something has been done before doesn’t mean it won’t be fun and interesting to you! Happy making!