How to Build a Smart Magic Mirror With Raspberry Pi

by Morris_M in Circuits > Raspberry Pi

63 Views, 2 Favorites, 0 Comments

How to Build a Smart Magic Mirror With Raspberry Pi

magic mirror.png
Screenshot 2025-05-15 212428.png

The Magic Smart Mirror project turns a regular mirror into a smart display using a Raspberry Pi, a computer monitor, and theMagicMirror² platform. It shows useful information like the time, weather, and calendar events while still functioning as a normal mirror. I want to build it to create something both practical and visually interesting for my home, and to challenge myself with a hands-on project that combines coding, hardware, and design.

Supplies

Tools

  1. Screwdriver - For assembling the frame and securing components.
  2. Hot Glue Gun or Double-Sided Tape - To mount the monitor and Raspberry Pi inside the frame.
  3. Wood Glue - If you're building a custom wooden frame.
  4. Wood Screws - For added strength to the build.
  5. Hand Saw - To cut the wood needed for the frame
  6. Utility Knife or Scissors - For cutting materials like reflective film or cable management.
  7. Measuring Tape or Ruler - To ensure precise measurements for fitting components.

Materials

1. Raspberry Pi 4 Model B (4GB)

  1. Purpose: Serves as the main computer running the MagicMirror² software.

2. MicroSD Card (32GB or higher)

  1. Purpose: Stores the operating system and MagicMirror² software.

3. Power Supply for Raspberry Pi

  1. Purpose: Provides power to the Raspberry Pi.

Recommended Products: CanaKit Raspberry Pi 4 4GB Starter PRO Kit (includes everything needed to get started.)

4. Monitor

  1. Purpose: Displays the MagicMirror² interface behind the two-way mirror.
  2. Note: You can repurpose an old monitor or purchase a new one that fits your frame size.

5. Two-Way Acrylic Mirror (Custom cut for monitor)

  1. Purpose: Allows the display to shine through while reflecting like a mirror.
  2. Recommended Product: https://www.ttplasticland.com/products/custom-see-thru-2-way-mirror-acrylic-sheet?_pos=1&_sid=e11eb3f78&_ss=r (You can order a custom cut sheet to fit your mirror dimensions)

6. Wooden Picture Frame

  1. Purpose: Houses the monitor and mirror, providing a finished look.
  2. Recommended Product: Home Depot hobby wood and discounted scrap wood

7. USB Keyboard and Mouse

  1. Purpose: Used for the initial setup and configuration of the Raspberry Pi.
  2. Recommended Product: Amazon Basics Wireless Keyboard and Mouse Bundle

Set Up the Raspberry Pi and Install MagicMirror²

The very first phase of your Magic Mirror project is to set up the software environment that will power your smart display. The brain behind the entire operation is the Raspberry Pi, a small single-board computer that runs a Linux-based operating system and is well-suited for this type of continuous display project. This step creates the foundation for everything else—the interface, modules, and custom features.

