Create a Cheap DIY Smart Mirror in 15 Minutes With A Raspberry Pi Zero!

In leui of this article - here's a picture of the Smart Mirror using the "Magic Mirror" library on the Raspberry Pi Zero W.

I wanted to share a really cool setup that was pretty easy for all of those Smart mirror enthusiasts out there. If you haven’t seen my article on creating a smart mirror with voice-control- you can see that link down at the bottom. In this article- I’m going to briefly share how I created a similar build with a Raspberry Pi Zero W. Why is this important? You can save an extra 20% on cost by building it with a Raspberry Pi Zero.

I went looking online and found a guide that showed how to manual build it, and also at the end of the article- had an image that had the magic mirror pre-loaded on it. All I had to do was update the wifi configuration and update the magic mirror and was ready to go!

What You Defintely Need:

Optionals: If you’re building a Smart Mirror

*Don’t forget you need a kit or you can buy the cables seperate, but the kit is the best way to go- however, I do not recommend some of the SD cards that come in those kits, which is why I have it seperate. You can also buy a monitor if you intend to turn this into a Smart Mirror and get all the other goods- but I would just start with the Raspbery Pi Zero W and the SD Card, because it’s very easy to get going and you can customize the aesthetics later. See my other article here- if you want to see my full build of my original smart mirror: Click here

Where Did this Inspiration Come From?
There’s a great article out there of the manual build – it goes out to Emmanual Contreras and in it- he has both the manual steps to get it to work on a Raspberry Pi Zero W, and also a pre-loaded image with Raspian Stretch Lite, Chromium, Electron etc- so once you flash the image on a good SD card (make sure it’s a descent card)- you can simply boot up the Raspberry Pi Zero and do a couple more steps and within 15 minutes, you’re ready to go!

Creating Smart Mirror with Raspberry Pi Zero W (Credit to Emmanual Contreras):http://emmanuelcontreras.com/how-to/how-to-create-a-magic-mirror-2-with-pi-zero-w/

Upon further reading of his great article and build – there’s an image file with raspbian stretch lite- with magic mirror configured on it already! All that is needed – is to update the wifi configuration file, expand the filesystem, and updating the magic mirror library. I will show you the exact steps that I took when I was able to accomplish it in less than 15 minutes time! No kidding!

Link to the Pre-Loaded Image: Click here

Note: This link was from Emmanuel’s article above- make sure to check it out, great read and very thorough. He also has some other great articles and if you really want to give back to the individual that made this build possible- there’s a donate link at the bottom of his blog.

Step 1: Download the Image and Flash onto SD Card:
Basically you need to use a flash tool for loading this image (link above to original article I used and the image file) onto an SD Card. You can use Etcher, Win32DiskImager- if using Linux or Windows. More information depending on your OS system of choice here: https://www.raspberrypi.org/documentation/installation/installing-images/

Step 2: Plug everything in and start the Pi Zero!
I timed it, and it takes approximately 2 minutes for the Magic Mirror to load- just be patient. One thing however, you may notice- is that you can’t get the mirror to stop. Simply use ctrl+w or ctrl+alt+f1 and once you are back in the console I want you to do two things. Go into your home directory and rename the mmstart.sh and chromium_start.sh to different names and remove those files.

Example or just run these commands from the console:

cd ~/

sudo cp chromium_start.sh chromium_start1.sh

sudo rm chromium_start.sh

sudo cp mmstart.sh mmstart1.sh

sudo rm mmstart.sh

These steps above will make you enter into your home directory- and we are going to rename two scripts and then remove the original script. We are just copying them, and removing them temporarily. Then we will come back and rename them back to the original script names i.e. mmstart.sh and chromium_start.sh. This will save you time and remove the friction of having to exit out of the magic mirror while it autostarts and sleeps in a loop.

Step 3 – Update Wifi Configuration file:
This is fairly simple- make sure to exit out of the magic mirror if it loads up with ctrl+alt+f1 or ctrl+w so you can configure your wifi. This is important because updating everything will be reliant on this step. You just have to go into the wifi configuration directory once you’ve booted up into the console.

When you boot the Raspberry Pi Zero W up, it will bring you directly to the console because it is Raspian Stretch Lite and there is no ‘graphical’ OS- as it would be far too slow for the time being with the graphical version.

You may see the Smart Mirror boot right on up after a few minutes and it might get in your way. If that’s the case- you want to hit ctrl+alt+f1 or ctrl+w, ctrl+c all seemed to work in stopping the smart mirror from loading so I could do some pre-configuring.

So, when you boot up- you’ll see something like this:

Screenshot of console when booting up Raspberry Pi Zero W with the image loaded in link above.

Now once you are at the console – you want to enter into the directory of the wifi configuration by simply running this line of code:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Like so:

Then once you are in the config file- you need to manually enter in your SSID and your password for your wifi to your router- so it can connect, like so:

Then, once you’ve updated those two values- simply hit ctrl+x and hit ‘y’ to say yes- that you want to update this file, and it will exit the file and bring you back to the console for our last step here.

Step 4: Update Raspberry Pi and Magic Mirror
There are a few things you want to do in the console now – so run this line of code to update Raspian:

sudo apt-get update

Then after you’ve updated – you want to update the Magic Mirror library- because it will likely show updates are available once it is loaded. Now you’re going to want to get into that directory and update the Magic Mirro running these two lines of code:

cd /MagicMirror

git pull && npm install

If you have problems with the update and get any errors with the package-lock.json, then go ahead and run this line of code first (before git pull and npm install):

git reset --hard; git clean -df;

Then go ahead and run the line again: git pull && npm install

Step 5 – Rename your scripts back to their original names (by copying them and removing them)
cd ~/
sudo cp chromium_start1.sh chromium_start.sh

sudo rm chromium_start1.sh
sudo cp mmstart1.sh mmstart.sh
sudo rm mmstart1.sh

Then reboot! Run the command “sudo reboot”

If you did this all correctly- it should have updated your magic mirror and also your Raspberry Pi, and if you had any problems- you should go back to the wifi configuration and make sure it is setup correctly, else that would be the only reason I’d assume you couldn’t update either OS or Magic Mirror. Make sure you’ve updated your wifi config file.

I went ahead and took my config file from my previous build in my original article- and brought it over to the Raspberry Pi Zero W! Now I have local news, weather, my google calendar sync, among other cool feeds that are important to me!

This is the same setup on my Raspberry Pi 3 Smart Mirror. It takes about 2 and a half minutes to boot up, which is nearly double or triple the boot time on the Raspberry Pi 3, but I hardly noticed since I keep my Smart Mirror on always.

Summary: So, we basically just downloaded an image, updated some config file and updated the magic mirror and OS! That’s literally it! Big thanks to Emmanual for his hard work on manually putting it all together- make sure to check out his blog if you get a chance! I hope you all enjoyed this- as it only took about 15 mins from start-to-finish to get this up and going on my Raspberry Pi Zero W!

In Case You Didn’t See My Original Build With The Raspberry Pi 3 B+:

" The SmartHome Ninja : Owner, creator, imagineer, smart home enthusiast, tester, practical applicator extraordinaire.."

Comments are closed.

This website uses cookies.