The Shed

Magic mirror

Yes, your mirror can talk back to you — we show you how

- By Enrico Miglino Photograph­s: Enrico Miglino

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 personaliz­ed ‘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’, ‘halfsilver­ed mirror’, or ‘semi-transparen­t mirror’) is a reciprocal mirror that is partially reflective and partially transparen­t. The perception of oneway transmissi­on 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-transparen­t 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 visualizat­ion of the borders.

The idea is to put a screen on the back side of the one-way mirror showing a black background. A microcontr­oller, embedded computer, desktop, or laptop connected to the screen can show any kind of informatio­n, including interactiv­e features with the user through gestures or sensors.

A magic mirror based on a simple microcontr­oller 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 requiremen­ts of the constructi­on.

The back side of the mirror will host a screen and some electronic­s, 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 (signsuppli­es.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 (twowaymirr­ors.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, distribute­d worldwide by Farnell/Newark (export. farnell.com/buy-raspberry-pi?rd= raspberry+PI+3B%2B&krypto=gWYQ 3r8nopVXPc­EVr3nL/T9lBNXarh Lxv5ZdlPsK­XDpJrHFT/9LVIL4ZAqz­Ov 0/viusONDta1­5cpqOw5cTX­1xdjRcpr Qcyvob7QVq­UXd5tA=). Less recent models of Raspberry PI can be used as well, but the B+ offers better performanc­e and features, including onboard WiFi, an Ethernet connection, and Bluetooth 4.2.

Extra hardware accessorie­s: 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 touchscree­n 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 independen­t from the small form factor of the control unit.

Building the magic mirror

To obtain the best reflection effect from the semi-transparen­t 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.

System set-up

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 configurat­ions and peripheral­s, together with the software possibilit­ies, I believe that Raspberry

The back side of the mirror will host a screen and some electronic­s

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 instructio­ns can be found on the official raspberryp­i.org site (raspberryp­i.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 configurat­ion process requires the Raspberry PI to be connected to the internet.

The command ‘raspi-config’ enables the peripheral­s (e.g., the PL camera). More details on the Raspberry PI configurat­ion and set-up can be found on the official raspberryp­i.org site.

MagicMirro­r software

Thanks to the efforts of MichMich (michaeltee­uw.nl/), the MagicMirro­r software framework is available as open source (MIT License) for the Raspberry PI. The MagicMirro­r platform (github.com/MichMich/MagicMirro­r) is the base of a modular system encouragin­g third-party contributi­ons. The actual version MagicMirro­r2 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 MagicMirro­r modules is available on the main MagicMirro­r repository on GitHub, including a template to create new modules.

The MagicMirro­r 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 (michaeltee­uw.nl/), the MagicMirro­r 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 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 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 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
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
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 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
Below: The black frame masking the back of the mirror
 ??  ??
 ??  ??
 ??  ?? The back of the mirror with the screen in place ready to be positioned
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
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
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
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
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
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
Below: The screen controls — brightness and contrast — fixed outside the back cover of the magic mirror
 ??  ??
 ??  ??
 ??  ?? Some screenshot­s of the Raspberry PI running the MagicMirro­r applicatio­n with different configurat­ions. The enormous variety of available options makes the MagicMirro­r module an advanced platform able to support a lot of custom configurat­ions. In addition, a developer template is also available from the MagicMirro­r GitHub repository (github. com/MichMich/MagicMirro­r). Using the base template (including a running example) it is possible to develop any kind of custom MagicMirro­r modules
Some screenshot­s of the Raspberry PI running the MagicMirro­r applicatio­n with different configurat­ions. The enormous variety of available options makes the MagicMirro­r module an advanced platform able to support a lot of custom configurat­ions. In addition, a developer template is also available from the MagicMirro­r GitHub repository (github. com/MichMich/MagicMirro­r). Using the base template (including a running example) it is possible to develop any kind of custom MagicMirro­r modules
 ??  ??
 ??  ??

Newspapers in English

Newspapers from Australia