How To Install Magic Mirror
Contributors: Ell C
Introduction
If yous follow the SparkFun Blog, you may have seen my postal service about my attempts to keep upward with my family's always changing schedule. With schooling and summer camps going online and both myself and my partner working from dwelling house... there's merely too many virtual meetings to keep up with. An offhand comment nearly needing a "battle station" led to the Magic Mirror projection.
This tutorial presumes you have some basic familiarity with Unix systems and commands. It's not required, but is certainly helpful. Let'southward dive in and see how to set this up, shall we?
Required Materials
To follow along with this tutorial, you will need the following materials. You may not need everything though depending on what you take. Add it to your cart, read through the guide, and adjust the cart as necessary.
You May Also Demand
If y'all adopt a larger, wall mounted Magic Mirror (like the one in this tutorial), you will demand to find the following:
- Computer screen with HDMI input
- Shadow Box Frame
- Outdoor Reflective Film
- Shadow Box Mounting Supplies (heavy duty film frame hangers)
Suggested Reading
If yous aren't familiar with the following concepts, we recommend checking out these tutorials before continuing.
Hardware Hookup
If you haven't read through the Raspberry Pi four Kit Hookup Guide, head on over in that location now to get yourself ready upwards.
Installing Magic Mirror
If you've followed forth with the Raspberry Pi 4 Kit Hookup Guide, you should accept a functioning Raspberry Pi desktop in front of you. At present we can move on to the "magic"!
Installing Magic Mirror
The basic installation is relatively straight forward. We'll run through the steps here, just you can besides head over to the Magic Mirror Installation & Usage tutorial and follow their steps.
Install NodeSource
Nosotros first demand to install NodeSource. Open a concluding window on your Raspberry Pi desktop. Then re-create and paste the following code:
language:shell scroll -sL https://deb.nodesource.com/setup_10.x | sudo -Due east fustigate - If all goes well, y'all should meet something similar the post-obit:
Click the image for a closer wait.
Install NodeJS
The next thing we need is NodeJS. Copy and paste the code below into your terminal window:
language:shell sudo apt install -y nodejs
Installing NodeJS....
Clone the MagicMirror GitHub Repo
Now we become to the good part! Let's clone the MagicMirror GitHub repo to our Raspberry Pi. Copy and paste this code to your terminal and watch the GitHub clone magic happen....
linguistic communication:shell git clone https://github.com/MichMich/MagicMirror
Abroad we go!
Install Magic Mirror
We're close! Go alee and cd (alter dir) into the MagicMirror directory:
language:shell cd MagicMirror And so we type in the post-obit:
linguistic communication:crush npm install
Copy the Sample Config File
So close! Let'due south copy the sample config file into ane we tin can play around with:
language:vanquish cp config/config.js.sample config/config.js
Run the Sample Config
Okay! Let's make this magic!
language:shell npm get-go
config.js
This file is essentially the brains of the operation. This is where you layout how y'all want your Magic Mirror to look. Yous can add modules, delete modules, motion modules, and customize to your heart's content.
Navigate to your /home/pi/MagicMirror/config directory and open up config.js in Geany (right click and select Geany).
We're going to skip over most of the setup code. That said, let's look at one piddling bit hither - scroll downward until you see the outlined chip below:
Click the image for a closer look.
Outlined in the prototype are the following settings:
- language: defaults to english, simply can be set up to
nl,ru,fr, etc - timeFormat: defaults to 24. Alter this to 12 if you prefer.
- units: metric or purple? the boxing rages on... (I adopt metric)
Scroll a petty further downwardly and y'all'll find the modules section:
Click the image for a closer look.
Hopefully, this section is also fairly straight forrard. You'll notice that for each module:, you'll need the position: yous'd like information technology to be on the screen. Possible values are:
-
top_bar -
top_left -
top_center -
top_right -
upper_third -
middle_center -
lower_third -
bottom_left -
bottom_center -
bottom_right -
bottom_bar -
fullscreen_above -
fullscreen_below
If you put multiple modules in the aforementioned position, they will be shown in the club they are listed in the config file.
Moving the Clock
Retrieve the initial Magic Mirror epitome above?
Let's move that clock from the height left to the top right!
Find the following in your config file:
Click the image for a closer expect.
Change top_left to top_right:
Click the image for a closer wait.
Salvage the config file, go back to your terminal window, and offset upwardly Magic Mirror (npm kickoff) aaaaaaand...
VOILA! Like shooting fish in a barrel peasy, correct? Each module has its own default requirements and in the default config.js file, these requirements are ready up for u.s.. Nosotros'll look at some more customization in subsequent sections.
Customizing The Modules - Compliments
Sooo... one of the starting time compliments that popped up on my brand new magic mirror was "Hey at that place sexy!". Not sure about y'all but that fabricated me slightly uncomfortable. Especially when my kids started repeating it to random strangers walking by. No bueno. Let's kickoff by looking at the Compliments module and editing those compliments to be a bit more than to our (my) liking.
CD to your MagicMirror/modules/default/compliments directory on the Pi. Open up compliments.js in either Geany or your text editor of option. Y'all should encounter something like the following:
Click the paradigm for a closer look.
See all those weird compliments in there? Yeah. Let'southward change those. This file is pretty straight forward javascript - y'all tin can go alee and change the text of those compliments; just make certain you lot leave the syntax intact. This is looking better....
Click the image for a closer look.
Relieve your file and caput on back to the terminal window. Make sure y'all are in your MagicMirror folder and blazon in npm beginning. Voila!
Feelin' pretty shiny right about now.
Customizing The Modules - Using Your Google Calendar
One of the primary reasons I wanted a Magic Mirror was to go on track of everyone's calendars. Let's change our calendar module to reflect our Google calendars instead of holidays.
In config.js, navigate to the calendar module.
Click the epitome for a larger view.
See where it says url? That'due south what you'll need to change. You lot may want to modify the header as well.
Finding Your Calendar Link
From your google agenda, navigate to the Settings and Sharing option on the calendar you desire to use. Click on the three footling dots next to the calendar to get to the link!
Click on that link! Once you're in Settings and Sharing, curlicue down until you run into the post-obit:
Click the prototype for a closer look.
Yous'll find that there is a Public Address and a Secret Accost. If your agenda is public, go ahead and apply that address. Notwithstanding, if you desire to proceed your calendar private to the world at large, go alee and use the hole-and-corner address in iCal format. Copy that link!
Now head on dorsum to the config.js file and paste that iCal link (hugger-mugger or public) into the url location.
Salve your config.js file, caput dorsum to the final window, and type in npm start to meet your changes in the Magic Mirror!
There are plenty of third party modules that can customize the look of your calendars. Take a peek hither. Almost all of the modules have their requirements either listed out or an example is shown. Give it a try!
Customizing The Modules - Adding New Modules
Now that we have THAT out of the way, let'due south look at other modules nosotros can edit or add.
By default, the Magic Mirror comes with the post-obit modules:
- Warning
- Calendar
- Clock
- Compliments
- Current Weather
- Howdy World
- News Feed
- Update Notification
- Weather Module
- Weather Forecast
The default config.js file that we copied in the Installing Magic Mirror section has the basics set up for u.s.. But what if we want more than? Well, we're in luck. There'southward a whole ecosystem of third party modules you can add into your Magic Mirror.
Word of the Solar day
Let's do something uncomplicated - allow's add the Word of the Day.
Start past opening a concluding window on your Raspberry Pi and navigating to your MagicMirror's modules folder. If you are using the default installation directory, use the control:
language:vanquish cd ~/MagicMirror/modules Clone the module:
linguistic communication:shell git clone https://github.com/bittiez/MMM-MWWordOfTheDay.git You lot should run across something along the lines of the following:
Once you lot have the module code, head back to your config.js file and add together the following:
language:javascript module: 'MMM-MWWordOfTheDay', position: 'top_right', config: { updateInterval: 120000, headerText: "Word of the twenty-four hour period" }
Click the image for a closer look.
Salvage and quit! From your terminal, blazon npm kickoff and you'll see your word of the day in the upper correct manus corner!
Finishing Touches
There are so many options when making the box and the mirror. Googling "Magic Mirror Frame" is a lilliputian bonkers. I went with a shadow box I got on auction from Michaels, and some outdoor reflective film I bought from Amazon. I besides had to become some right angle HDMI adapters and so that the cable would lay somewhat flat and fit into the frame.
Since the frame was bigger than the screen, I had to do some finagling to become the screen to fit where I wanted it to.
Making It Improve
The Raspberry Pi 4 runs hot plenty that I bought the Heatsink Case. I still needed to drill a few actress holes on the top of the mirror frame to provide enough ventilation merely information technology's worth information technology to accept the possibility of time to come expansion.
When time permits, I'll probable add a safe reboot and shutdown button with the Qwiic PHat like Bobby does hither:
I may as well employ the Qwiic PHat to extend the Qwiic ecosystem. It'd be nice to add together a proximity sensor such that it's not merely on all the time. As y'all can see in the images in a higher place, I've already used css to customize our calendars and added Google Tasks in. Super handy to know what you need to practice each twenty-four hour period!
Troubleshooting
The MagicMirror projection has a wonderful forum of users ready and willing to assist out! I have popped over in that location a few times to sort out some CSS configuration questions myself.
Common Errors
-
Please create a config file: If you've made changes to your config file and get this error, there is probable a syntax mistake in your file. If yous are simply starting out, yous need to copy the config.js.sample to config.js.
-
npm fails to starting time: Become errors when yous type in
npm get-go? Likely you're non in the MagicMirror folder. Make sure you're in the correct directory and endeavour again. -
Module non working: Make sure that when yous install modules, you are in the MagicMirror/modules folder. The project assumes your modules will be installed here and if they are not, the config file tin can't discover them.
Resources and Going Further
And so now you have a delightful control eye. What volition you do adjacent? How will you customize your daily routine?
- Magic Mirror
- Documentation
- Default Modules
- Third Political party Modules
- Forums
- Raspberry Pi Foundation
- Getting Started with the Raspberry Pi
- Product Cursory (PDF)
- Schematic (PDF)
- Mechanical Drawing (PDF)
- Documentation
- Projects
- Pi Foundation Forums
- Raspberry Pi Forums: Is Your Pi Not Booting? - Basic troubleshooting tips and solutions for a Raspberry Pi that is non booting upwardly.
- The gPIo tutorial
- The SPI and I2C tutorial
You lot can also cheque out some of our other smashing Raspberry Pi Tutorials hither:
Getting Started with TJBot
This post will walk y'all through setting upwardly your TJBot and getting started with the first three recipe examples provided by IBM.
Qwiic MUX Hookup Guide
Accept a bunch of sensors with the aforementioned I2C address? Put them on the Qwiic MUX (TCA9548A) to get them all talking on the aforementioned bus!
Qwiic SHIM Kit for Raspberry Pi Hookup Guide
Go started with the Series LCD with RGB backlight and 9DoF IMU (ICM-20948) via I2C using the Qwiic organisation and Python on a Raspberry Pi! Accept sensor readings and brandish them in the serial terminal or SerLCD.
Source: https://learn.sparkfun.com/tutorials/how-to-make-a-magic-mirror-with-raspberry-pi/all
Posted by: hatchetthimpeas.blogspot.com

0 Response to "How To Install Magic Mirror"
Post a Comment