Yes, your mirror can talk back to you — we show you how
Through the centuries, mirrors have fascinated humans, playing an important role in many ancient myths. From Narcissus to Snow White, mirrors in the history of humanity have frequently had a primary role. In this issue, we will see how to create a personalized ‘magic mirror’, with the help of the 21st-century technology.
How magic mirrors work
A ‘one-way mirror’, also called a ‘twoway mirror’ (or ‘two-way glass’, ‘halfsilvered mirror’, or ‘semi-transparent mirror’) is a reciprocal mirror that is partially reflective and partially transparent. The perception of oneway transmission is achieved when one side of the mirror is brightly lit and the other side is dark. This allows
viewing from the darkened side, but not vice versa (en.wikipedia.org/wiki/Oneway_mirror).
Magic mirrors use semi-transparent mirror plates that make it possible to see something lying on the back of the reflecting side, together with the reflection of the front scene. The ‘magic’ effect is achieved by showing text, graphics, light effects on a screen, videos, etc. The best effect is achieved when the entire back side and screen are black, thus avoiding visualization of the borders.
The idea is to put a screen on the back side of the one-way mirror showing a black background. A microcontroller, embedded computer, desktop, or laptop connected to the screen can show any kind of information, including interactive features with the user through gestures or sensors.
A magic mirror based on a simple microcontroller like Arduino provides fewer features than a computer-based one, but the light-only effects are very suggestive.
Materials and hardware
The frame: To make the prototype shown in this article, I built a wooden custom frame. You can make your own frame, or use an old mirror or painting frame, taking into account some necessary requirements of the construction.
The back side of the mirror will host a screen and some electronics, so it is preferable to use a box frame to include all the components in the backside, then close the back with a cover to keep everything neat, tidy, and hidden away.
The ‘magic’ effect is achieved by showing text, graphics, light effects on a screen, videos, etc.
Two-way mirror: The size of the mirror depends on your screen size (I used an old 15-inch HDMI) and the size of the mirror plate. Due to the growing interest in building magic mirrors, these products are very easy to buy online.
Two-way mirrors can be found in New Zealand from Sign Supplies (signsupplies.co.nz/), DHGate.com (nz. dhgate.com/one-way-mirror-windowfilm-new-zealand.html), and Elite Window Films (elitefilms.co.nz/Film+ Types/Privacy.html); in Australia from GlassKote (glasskote.com/); and from the US, shipping worldwide, from Two Way Mirrors (twowaymirrors.com/), where I bought the one shown in this article prototype.
Magic mirrors are acrylic plates 1–2mm thick, with a special reflecting surface treatment that is not difficult to cut to the desired size.
Hardware: The core of the magic mirror is a Raspberry PI 3B+, the
most recent model, distributed worldwide by Farnell/Newark (export. farnell.com/buy-raspberry-pi?rd= raspberry+PI+3B%2B&krypto=gWYQ 3r8nopVXPcEVr3nL/T9lBNXarh Lxv5ZdlPsKXDpJrHFT/9LVIL4ZAqzOv 0/viusONDta15cpqOw5cTX1xdjRcpr Qcyvob7QVqUXd5tA=). Less recent models of Raspberry PI can be used as well, but the B+ offers better performance and features, including onboard WiFi, an Ethernet connection, and Bluetooth 4.2.
Extra hardware accessories: To build my prototype, I also included a passive infrared sensor (PIR) motion sensor, a couple of audio speakers with a USB-powered audio amplifier, and a PL camera.
The PIR sensor is used to activate the magic mirror effects when a moving subject is near the device.
To build small-sized magic mirrors, the Raspberry Pl seven-inch touchscreen can fit perfectly; for larger mirrors, an HDMI screen can be connected to the Raspberry PI HDMI output. When using an external HDMI screen, a second power supply should be provided for the screen, together with the PI power supply. If you use an external screen, it offers the advantage that the size of the magic mirror is independent from the small form factor of the control unit.
Building the magic mirror
To obtain the best reflection effect from the semi-transparent mirror plate, its back should be black. The only visible elements from the back side should be the graphic elements shown on the screen.
Around the HDMI display, I created a mask to cover the entire surface
The core of the magic mirror is a Raspberry PI 3B+
of the mirror using a sheet of light, black cardboard (250g/mq). A second cardboard layer (3mm thick) keeps the HDMI screen centred on the back of the mirror frame.
I used an old HDMI 15-inch screen. Keeping the screen centred, I left space on the top side to install the Raspberry PI and the two power supplies on the bottom. The mask and the mirror plate have been pressed against the border of the frame with four 3D-printed L-shaped supports, and four supports at every corner. The back of the assembled mirror has been covered with a 3mm thick plywood sheet.
When hanging the boxed mirror, you should allow at least a 1cm gap from the wall to avoid excessive heating.
My research on the internet revealed plenty of magic-mirror projects using different platforms, as well as several software solutions. Thanks to its wide range of hardware configurations and peripherals, together with the software possibilities, I believe that Raspberry
The back side of the mirror will host a screen and some electronics
PI is one of the better solutions for building this kind of device.
Installing the Linux operating system
First of all, install the operating system on the Raspberry PI. Currently the latest updated version is Raspbian Stretch. Download and set-up instructions can be found on the official raspberrypi.org site (raspberrypi.org/downloads/ raspbian/). Be sure to download the desktop image of the operating system. I strongly recommend installing the operating system image on a microSD card of at least 8GB, or ideally 16GB.
Preparing the system
Two options are available to easily install and configure the Raspberry Pl. The first one is connecting a mouse, keyboard, and HDMI monitor to the Pl. The second one is accessing the Raspberry PI remotely from a PC using Virtual Network Computing (VNC). More details on VNC can be found on the official VNC site (realvnc.com/en/).
The Raspberry PI Stretch operating system includes a VNC server that
can be activated, while a VNC client is available for any platform (Windows, Mac, Linux, Raspberry PI) free to download. The set-up and configuration process requires the Raspberry PI to be connected to the internet.
The command ‘raspi-config’ enables the peripherals (e.g., the PL camera). More details on the Raspberry PI configuration and set-up can be found on the official raspberrypi.org site.
Thanks to the efforts of MichMich (michaelteeuw.nl/), the MagicMirror software framework is available as open source (MIT License) for the Raspberry PI. The MagicMirror platform (github.com/MichMich/MagicMirror) is the base of a modular system encouraging third-party contributions. The actual version MagicMirror2 is very well documented, stable, and easy to install. It has become very popular over the past couple of years, attracting many open-source developers who have created a large number of custom modules, which are easy to install on the standard platform.
The updated full list of MagicMirror modules is available on the main MagicMirror repository on GitHub, including a template to create new modules.
The MagicMirror platform is an ecosystem with hundreds of options. Before installing the platform, you will need to update — or install if not already present — Python and the npm repository manager.
Thanks to the efforts of MichMich (michaelteeuw.nl/), the MagicMirror software framework is available as open source (MIT License) for the Raspberry PI
The rear of the magic mirror wooden box frame. The first layer is the oneway mirror ready for assembly
The Raspberry PI and the 3D-printed fixing components
The HDMI display before attachment to the magic mirror. The case of the display has been completely removed and the control board has been fixed on the back of the screen
The Raspberry PI is fixed to the back of the magic mirror frame (top) using a 3D-printed VESA support, usually used to fix the PI to the back of a monitor
Raspberry PI 3B+ Below: The black frame and the cardboard support frames. The two frames will be used to keep the mirror background totally black and the screen in position
Below: The screen fixed in the support mask. In this prototype, I decided to fix the screen in the middle of the mirror
Below: The black frame masking the back of the mirror
The back of the mirror with the screen in place ready to be positioned
Below: Detail of the 3D-printed L-shaped supports to keep the mirror background — masks and screen — pressed firmly to the back of the two-way mirror
Above: The VESA mount and the Raspberry PI in place
Left: The back view of the magic mirror assembled. All the components are fixed inside the wooden box frame
Below: The completed magic mirror reflecting the handsome writer shooting
Left: Detail of the back cover of the magic mirror with the holes for aeration of the Raspberry PI
Below: The screen controls — brightness and contrast — fixed outside the back cover of the magic mirror
Some screenshots of the Raspberry PI running the MagicMirror application with different configurations. The enormous variety of available options makes the MagicMirror module an advanced platform able to support a lot of custom configurations. In addition, a developer template is also available from the MagicMirror GitHub repository (github. com/MichMich/MagicMirror). Using the base template (including a running example) it is possible to develop any kind of custom MagicMirror modules