Build a Raspberry Pi‑Powered Smart Mirror with Voice Control – Step‑by‑Step Tutorial

Ever looked at your bathroom mirror and thought, “I wish this thing could tell me the weather, read my calendar, and maybe even play my favorite podcast while I brush my teeth?” You’re not alone. The smart mirror trend has moved from sci‑fi set pieces to a weekend‑project that anyone with a Raspberry Pi and a bit of solder can pull off. In this post I’ll walk you through building a voice‑controlled smart mirror from scratch, with enough detail that you can skip the guesswork and get straight to the wow factor.

What You’ll Need – The Parts List

Before we dive into code, let’s make sure you have the right hardware. I keep a small “starter kit” on my workbench, so you can copy my list or swap in equivalents you already own.

  • Raspberry Pi 4 (2 GB or more) – The brain. Any model will do, but the 4 gives you enough RAM for smooth UI.
  • Micro SD card (16 GB or larger) – For the OS and mirror software.
  • Power supply (5 V / 3 A USB‑C) – Don’t skimp; a weak supply will cause random reboots.
  • One‑way glass or acrylic mirror – This is the reflective surface that lets the display shine through. You can buy a pre‑cut piece or repurpose an old picture frame.
  • HDMI monitor (size up to you) – The screen that sits behind the glass. A thin LCD works best for a sleek look.
  • USB microphone – For voice commands. A simple desktop mic works fine.
  • USB speaker or small 3.5 mm audio jack – To hear responses.
  • Optional: PIR motion sensor – To turn the mirror on only when someone is in front of it, saving power.

All of these items are easy to find on Amazon, eBay, or at your local electronics store. If you already have a spare Pi lying around, you’re halfway there.

Setting Up the Raspberry Pi

Install Raspberry Pi OS

  1. Download the Raspberry Pi Imager from the official site.
  2. Flash the latest Raspberry Pi OS (Lite version is fine) onto the SD card.
  3. Insert the card, plug in a keyboard, mouse, and monitor, then power up.

During the first boot, run sudo raspi-config and enable:

  • SSH (so you can work headless later)
  • I2C (not needed for this project but handy for future sensor add‑ons)
  • Audio output (set to HDMI if you’re using a speaker attached to the monitor)

Reboot when prompted.

Connect to Wi‑Fi

If you’re not using a wired connection, edit /etc/wpa_supplicant/wpa_supplicant.conf and add your network credentials. A quick sudo reboot will bring you online.

Installing the Magic Mirror Software

The core of any smart mirror is the open‑source MagicMirror² platform. It’s a modular web‑based dashboard that runs in a Chromium browser in kiosk mode.

sudo apt update
sudo apt install -y git nodejs npm
git clone https://github.com/MichMich/MagicMirror
cd MagicMirror
npm install

Now test it:

npm start

You should see a clean black screen with a clock in the corner. If that works, you’re ready for the next step.

Adding Voice Control

For voice interaction I like to keep things simple with Google Assistant SDK. It’s free for personal use and works well on a Pi.

Create a Google Cloud Project

  1. Go to console.cloud.google.com and create a new project.
  2. Enable the “Google Assistant API”.
  3. Create an OAuth 2.0 client ID (choose “Other” as the application type).
  4. Download the JSON credentials file and rename it to credentials.json.

Copy the file to your Pi’s home directory.

Install the Assistant SDK

sudo apt install -y python3-pip
pip3 install --upgrade google-assistant-sdk[samples]

Run the authentication flow:

google-assistant-demo --project-id your-project-id --device-model-id your-model-id

Follow the URL it prints, sign in with your Google account, and paste the resulting code back into the terminal.

Hook the Assistant into MagicMirror

Create a new MagicMirror module called MMM-VoiceControl. Inside the modules folder, make a folder with that name and add a simple node_helper.js that forwards voice commands to MagicMirror’s notification system.

// modules/MMM-VoiceControl/node_helper.js
var NodeHelper = require("node_helper");
var { GoogleAssistant } = require("google-assistant");

module.exports = NodeHelper.create({
  start: function () {
    this.assistant = new GoogleAssistant();
    this.assistant.on("ready", () => {
      console.log("Google Assistant ready");
    });
    this.assistant.on("data", (text) => {
      this.sendSocketNotification("VOICE_COMMAND", text);
    });
  },

  socketNotificationReceived: function (notification, payload) {
    if (notification === "START_ASSISTANT") {
      this.assistant.start();
    }
  }
});

In config.js, add the module:

{
  module: "MMM-VoiceControl",
  position: "bottom_left",
  config: {}
}

Now you can say “Hey Google, show me the weather” and the assistant will fire a MagicMirror notification that you can catch in other modules.

Wiring It All Together

Assemble the Mirror Box

  1. Place the monitor behind the one‑way glass, making sure the screen faces the glass.
  2. Secure the monitor with brackets or double‑sided tape. Keep the edges clean; any visible bezel will break the illusion.
  3. Route the HDMI cable, power cord, mic, and speaker to the back of the box. If you’re using a PIR sensor, mount it near the top edge of the glass.

Connect the Peripherals

  • Plug the USB mic into one of the Pi’s ports.
  • Connect the speaker (or use the monitor’s built‑in speakers).
  • If you added a PIR sensor, wire it to GPIO pin 17 (you’ll need a pull‑down resistor).

Power Management

Add a small script that watches the PIR sensor and turns the display on or off:

#!/bin/bash
while true; do
  if gpio -g read 17; then
    vcgencmd display_power 1
  else
    vcgencmd display_power 0
  fi
  sleep 2
done

Save it as pirsensor.sh, make it executable, and add it to rc.local so it runs on boot.

Fine‑Tuning the Experience

Choose Your Modules

MagicMirror comes with a bunch of ready‑made modules: weather, calendar, news, and even a “compliments” module that throws a friendly line at you each morning. I like to keep the layout minimal – a clock, weather, and a to‑do list. Too many widgets make the mirror feel cluttered.

Adjust Voice Sensitivity

If the mic picks up too much background noise, edit the assistant.json file and lower the audioGain value. A good rule of thumb: set it just high enough that the Pi hears you across the bathroom tiles.

Hide the Cursor

The cursor can be distracting. Install unclutter:

sudo apt install unclutter
unclutter -idle 0.5 -root &

Now the pointer disappears after half a second of inactivity.

Testing and First Run

Power everything up, and you should see the MagicMirror UI reflected in the glass. Speak “Hey Google, what’s the weather?” – the assistant should respond out loud and the weather module should update automatically. If the screen stays dark, double‑check the HDMI connection and make sure the display power command is being sent by the PIR script.

Troubleshooting Quick List

SymptomLikely CauseFix
No sound from speakerAudio output set to analogRun sudo raspi-config → Advanced → Audio → HDMI or 3.5 mm
Mic not picking upUSB mic not recognizedlsusb to verify, then arecord -l
Mirror stays blackMagicMirror not launching in kiosk modeEdit pm2 startup script to include --kiosk flag

Wrap‑Up Thoughts

Building a voice‑controlled smart mirror is a perfect blend of software and hardware – exactly the kind of project I love sharing on Tech & Hobby Fusion. You get a useful daily gadget, a chance to tinker with APIs, and a sleek piece of tech that actually looks cool in your home. Once you’ve got the basics down, you can add facial recognition, control smart lights, or even display your latest GitHub commits. The sky’s the limit, and the only real barrier is how much time you want to spend polishing the UI.

Happy hacking, and may your reflections always be smart.

Reactions