You begin by acquiring a Raspberry Pi 4 (or a 3 if you're on a tighter budget), along with a microSD card (at least 32GB, Class 10 recommended), a USB-C power supply, an HDMI cable, and a keyboard, mouse, and monitor for the initial setup. The microSD card will serve as the Pi’s hard drive and needs to be flashed with an operating system. On your main computer, download and install the Raspberry Pi Imager from the official Raspberry Pi website.

Using the Imager, select "Raspberry Pi OS (32-bit)" as your operating system. If you want a graphical interface, choose the Desktop version; if you prefer working in a command-line environment, the Lite version will work too. Choose the microSD card as the destination and click "Write" to install the operating system. This process takes a few minutes. You can also enable SSH (remote terminal access) at this stage by adding an empty file named "ssh" to the boot partition of the card—this allows you to control the Pi from another computer later.

Once the OS is flashed, insert the microSD into the Raspberry Pi, plug it into the monitor with the HDMI cable, connect the keyboard and mouse, and turn it on. The Pi will boot up and guide you through first-time setup steps such as language selection, setting a password, and connecting to Wi-Fi.

For next steps, go to: https://docs.magicmirror.builders/getting-started/installation.html for step-by-step instructions on installing the Magic Mirror2 program on our Raspberry Pi.

After setup, open the terminal and update the system by typing:

“sudo apt update && sudo apt upgrade -y”

This ensures your Pi has the latest packages and security patches. Next, install Node.js, the software environment MagicMirror² runs on. This is done by downloading the setup script from NodeSource and running:

“curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -”

Then, to install Node.js, enter:

“sudo apt install -y nodejs”

With Node.js in place, install MagicMirror² using the official automatic installation script. Enter this command into the terminal:

“curl -sSL https://install.magicmirror.builders | bash”

The script takes care of downloading MagicMirror², installing dependencies, and configuring everything for you. This process may take a while. When it’s finished, you can launch MagicMirror² by typing:

“npm run start”

This will start up the MagicMirror² interface in full screen, displaying default modules like the current time, date, weather, and a sample calendar.


Configure Your MagicMirror and Add New Modules

Now that your MagicMirror software is running, it’s time to customize what it displays. MagicMirror uses a file called config.js to determine which modules (apps or widgets) appear on your screen and where. This step will guide you through editing this configuration and installing additional modules to expand your mirror’s functionality.

Editing the config.js File

Your main configuration file is located at:

~/MagicMirror/config/config.js

To edit it, open a terminal and type:

nano ~/MagicMirror/config/config.js

This file controls settings like language, time format, and—most importantly—the modules that are displayed. Each module entry has a name, a position on the screen, and optional settings.

For example, the clock module is written like this:

{

module: "clock",

position: "top_left"

}

You can change the position to any part of the screen, like "top_right" or "bottom_left", depending on your layout preferences.

Adding New Modules

For example, the MMM-on Spotify 3rd party module

The MMM-OnSpotify module for MagicMirror² displays real-time Spotify playback information on your smart mirror. It shows the currently playing song, artist, album artwork, playback status (playing or paused), and the device being used. This module connects to your Spotify account through the Spotify Web API, requiring you to set up developer credentials and access tokens. Once configured, it updates automatically, letting you enjoy a visual of your music activity without needing to touch your phone.

MagicMirror comes with a few built-in modules, but the real magic happens when you add 3rd-party modules. Here's how:

  1. Find a module you want to use from the MagicMirror community list on GitHub.
  2. Download the module using Git. First, open a terminal and navigate to the modules folder:

cd ~/MagicMirror/modules

Then run the command:

Example: git clone https://github.com/raywo/MMM-OnSpotify.git

  1. Install any dependencies the module needs by running:

cd MMM-OnSpotify

Then:

npm install

  1. Add the module to your config file. Go back to ~/MagicMirror/config/config.js and insert something like this into the modules array:

{

module: "MMM-OnSpotify",

position: "bottom_left",

config: {

clientID: "yourClientID",

clientSecret: "yourClientSecret",

accessToken: "yourAccessToken",

refreshToken: "yourRefreshToken"

}

}

Replace the keys with your actual Spotify developer credentials.

  1. Restart MagicMirror to apply the changes. If you’re using PM2, type:

pm2 restart mm

If you're running MagicMirror manually, just use:

npm start

For more information on configuring modules or adding 3rd-party modules, go to:

For module Config instructions: https://docs.magicmirror.builders/modules/configuration.html

For 3rd party modules: https://github.com/MagicMirrorOrg/MagicMirror/wiki/3rd-party-modules

Building Your Mirror

Screenshot 2025-05-15 202501.png
Screenshot 2025-05-15 202424.png

Now that your Raspberry Pi is running MagicMirror2, it's time to create the actual “mirror” part of your smart mirror. The key idea is to place a monitor behind a piece of two-way glass or acrylic. When the monitor is on, the white or bright text from MagicMirror modules will shine through the glass, appearing to float on the mirror's surface. When the monitor is off, it looks like an ordinary mirror.

1. Select the Monitor

You’ll need an old computer monitor, preferably 21–24 inches. Choose one with a flat screen and a thin bezel. Remove the plastic casing to reduce bulk and make it easier to fit into a custom frame. Be careful during disassembly—monitors contain delicate electronics and capacitors that may hold a charge.

2. Choose a Two-Way Mirror

You’ll need a two-way mirror, also known as a one-way mirror or “see-through mirror.” There are two good options:

  1. Acrylic two-way mirror: Lightweight and shatterproof, ideal for wall-mounted builds.
  2. Glass two-way mirror: More reflective and durable, but heavier and more fragile.

Make sure the mirror is cut to match the size of your monitor (usually slightly larger to cover the bezel edges).

3. Build a Frame

Design or repurpose a picture frame or shadow box that can hold both the two-way mirror and the monitor securely. The frame should have enough depth to house the monitor, Raspberry Pi, cables, and other hardware. A wooden frame is easiest to work with if you plan to mount it or add components.

Instructions for Building the Wooden Frame

  1. Measure Your Monitor and Mirror
  2. First, measure the exact width, height, and thickness of your monitor and the two-way glass mirror. This will determine the size of your frame pieces.
  3. Choose Your Wood
  4. Select good-quality, straight-grain wood like pine, oak, or poplar. Pine is easier to work with and more affordable. Use wood that is about ¾ inch thick for sturdy but not bulky frame sides.
  5. Cut the Frame Pieces
  6. Cut four wooden pieces for the frame: two vertical sides and two horizontal top/bottom pieces. The length should be the mirror size plus a bit of extra length to house the monitor behind and for the frame edges. If you want neat corners, cut the ends at a 45° angle for miter joints. Otherwise, square cuts for butt joints work too.
  7. Sand the Wood
  8. Sand all pieces thoroughly with medium and then fine-grit sandpaper. Smooth edges and surfaces will make the frame look better and safer.
  9. Assemble the Frame
  10. Join the four frame pieces together to form a rectangle or square. Use wood glue along the edges and clamp them securely until dry. For stronger joints, reinforce with finishing nails or small screws from the back side so they won’t be visible.
  11. Add Inner Support Cleats
  12. Cut thin wooden strips to attach on the inside edges of the frame. These cleats act as ledges to hold the mirror and monitor securely inside the frame. Nail or screw them into place.
  13. Prepare the Back Panel
  14. Cut a plywood or MDF board to match the outer size of the frame. This will act as the back support for your monitor and electronics. Attach it to the back of the frame using screws or brackets.
  15. Finish the Frame
  16. Apply your preferred finish to the frame—paint, stain, or clear varnish—to protect the wood and enhance appearance. Let it dry completely before proceeding.

4. Assemble the Mirror Display

Start by placing the mirror in the frame with the reflective side facing out. Behind the mirror, securely mount the monitor with its screen facing the back of the mirror. You can use brackets, adhesive Velcro, or foam padding to ensure a snug fit without damaging the display. Be sure to leave ventilation gaps and access points for power and HDMI cables.

5. Mount the Raspberry Pi

Secure the Raspberry Pi to the back of the monitor or the inside of the frame using double-sided tape, screws, or a custom mount. Connect it to the monitor with an HDMI cable and power it with the USB-C adapter. If you plan to keep the setup in place, you might want to use cable ties or clips for neat cable management.


Downloads