X

DIY: Want to Create Your Own Voice-Controlled Smart Mirror? Here’s a video and list to do it!

See the guide and list of things you need broken down below.  This was voted as one of the BEST Raspberry Pi Projects by MagPi.  Also, credit goes out to the original developer and genius behind the Magic Mirror by a developer named Michael Teeuw aka MichMich on Github! Make sure to Like & Share my Video!

Build your own Smart Mirror-

Disclaimer – the video is only showing how to get magic mirror installed on your raspberry pi via raspian OS from scratch (along with google assistant in the second half of the video). You need to get a raspberry pi with all the necessary accessories (shown in video) and have an sd card with raspian ready to go. The insructions below will help tremendously, and you want to follow with care.  You’ll see why in the video.

Here’s a picture of the back – my finished Smart Mirror:

Step 1: Purchase and/or Inventory Items Needed –

Important Note on Frame: You also need the frame, and I basically just went to home depot or lowes, and picked out some cheap 1″ x 4″ wood, and literally built it all with about 4-5 boards that were about 3-4 feet long.

Note on the Paint: You’ll also need some sanding paper to get the undercoat and primer paint to stick, and I bought polyeurethane to coat over it with some thick layers of clear coat-so it will last a while.  If you plan on having this for a while make sure to know the difference between polyeurathane and polyacrylic, because a few extra bucks- can make or break the longetivity of the clear coat and it will start to tint into a yellowish color (Polyacrylic clear coat can do that over time).  Just a pro-tip.  Talk to the paint specialist, trust me!

Step 2: Prepare the Raspberry Pi – It’s best to first get everything setup, and make sure everything will work bare, then you want to start working on your mirror and the frame around your monitor.  The video pretty much shows in essence how to do all of that.  Make sure you have the essentials (they are below in this article).  You are going to need a Raspberry Pi board, Case, Power Supply (get the right one), an SD card (either pre-installed OS or blank – more on that below), and some way to add sound with either the 3.5mm cable running from your board to your monitor, although I suggest getting the Adafruit external speakers that run of wall power and provide ample sound.  Lastly, you need a USB microphone- again most of this is below but to make this easier, see the list above again in Step 1.

  • Prepare the SD Card – there’s pretty much a few ways to do this.  If you buy a kit, you can basically get a pre-installed operating system on it via Noobs platform.  It’s a lot more tricky to download software called Etcher, or Win32DiskImager (if using windows, but etcher also works for windows and linux).  If you do not get the pre-installed SD card in a kit, it’s going to take about an extra 30 min to 1 hour at least, depending on your internet connection because the operating system Raspian is a few gigabytes of memory.  Keep that in mind, because that could add a lot of time onto the setup.

  • Connect to your wifi network – Once you’ve prepared your Raspberry Pi, and installed and loaded the operating system Raspian with either the SD card with Noobs or flashed the SD card with a fresh image of Noobs or Raspian, then you’re going to want to turn on the Pi and connect to your Wifi Network.  You’ll see the wifi symbol up in the top right of the screen.  Go ahead and select your wifi network and put in the password to connect to it.  Next, you want to get your internal ip address for your Pi so you can then setup a static ip address and also ssh and configure/control it from your PC.

Get your IP Address: You want to then identify your IP address for your Raspberry Pi using the ‘ifconfig’ command when you open up the terminal.  The terminal can be accessed by hitting ctrl+shift+T or it looks like a little black box/command window icon up in the top right.  That’s where you want to use the ifconfig command to check your ip address.

Static IP Address on Router (Optional): I suggest you then take that ip address and go into your router settings and assign that ip address to the mac address for your raspberry pi.  Check out your router’s manual or handbook for setting up a static ip address.  Since you probably have a dhcp setup- your router might give it another ip address later on and this just makes it WAY easier to use VNC or SSH later on.  You can also set it up for remotely logging into your Pi, but that would require opening ports and you’d have to google online on setting up a static ip address or accessing PI via ssh with a Google Search for more information on that, but it can risk vulnerability issues- so I’d just setup a static IP address for now.

Step 3: Open the terminal on the Rasberry Pi or SSH using Bash/Ubuntu on Windows or Mac & Set Everything Up:

Automatic Installation (Source: https://github.com/MichMich/MagicMirror/ )
Electron, the app wrapper around MagicMirror², only supports the Raspberry Pi 2/3. The Raspberry Pi 0/1 is currently not supported. If you want to run this on a Raspberry Pi 1, use the server only feature and setup a fullscreen browser yourself. (Yes, people have managed to run MM² also on a Pi0, so if you insist, search in the forums.)

Execute the following command on your Raspberry Pi to install MagicMirror²:
bash -c "$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installers/raspberry.sh)"

Manual Installation if Problems with Automatic Installation (Source: https://www.magicmirrorcentral.com/complete-raspberry-pi-magic-mirror-tutorial/)

Copy this command and install it into your shell:

bash -c "$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installers/raspberry.sh)"

Next, you need to install electron – this is IF there is troubles installing dependencies:

sudo npm install -g electron@1.7.6

Now we need to go into the Magic Mirror directory and start up the magic mirror!  So close to done! 

cd ~/MagicMirror

Then you want to run this command to output display and run the Magic Mirror via npm.

DISPLAY=:0 npm start

Simple enough!  Now, since the Magic Mirror app is working, we need to configure for auto-starting it at boot, type this command:

pm2 startup

Now we are going to go into a directory and create a new script/text file to start at boot with this command:
cd ~
nano mm.sh

We need to add this text into the file once we have used nano to create a new script.  Add this in the mm.sh file:

cd ~/MagicMirror
DISPLAY=:0 npm start

Now we want to hit ctrl+x to exit out of the text file and save it & then we need to run this line of code to make it executable:

chmod +x mm.sh

Lastly, we need to enable it to run the script at boot and also to save it:

pm2 start mm.sh

pm2 save

Now, let’s go ahead and reboot the Pi via this command:

sudo reboot

After we are done rebooting, then Open the Terminal again – to edit our config.txt file:

sudo nano /boot/config.txt

We need to add this line down at the bottom to flip from landscape to portrait:

display_rotate=1

Then hit ctrl+x to save it and close the file, then in the terminal enter this line of code:


sudo nano ~/.config/lxsession/LXDE/autostart

In this file- we are going to add these lines of code into that file:

@xset s noblank
@xset s off
@xset -dpms

Go ahead and ctrl+x to save and exit that file and then go ahead and reboot again using ‘Sudo Reboot’.  Next after reboot, if you’re getting any warnings or weird errors on boot- go back into the config.txt file like so and enter avoid warnings line of code:

sudo nano /boot/config.txt

Then enter this line of code and ctrl+x to save it one last time:

avoid_warnings=1

Then reboot one last time:

sudo reboot

Now that we’ve done our last reboot, just a couple more tweaks and we are good to go:

sudo apt-get update
sudo apt-get install unclutter

If all goes well, you should see something like this when you’ve finished this (even automatically at reboot):

Image Source: www.bujarra.com

That’s it!  Keep in mind, if you ever need to update the mirror later on, you’ll get a warning/alert at the top, and to update it in the future, just do this:

git pull && npm install

This guide here was based off of the wonderful guide put together here: https://www.magicmirrorcentral.com/complete-raspberry-pi-magic-mirror-tutorial/

Also, if you’re having any weird issues with updating the magic mirror and getting an issue with the package-lock.json file… Very annoying, I know. What you need to do is go into the MagicMirror directory you created. The directory is likely /home/pi/MagicMirror – then instead of doing git pull && npm install, you want to run this command:

git reset --hard; git clean -df;

Then run this: git pull && npm install

Step 4: Setting Up Google Assistant for Smart Home & Voice Control: (This will add another 30-60 Mins & You need the USB Microphone / Speakers)

Setting Up Google Assistant on the Pi:
https://pimylifeup.com/raspberry-pi-google-assistant/

Google Developer Instructions for Assistant On Pi:
https://developers.google.com/assistant/sdk/guides/library/python/embed/setup

*I’ll likely add some more content on this later – but in the video above, I’ve went over it.  Things will help like installing pulseaudio to toggle the sound from hdmi to aux 3.5mm because the biggest hurdle was just getting that setup right.  However, Google touches on it well in the links above.

Gotchyas & Nice-To-Knows:

    1. In regards to Google Voice Assistant: Keep in mind that this will add a significant amount of time to setting this up- probably more time than setting up the mirror thus far.  If you are committed to trying-it-out and setting up the Google Assistant API to interact with the mirror by saying “Hey Google,” then go for it!  Otherwise, you may just want the standard mirror if you already have Alexa or Google Home Hub in your home.  Just something to think about.

    1. The frame, painting, and stain took the longest for me. You also want to consider acryclic glass options as it is cheaper, because if you buy all of these components, you could end up spending upwards of $150 without the glass.

  1. Cost of it all – to buy the monitor, raspberry pi, accessories, microphone and some speakers- it could cost anywhere from $100-$150, depending on if you have any of the parts or an old monitor laying around like I did. Also, you can get a motion sensor power plug/outlet to turn the montior on/off. I used a belkin wemo smart switch and Schlage Z-wave sensor with my smart things hub to turn my mirror on when motion is detected and to turn it off when motion/presence activity ends after 5 mins, so it will save a significant amount of energy (around 90%) by turning the mirror on and off only when I am in the room. I also got a usb microphone and setup google assistant on this magic mirror for the second half of the video.

Further Parts Breakdown & Explanation:

Full Kit:                        Bare Kit:
     

Example Motion Activated Plug – for monitor to turn on/off or you can use smartthings and a motion sensor with a plug, but my setup isn’t so DIY – you need to somewhat be advanced with SmartThings to do that with a Belkin plug and Schlage Z-wave Sensor- so this is to make it easier (and cheaper for you):

DVI to HDMI Cord (If monitor doesn’t have HDMI support – stick with the DVI to HDMI, Trust me):

USB Microphone (For Google Assistant Setup):

Monitor:

Or maybe a bigger monitor with Speakers!

But, if you don’t have speakers and want better sound – go with these and plug aux 3.5mm into the Raspberry Pi (and plug the usb into a usb power source, NOT directly into the Pi):

You’ll need the mirror – this should work for the smaller monitor above- and potentially the 23″, but do your measurements! I’ll leave the rest and the frame-building up to you, that’s not my area- but stick with polyacrylic vs polyeurethane (it lasts longer without an orange tint, hint hint):

I hope you enjoy the video – leave me any feedback, positive or negative- as this was a lot of work and I’d like to always improve for anybody that is interested in and engaging with my content.

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

This website uses cookies.