Installing MagicMirror² on Raspberry Pi is an exciting endeavour that results in a smart mirror with essential everyday data displayed aestreically. The MagicMirror² platform is an open-source modular smart mirror platform with extensive customization options. This guide will take a deep dive into how to install MagicMirror² on your Raspberry Pi effectively.
Requirements
To install MagicMirror² on your Raspberry Pi, you would need certain hardware components and software tools. Here are the essentials:
Hardware
- Raspberry Pi (This guide assumes that you are using Raspberry Pi 3 or newer models.)
- A micro SD card (minimum 8GB)
- A Monitor/TV and HDMI cable
- A power supply
- Mouse and keyboard for input (during setup only)
- USB Microphone (optional, needed only if you want to include voice controls)
- Two-way mirror and frame (for the final setup)
Software
- A modern OS (Raspbian Buster is used for this guide)
- MagicMirror² software
- Node.js and npm
- Git
- Electron
Step 1: Setting Up Your Raspberry Pi
First up, you need to set up your Raspberry Pi. Use the micro SD card and install the OS – Raspbian Buster.
- Download the Raspberry Pi Imager from the official website, available for all different OS like macOS, Ubuntu, and Windows.
- Install it, open it and choose the ‘CHOOSE OS’ button.
- Scroll down and select the version with desktop characterised as ‘Raspberry Pi OS (32-bit) with desktop and recommended software’.
- Next, click on ‘CHOOSE SD CARD’ and choose your SD card.
- Finally, hit the ‘WRITE’ button. Wait for the process to finish.
Once done, insert the SD card into your Raspberry Pi, connect the monitor, keyboard and mouse, and power it up.
Step 2: Configure Your Raspberry Pi
After the bootup, go through the initial setup process. Ensure that you are connected to the internet via ethernet or Wi-Fi, for installing node.js, npm, and other necessary software. You might also need to adjust the screen resolution if the display is not set optimally.
Step 3: Installing Node.js and npm
After the setup, install node.js and npm. Open a terminal and update the package lists for upgrades and new package installations:
sudo apt update
Next, upgrade all the installed software to the latest version:
sudo apt -y upgrade
Then, download and install node.js and npm:
sudo apt -y install nodejs npm
Check or verify the installed versions of Node.js and npm:
node -v
npm -v
Step 4: Installing MagicMirror²
Now, we will clone the MagicMirror GitHub repository and install it. Use the ‘bash command’ to install it automatically with a one-line command:
bash -c "$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installers/raspberry.sh)"
This command downloads a script and runs it, which ultimately clones the MagicMirror repository, installs necessary dependencies and even manages the configuration for you.
After the installation is done, MagicMirror should start automatically on your Pi.
Step 5: Configuration
Customise your mirror with the array of modules available. You can edit the configuration file to select which modules appear, where they appear, and what they display.
To edit, stop MagicMirror first if it’s running with pm2 stop MagicMirror and open the configuration file in a text editor with:
nano ~/MagicMirror/config/config.js
Remember to save the file before closing (ctr+x, y, enter).
Now you know how to install MagicMirror² on your Raspberry Pi and how to configure it to suit your needs. Experiment with different modules, tweak the settings, and make your smart mirror truly personal.