leviathan
Snores like a puppy
Since this topic has sparked some interest in my Tesla PYC thread, I thought I'd make a writeup on it in here. This should cover the bases for most everything involved - what Smart Mirrors are, how they work, and what do you need to get and do to make one of your own. Let's get started.
WTF is a Smart Mirror?
It's a mirror that can display not just your face, but also various other stuff around and on top of it. Starting from something very basic that just shows the time and maybe outside weather:
And all the way up a fully customized display with calendar entries, weather forecast, public transport information, fuel prices, stocks/crypro prices, travel times to upcoming events, local news, random jokes from the Internet... the list goes on:
As the more tech-inclined among the readers may have guessed, that's because it's not just a mirror but more of a computer screen that also doubles as a mirror. The computer behind it is connected to the Internet, and runs custom software to show all the stuff you want.
How does it work?
Instead of an actual, not-at-all-seethrough mirror a smart mirror uses one of the following:
How do I get one?
I believe there are some offered commercially. Probably for a lot of money. However, the reason we're all here is making one yourself - which also opens up all the possibilities.
The good news is: it's not rocket science. The hardware build isn't very complicated, and the software is all open-source and basically ready to run off the shelf with minimal configuration. You can of course make it as complex as you need/want - but the basics I'll be covering here are fairly simple.
Ok, what hardware do I need for a DIY mirror?
Now you're asking the right questions. The basic list goes something like this:
How do I get the software to run it?
The go-to software package for a Raspberry Pi-based smart mirror is MagicMirror². It's open source, free to use, looks decent, and comes with over a hundred community-contributed modules for diplaying all kinds of stuff you might find useful or entertaining.
The steps to getting it on your Raspberry Pi are:
1) Install the operating system - Raspbian Desktop
If you know how to do this and have used a Raspberry in some manner before: get Raspbian Desktop on the card, make sure you can talk to it via SSH, then skip all the way to MagicMirror installation.
If you don't, follow these steps:
2) Install MagicMirror
2.1 Establish a remote connection to the Raspberry Pi
You can do this on the Pi itself via keyboard/mouse. However, I recommend connecting to it remotely at this point, since you'll want to do it later anyway to change settings or modules on your mirror while it's already installed where you want it and running. To do this:
If you're on Windows:
2.2 Actually install MagicMirror
Follow the "Manual installation" instructions at https://docs.magicmirror.builders/getting-started/installation.html.
Congrats, you now have an actual MagicMirror software running on your Raspberry Pi. If you've already installed the monitor and the Pi in your mirror, I guess you now have a fully functional Magic Mirror.
Continue with the "Configuration" instructions at https://docs.magicmirror.builders/getting-started/configuration.html#raspberry-specific to optimize some aspects of you Raspi for use as a MagicMirror, and to set up some basic configuration like the overall zoom factor, time format etc.
Read up some basics on using a Linux command line if you need to: https://electronicshobbyists.com/most-basic-and-commonly-used-raspberry-pi-commands/
3) Customize the crap out of it
The beauty of MagicMirror² is that you can and indeed should fine-tune it to your own delight.
Dig into the default module docs to figure out how to configure them for yourself: https://docs.magicmirror.builders/modules/introduction.html
And of course check out https://github.com/MichMich/MagicMirror/wiki/3rd-party-modules for a (probably incomplete) list of stuff that you can add to the mirror.
To make adding/changing/reconfiguring modules easier, I can recommend using WinSCP to connect to the Raspi via SFTP - then you can edit files (including config files) using your editor of choice on your computer, instead of through nano or vim on the command line.
How does that motion sensor you mentioned work?
Get the module for it here: https://github.com/paviro/MMM-PIR-Sensor. Install it as described in the Readme. For configuration, this is what mine looks like:
Save the configuration, and turn off your mirror (run "shutdown -h now" in the terminal and wait for the screen to turn off, the unplug power). Plug in the HC-SR501 PIR sensor into the Raspi GPIO pins like so:
Turn the mirror back on. After you move in front of the sensor once and then don't move for 90 seconds, the screen should turn off. It should turn back on again if you move, with a slight delay.
That's it.
For now anyway. Discuss And post results if you end up deciding to make one of these yourself.
WTF is a Smart Mirror?
It's a mirror that can display not just your face, but also various other stuff around and on top of it. Starting from something very basic that just shows the time and maybe outside weather:
And all the way up a fully customized display with calendar entries, weather forecast, public transport information, fuel prices, stocks/crypro prices, travel times to upcoming events, local news, random jokes from the Internet... the list goes on:
As the more tech-inclined among the readers may have guessed, that's because it's not just a mirror but more of a computer screen that also doubles as a mirror. The computer behind it is connected to the Internet, and runs custom software to show all the stuff you want.
How does it work?
Instead of an actual, not-at-all-seethrough mirror a smart mirror uses one of the following:
- A proper, expensive one-way mirror, aka. "spy mirror". It's a special kind of mirror glass that reflects light coming from one side, but lets light from the other side through. The sort you find in interrogation rooms in various TV series, where the investigators will hide behind and observe the interrogation while staying unseen themselves.
- A cheaper option that does the same thing, just not quite as nicely: a piece of acrylic glass covered with a one-way mirror film. This kind of film can be bought online, and is typically offered as a heat-reflecting and darkening layer for large glass facades or windows, that mirrors the glass from the outside but still allows you to look out. These usually don't allow for quite as good an image on the smart mirror as proper spyglass, and can be a pain the arse to apply without bubbles (think: huge screen protector), but are much cheaper and easier to get in the right size (just cut down to what you need).
How do I get one?
I believe there are some offered commercially. Probably for a lot of money. However, the reason we're all here is making one yourself - which also opens up all the possibilities.
The good news is: it's not rocket science. The hardware build isn't very complicated, and the software is all open-source and basically ready to run off the shelf with minimal configuration. You can of course make it as complex as you need/want - but the basics I'll be covering here are fairly simple.
Ok, what hardware do I need for a DIY mirror?
Now you're asking the right questions. The basic list goes something like this:
- A piece of mirror glass in the size you want. Either of above mentioned options will do. For a first build I'd probably go with the acrylic+film option - the "proper" one-way mirrors can be really expensive.
- A monitor to put behind that mirror glass. Here you again have two options:
- Make the monitor behind the mirror full-size, allowing you to show stuff on the whole mirror surface.
- Or put a small-ish monitor in one part of the mirror only, blacking out the rest. This way you can make a larger mirror (e.g. a vertical full-body-height one), but don't need to put a whole TV screen behind it.
- A frame of some kind to hold the two together. It can be a picture frame from IKEA, something custom-made, or (as in the case of my mirror above) simply some tape or other method of mounting that's not an actual frame.
- A wall mount to attach it to a wall. Or a stand to put it wherever.
- A computer to run the thing. The typical choice is a Raspberry Pi. The 3B or 4 will do nicely, with built-in WiFi to get the online data it's the simplest option on the table. Don't forget a microSD card to install and run the software from, a power brick, and a fitting monitor cable (typically microHDMI to HDMI).
- A PIR sensor. It's a cheap and simple motion detector, that will allow to turn the screen off while no-one is there and turn it back one when someone walks in front of it, instead of running the screen all the damn time and wasting electricity. The go-to choice is a HC-SR501, they go for a couple $ on eBay, and can be plugged straight into the GPIO pins of the Raspberry Pi.
- https://www.howtogeek.com/414647/how-to-build-a-smart-mirror/
- https://www.instructables.com/id/How-to-Build-a-Raspberry-Pi-Smart-Mirror/#step6
- https://www.hackster.io/ben-eagan/smart-mirror-with-optional-alexa-874d43
How do I get the software to run it?
The go-to software package for a Raspberry Pi-based smart mirror is MagicMirror². It's open source, free to use, looks decent, and comes with over a hundred community-contributed modules for diplaying all kinds of stuff you might find useful or entertaining.
The steps to getting it on your Raspberry Pi are:
1) Install the operating system - Raspbian Desktop
If you know how to do this and have used a Raspberry in some manner before: get Raspbian Desktop on the card, make sure you can talk to it via SSH, then skip all the way to MagicMirror installation.
If you don't, follow these steps:
- Download the latest Raspbian Desktop image (without the "recommended software") for your Raspberry Pi: https://www.raspberrypi.org/downloads/raspbian/
- Download balenaEtcher (the software for writing the image to the SD card) on your PC/Mac: https://www.balena.io/etcher/
- Insert the microSD card into the computer. Run balenaEtcher, flash the Raspbian image to the card, then eject it and insert it into the Raspberry Pi.
- Connect your Raspberry Pi up to a monitor, and plug in a keyboard and a mouse. You'll only need the latter for the initial configuration, later the mirror will work without them ofc.
- Connect power to the Raspberry Pi and let it boot up. Follow the configuration prompts to setup your WiFi, language/locale and other initial config stuff.
- Open up the "Raspberry Pi Configuration" in the menu and change the following things:
- Set the hostname to "raspi-magicmirror" or something similar
- Enable SSH under "Interfaces"
- Reboot the Raspi, make sure it shows a good WiFi connection after it's booted up. Congrats, you have a working Raspberry Pi to run a mirror on. Proceed with next step.
2) Install MagicMirror
2.1 Establish a remote connection to the Raspberry Pi
You can do this on the Pi itself via keyboard/mouse. However, I recommend connecting to it remotely at this point, since you'll want to do it later anyway to change settings or modules on your mirror while it's already installed where you want it and running. To do this:
If you're on Windows:
- Download PuTTY: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html. Choose the "Windows Installer"
- Install and run it.
- As "Host name", enter: raspi-magicmirror.local (replace "raspi-magicmirror" with whatever hostname you've given your Raspi in the configuration step before, keep the ".local")
- Hit "Open"
- Enter "pi" as the username and whatever password you set in the configuration (the default is "raspberry"... you should really change it)
- On a successful connection, it'll print some information about your Raspberry.
- Open up a Terminal.
- Type "ssh pi@raspi-magicmirror.local" (replace "raspi-magicmirror" with whatever hostname you've given your Raspi in the configuration step before, keep the ".local")
- Enter whatever password you set in the configuration (the default is "raspberry"... you should really change it)
- On a successful connection, it'll print some information about your Raspberry.
2.2 Actually install MagicMirror
Follow the "Manual installation" instructions at https://docs.magicmirror.builders/getting-started/installation.html.
Congrats, you now have an actual MagicMirror software running on your Raspberry Pi. If you've already installed the monitor and the Pi in your mirror, I guess you now have a fully functional Magic Mirror.
Continue with the "Configuration" instructions at https://docs.magicmirror.builders/getting-started/configuration.html#raspberry-specific to optimize some aspects of you Raspi for use as a MagicMirror, and to set up some basic configuration like the overall zoom factor, time format etc.
Read up some basics on using a Linux command line if you need to: https://electronicshobbyists.com/most-basic-and-commonly-used-raspberry-pi-commands/
3) Customize the crap out of it
The beauty of MagicMirror² is that you can and indeed should fine-tune it to your own delight.
Dig into the default module docs to figure out how to configure them for yourself: https://docs.magicmirror.builders/modules/introduction.html
And of course check out https://github.com/MichMich/MagicMirror/wiki/3rd-party-modules for a (probably incomplete) list of stuff that you can add to the mirror.
To make adding/changing/reconfiguring modules easier, I can recommend using WinSCP to connect to the Raspi via SFTP - then you can edit files (including config files) using your editor of choice on your computer, instead of through nano or vim on the command line.
How does that motion sensor you mentioned work?
Get the module for it here: https://github.com/paviro/MMM-PIR-Sensor. Install it as described in the Readme. For configuration, this is what mine looks like:
Code:
{
module: 'MMM-PIR-Sensor',
config: {
sensorGpio: 17, // you can choose any other GPIO pin, check the pinout below
powerSaving: true,
turnOffAfterSeconds: 90
}
},
Save the configuration, and turn off your mirror (run "shutdown -h now" in the terminal and wait for the screen to turn off, the unplug power). Plug in the HC-SR501 PIR sensor into the Raspi GPIO pins like so:
Turn the mirror back on. After you move in front of the sensor once and then don't move for 90 seconds, the screen should turn off. It should turn back on again if you move, with a slight delay.
That's it.
For now anyway. Discuss And post results if you end up deciding to make one of these yourself.
Last edited: