Just as the prophecy prophesied. Unfortunately, it's really hard to photograph this thing. It looks 1000X crisper in person.
The mirror attaches using magnets, making it easy to remove for playing retro games more clearly, or for tinkering.
As this highly-technical drawing shows, the basic idea here is to use the pi-top CEED as the display and housing for our magic mirror project. We'll install the Magic Mirror software on a Raspberry Pi computer, install the Google AIY Voice kit hardware and software, and then add a precut two-way mirror.
The two-way mirror
Like the mirrors in police interrogation rooms, the two-way mirror appears “mirror-like” from the brighter side, and “window-like” from the darker side. In this way, a dark screen with white text will allow the text to be visible on the “mirror” side, producing a holographic effect. Conversely, in a dark room, more of the screen becomes visible. This is a bit of a downside but just the nature of two-way mirrors. It can be mitigated by reducing screen brightness based on the time of day or by using a light sensor.
The Magic Mirror dashboard
By default the Magic Mirror dashboard shows the weather, calendar you choose, news ticker, current time, and -- once you get into it -- literally hundreds of other modules. Want to see if your train is running late? Or what time you need to leave for work based on current traffic patterns? Or maybe find a pet to adopt or see how the Tampa Bay Rays are doing? It's amazing what the community has built.
The Google AIY Voice hardware and software
The Google Voice Kit turns this mirror into a full-blown Google Home. This mirror can do everything that Google's Assistant can do!
If you just want to make a magic mirror (without the voice assistant), you can still use this guide; simply skip the Google Home parts. :) If you want to use Alexa instead of Google Home for your magic mirror, install Alexa on your Raspberry Pi instead.
And, of course, we'll be running all this on the third best-selling computer of all time: the $35 Raspberry Pi.
To build a magic mirror the size of the pi-top CEED, we're going to need a 13" x 13" two-way mirror.
Your two-way mirror can be made of glass or acrylic; precut acrylic two-way mirrors are generally less expensive (and safer to work with) than precut glass two-way mirrors.
There are a few ways to obtain your mirror:
Order a precut acrylic two-way mirror online (recommended)
I ordered mine from TAP Plastics here for about $40 using these options:
- Color: Clear
- Width: 13 and 0/16 inches
- Length: 13 and 0/16 inches
- Thickness: 3/16 (.177) inches -- choose this size; thinner acrylic mirrors can have a "funhouse mirror" effect
Make your own glass two-way mirror
You can save a few bucks by grabbing a custom-cut 13" x 13" glass pane from your local hardware store. Then, buy some two-way mirror film from Amazon. However, after reading tons of reviews about this approach, it's hard to get a perfect result -- every speck of dust or hair will show up tenfold. Also, this will take a lot longer. I recommend just grabbing an acrylic mirror, but if you're strapped for cash and are feeling handy, this approach will work!
First we'll need to install Raspbian Stretch, the latest version of the official Raspberry Pi operating system. Although the pi-top comes with an SD card preinstalled with a customized version of Raspbian, we want to make sure we have a fresh install of the latest version of Raspbian so that the Magic Mirror and Google Voice Kit software will work properly.
howchooer Tyler wrote a guide that will show you step-by-step how to install Raspbian Stretch. You'll want to install the Desktop (not Lite) version.
After installing Raspbian, return here!
First, put the MicroSD card back into the Pi.
The pi-top ships with little magnetic feet that will hold the Pi securely to the pi-top's internal metal rail. Snap these into the Pi, connect the GPIO (40-pin) cable, connect your HDMI cable, and put the Pi into the pi-top with the ports facing outward.
Finally, connect the pi-top's power cable and hold down the power button to boot the Pi.
We need to connect the Pi to the Internet. Then, we're going to install a bunch of software from the command line (terminal) window; to do this, you have two options:
1. Input the commands from your regular computer
You can connect to your Pi remotely from your regular computer and enter the commands from there. This method is handy if you don't have a keyboard or mouse to connect to the Pi. For this method, you'll need to connect your Pi to WiFi via the SD card method.
2. Input the commands directly on the Pi
For this method, simply connect a mouse and keyboard to your Pi. After your Pi boots into Raspbian Desktop, navigate to Menu > Accessories > Terminal. For this method, you can connect to WiFi by clicking on the icon in the top-right of the Pi desktop.
Choose the method you prefer!
First, make sure your Pi is up to date:
sudo apt-get update sudo apt-get -y upgrade
Then, restart your Pi:
Now that we have a fresh install of Raspbian, we'll need to reinstall the pi-top Device Manager and enable the SPI interface. The Device Manager lets us use the pi-top's internal hub and power button.
We need to enable the Serial Peripheral Interface (SPI) on the Pi, which is disabled by default. Run:
Interfacing Options. Use your arrow keys to select SPI and press Enter.
Install the pi-top Device Manager
sudo apt install pt-hub
Note: If you plan on using other pi-top accessories like the pi-top speaker or pulse modules, you can install them later from the pi-top Github repo. We won't be using these modules for this guide since their support for Google Voice Kit is iffy, but you might want to mess with them in the future.
We want our brightness as high as possible, so we're going to increase it to 100%. To do this, you can run the following in the Terminal window:
pt-brightness -b 10
Or, rricharz created a utility that adds a Raspbian menu item for adjusting brightness and disabling screen sleep. To install it:
cd ~/Downloads git clone --depth 1 git://github.com/rricharz/pi-top-setup cd pi-top-setup chmod +x install ./install
Menu > Preferences > pi-top Configuration you will now find a new menu item. Disable sleep by setting it to 0 and then increase brightness to 100%!
We're going to use MichMich's MagicMirror platform to turn our Raspberry Pi into a magic mirror. In a nutshell, the MagicMirror platform is a web page -- hosted on the Pi -- that displays information on the screen and forms the core visual interface of our smart mirror.
I wrote a separate detailed guide for installing MagicMirror; use that guide to install and configure it and then return here! :)
Note: Now that the MagicMirror software loads automatically on reboot, you can still get to the Terminal window by pressing the Windows (or Option) key on your keyboard and then selecting Terminal from Accessories. You can then use Alt-TAB (or CMD-TAB) to tab between MagicMirror and Terminal as desired!
Important: We need to change the port that MagicMirror uses so it won't conflict with the port that the Google Voice Kit wants to use. To do this:
port: 8080 line to
port: 8081. Save and exit.
If you don't want a voice assistant in your mirror, you can go ahead and skip to the two-way mirror installation step now.
This little $7 board gives you easy access to the Pi's GPIO pins. If you don't have one, you can use a 40-pin ribbon cable instead (though it will be more difficult to mount the Google Voice Kit board). I recommend spending the $7.
Connect the little magnetic feet to the pi-top PROTO board, attach it to the pi-top rail and slide it into the main pi-top board/hub.
We're going to use hardware from the Google Voice Kit because it's super inexpensive and will add a speaker and stellar microphone for about $20.
In theory, you could use a USB microphone and the pi-top speaker module instead, but this will actually cost you more -- and will be more difficult to configure. tl;dr; Google's Voice software is very particular about the hardware it runs on, and using Google's own kit will guarantee things run smoothly and will avoid nights of troubleshooting.
The next few steps will help you install the Google Voice Kit hardware.
Note: While I was writing this guide, Google released a new Voice Kit: the Voice Kit V2. This guide uses the old kit (V1). The instructions are still the same, but some of the photos will look different. The new kit comes with the tiny Raspberry Pi Zero W, but I recommend saving that for another project and using the Raspberry Pi 3 instead.
Put some double-sided tape on the back of the speaker and secure it to the pi-top rail. We don't want it sliding around and shorting anything out.
Then, use a small screwdriver to connect the Voice Kit's speaker to the its main board. The main board is called the "Voice HAT".
- Connect the red wire to the positive (+) terminal
- Connect the black wire to the negative (-) terminal
Note: The microphone on the new Google Voice Kit (V2) is built into the Voice HAT board. If you're using the newer kit, skip this step.
The dual microphone that comes with the Google Voice Kit is really, really good. Microphone quality is key to a voice assistant performing well! I can attest to this after using cheap USB microphones in the past to build my own Raspberry Pi Echo.
Use the included 5-pin cable to connect the microphone board to the Voice HAT. Then, stick the microphone board (connector side up) into the bottom of the pi-top. Use a bit of double-sided tape to secure it. Don't cover the microphone holes with tape!
Carefully push the Voice HAT board onto the pi-top PROTO board. This will officially connect it to the pi-top and Raspberry Pi.
All the hardware is in place. You can slide the plastic covering back into the unit if you'd like, or leave it off. If you slide it on, carefully push the Voice HAT wires out of the way to avoid damaging them.
Since we have a fresh install of Raspbian, we're going to install the Google Voice AIY software manually. Follow the instructions on the official Google AIY Github repo here to install everything. Since these instructions can change at any time, I don't want to duplicate them here. :) However, read the notes below before installing!
I ran into a two issues when installing the Voice Kit software -- this is actually due to two bugs in Google's software itself at the time I wrote this guide. They may be resolved by now, but if you run into any issues, use these workarounds:
Issue #1: ImportError: No module named 'aiy'
This error also occurs when running
Cause: A change removed the
env folder. Github issue
Solution: Revert to an earlier version of the AIY software using the instructions here. (thanks pyorgue!)
Issue #2: Failed to apply overlay '0_googlevoicehat-soundcard' (kernel)
This error occurs when running
check_audio.py and looks something like this:
* Failed to apply overlay '0_googlevoicehat-soundcard' (kernel) Traceback (most recent call last): File "checkpoints/check_audio.py", line 180, in <module> main() File "checkpoints/check_audio.py", line 174, in main enable_audio_driver() File "checkpoints/check_audio.py", line 169, in enable_audio_driver subprocess.check_call(['sudo', configure_driver]) File "/usr/lib/python3.5/subprocess.py", line 271, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sudo', 'scripts/configure-driver.sh']' returned non-zero exit status 1
Cause: The AIY software is incompatible with the latest version of the Raspberry Pi kernel.
Solution: Downgrade the kernel to version
sudo rpi-update 5c80565c5c0c7f820258c792a98b56f22db2dd03 sudo reboot
Return here after successfully installing the Google Voice AIY software!
You have a few options for attaching the two-way mirror to the pi-top. With any approach, you'll want to try and minimize gaps and get the mirror as close to the display as possible.
Using double-sided tape
This is the cheapest approach: just stick a few tiny pieces along the edges of the pi-top bezel. However, once you attach any sort of tape to the mirror material, pulling the tape off will permanently damage the mirror! I learned this the hard way. Thus, you'd need to unsnap the pi-top bezel in order to access the internals once again.
This is the recommended approach and the one I went with. Magnets make it easy to remove the mirror later -- for, say, playing retro video games with RetroPie with a better view of the action. You can still play games and watch live video with the mirror installed but of course it's not as clear unless the room is darker.
Fuckin' magnets, how do they work?
Anyways, we're going to install four neodymium magnets on the inside of the pi-top's bezel and four corresponding magnets on side of the mirror itself. Remember, magnets will only attract on one side [pole], so figure out the orientation for yourself. It's easy to install the magnets backwards, so double and triple check everything.
Note: I'm using an acrylic 2-way mirror. If you're using a glass two-way mirror or are mounting your mirror on the wall, the magnets may not provide enough holding strength to safely secure your mirror. In this case, you should probably use glue or adhesive tape instead.
Using clips or something
Get crafty -- you can also use clips or some other method to secure your mirror. Just try to get it as close as possible to the pi-top.
First, shut down and unplug the pi-top.
The screen has a connector that runs to the main pi-top circuit board and is secured by a tiny metal bar. Pull up on the plastic tab connected to the bar and then pull it towards the screen to disconnect it from the board.
Carefully unsnap the bezel using your nails, a small screwdriver, or plastic prying device. Once you get one corner unclipped, it's easy to slide a credit card or something all the way around to unsnap the rest. The screen is connected to the bezel so take great care!
For the inside of the bezel, we're going to use:
- Two 10mm x 3mm magnets at the bottom of the bezel, just below the opening
- Two 8mm x 3mm magnets at the center of the bezel, just below the screen brackets
Because the screen extends to the top of the bezel, it's difficult to fit a magnet there. This is why we're placing magnets in the center instead -- these little neodymium magnets have enough holding power to hold the acrylic mirror sufficiently. This is the magnet set I ordered and it came with both those sizes.
Placement is important so the bezel can snap back together easily. After placing the magnets and before gluing them, hold them in place by placing magnets on the outside of the bezel. Then, try putting the bezel back on to make sure the magnets aren't blocking it from snapping back into place. Placing the magnets 35mm from the bezel's edge to the center of the magnet seemed to fit just perfectly.
To secure the magnets, use a dot of super or hot glue. It doesn't take much; the glue just holds the magnets in place. The magnets themselves will stay in place because magnets. Keep the temporary magnets on the outside of the bezel to hold the magnets in place while the glue sets.
After the glue dries, carefully reattach the screen connector and snap the bezel back into place.
Now we need to glue the four (or more) magnets to the mirror itself. The magnets should go between the pi-top and mirror so they aren't visible when the mirror is in place.
First, lay the pi-top flat on the table. Place magnets on the pi-top bezel itself and draw a dot in the center of each magnet using a permanent marker.
Then, place a flashlight or something next to the pi-top so that it's brighter behind the mirror -- this will allow you to see the magnets (and dots). Use this method like tracing paper to mark small dots on the mirror itself. This will help you to align the magnets perfectly. If the magnets are far off, you might not have enough holding power.
If your mirror doesn't have the holding power you want, just add a few more magnets inside the bottom of the bezel. :) This can vary based on mirror weight.
The built-in pi-top stand works great for setting your mirror on a desk or table. If you want to mount your mirror on the wall, we'll want to reverse the stand so that it goes up instead of down. Then you can hang it from any standard picture hanger.
If you plan on mounting your magic mirror on the wall, you'll want to reverse the stand while the bezel/screen are detached since this takes a bit of force. Disconnect the stand at the bottom section first -- where the rubber couplings in the attached photo are -- and then carefully wiggle the stand out of the housing.
Do this at your own risk as you can break the stand. Remember, there are always other ways to mount your magic mirror to the wall! Just get creative.
Once detached, flip the stand upside down and push it back into the housing.
There are a few things I'd like to do in the future to improve the mirror:
Integrated light sensor
This will reduce the faint glow that's visible in very dark rooms; if this were purely an LED display, this would be less of an issue due to reduced backlighting. The attached photo shows that glow effect.
I'd like to use Google's AIY Vision kit to recognize whether it's me, my girlfriend, or my dog and change the mirror dashboard accordingly -- this way she can see the news and calendars she cares about.
The Voice Kit board already supports stereo speakers; I just need to add a second speaker to get that sweet stereo sound.
I'm definitely going to install RetroPie on this thing for mad instant retro gaming. The USB ports on the side and built-in bluetooth make this ideal.
This has been a super fun project because, other than breaking (and fixed) the stand, nothing went wrong. There were a few small software issues I worked through (and documented), but this was probably the highest fun-to-frustration ratio of any major guide I've created in a while.
The only thing lacking with the pi-topCEED is the viewing angle. This is not an expensive display, so at some angles the screen can appear brighter, darker, or less legible. This hasn't been an issue for me but it is noticeable.
Documenting things while you create them can sometimes suck the fun out of the project, but this is a case where everything went smoothly and the final product is stunning. It isn't easy creating things in a repeatable way so that others can do the same. :) So I hope you enjoyed this guide.
If you liked this guide, be sure to check out my other "voice assistant in crazy thing guides", like when I turned a Furby into an Amazon Echo. Also be sure to check out my original wall-mounted magic mirror guide here (Warning: woodworking ahead!)