The Bodaciously Excellent Blog of Doctorwhen

MagicMirror Open Source Smart Mirror Platform

MagicMirror Open Source Smart Mirror Platform

I recently embarked on a project to build a MagicMirror, an open source modular smart mirror platform. Below you can check out the video introductions to the mirror I made.

This is a mirror mounted in a frame and inside the frame is a Raspberry Pi displaying on an LCD screen mounted to the back of the mirror. In areas where the screen is black the mirror acts just like a mirror and where the screen is white or brightly lit colors, the mirror’s reflection is partially/mostly replaced by the display from the Raspberry Pi.

I’ve just begun this project and the videos below are my first. I plan to add a webcam to the Raspberry Pi to provide a video feed, microphone, and speakers for the mirror. I hope to be able to configure a voice assistant module so I can speak to the mirror and it will answer me – “Mirror, mirror on the wall, who’s the fairest of them all?”

The MagicMirror project has a bunch of modules that can be installed and configured to display information drawn from customized sources like the local weather, your calendar, news feeds you configure, and so on. It’s pretty cool and fun to play with.

Check out the videos below to get a better sense of the MagicMirror and what it can do. First, an introduction to my mirror with me telling you what all the modules I am using do:

Next, a visual tour of my mirror accompanied by Rodrigo y Gabriela performing their song “Tamacun”:

To build this Magic Mirror I used a Raspberry Pi 4 running Raspbian Linux, a Debian Linux based operating system. Inside the frame backing the mirror is a thin LCD screen and a 12.6V 3A DC power supply used to power the internal monitor. The Raspberry Pi has a separate power source. The Raspberry Pi 4 has mini HDMI ports so I’ve connected the Raspberry Pi to the monitor via an HDMI cable wrapped up inside the frame. It’s connected to my network via the wireless capability of the Raspberry Pi 4. The mirror can be mounted anywhere as long as there are two standard 110v outlets and it is in range of my wireless network – the only bits external to the frame are the two power cords with a switch on each.

Here is a list of the active MagicMirror modules used in the videos above and links to their installation and configuration instructions:

alertDisplays notifications from other
updatenotificationDisplay a message whenever a
new version of the MagicMirror
application is available
MMM-Remote-ControlControll all aspects of your mirror
from other network-enabled
devices and controllers — anything
that can open a URL
clockDisplays the current date and time. The information will be updated
calendarDisplays events from a public .ical
calendar. It can combine multiple
currentweatherDisplays the current weather,
including the windspeed, the
sunset or sunrise time, the
temperature and an icon to display the current conditions.
weatherforecastDisplays the weather forecast for
the coming week, including an an
icon to display the current
conditions, the minimum
temperature and the maximum
newsfeedDisplays news headlines based on
an RSS feed. Scrolling through
news headlines happens time
MMM-SystemStatsShows the processor temperature,
system load, available RAM, uptime and free disk space.
MMM-ipIPv4/IPv6 Network Address Module
MMM-SolarRetrieves state data from an
Enphase Solar System
MMM-iFrameAdds an iFrame of any web content to your MagicMirror.
MMM-Hue-LightsDisplays the status of your Philips Hue lights and light groups
MMM-NetworkScannerDetermines the status of devices on the network based on their MAC
address, IP address, or hostname.

This is my first hands-on experience with a Raspberry Pi and MagicMirror. I’m impressed with the quality of both. The Raspberry Pi 4 is pretty amazing and far exceeds my expectations for such a low-cost computing device. Both the Pi and MagicMirror are fun, instructive, useful, DIY device projects. I would, however, caution that some of the MagicMirror modules are not what one would call “production” quality. Poke around, try different modules, play with them, but in the end my advice would be to find a few that satisfy your needs/requirements/desires while pruning those that exhibit issues or do not behave as expected.

I’ve created a Gitlab repository of scripts I’ve written to help manage my Magic Mirror. The main “mirror” script can be used to select configurations, list various info about the system, … Here is the usage message for the mirror script I wrote:

Usage: mirror <command> [args]
Where <command> can be one of the following:

  • info [temp|mem|disk|usb|net|wireless|screen]
  • list <active|installed|configs>
  • select
  • restart
  • start
  • stop
  • status
  • getb
  • setb <num>

Specify a config file to use with any config file you have created in /home/pi/MagicMirror/config of the form:
A config filename argument will be resolved into a configuration filename of the form:

Usage examples:
mirror # With no arguments ‘mirror’ displays a command menu
mirror list active # lists active modules
mirror list configs # lists available configuration files
mirror restart # Restart MagicMirror
mirror fractals # Installs configuration file config-fractals.js
mirror info # Displays all MagicMirror system information
mirror info screen # Displays MagicMirror screen information
mirror status # Displays MagicMirror status
mirror getb # Displays current MagicMirror brightness level
mirror setb 150 # Sets MagicMirror brightness level to 150
mirror -u # Display this usage message

In addition to the main ‘mirror’ script, currently there are also scripts to:

  • get and set the screen brightness
  • validate a configuration file
  • check the system temperature and text me an alert using Nexmo
  • select a random pic to be used as the desktop wallpaper

Feel free to download, modify, and play with these scripts. Let me know what you think, if you have any suggestions, comments, complaints, or improvements. Enjoy!

Let me know what you think