Introduction
Making your own smart mirror with a Raspberry Pi is a fun electronics project that doesn't have to break the bank. With just a few cheap components, you can build an interactive mirror that displays useful information and responds to motion and voice commands.
In this comprehensive guide, I'll walk you through step-by-step instructions to build a voice-controlled smart mirror with motion tracking capabilities for under $50. We'll cover:
Overview of Components Needed
- Raspberry Pi
- Monitor or TV
- Acrylic sheet
- Wood frame
- Motion sensor
- Microphone
- Cables
- Software
Setting up the Raspberry Pi
- Installing Raspbian OS
- Enabling camera and audio
- Connecting to WiFi
- Installing necessary software
Building the Physical Mirror Frame
- Cutting acrylic
- Building wooden frame
- Adding backlighting (optional)
Creating the Smart Mirror Interface
- Using MagicMirror2 software
- Configuring motion tracking
- Adding voice control
- Customizing display modules
Finishing Touches
- Adding sound feedback
- Setting up automatic start
- Troubleshooting issues
With cheap components, free software like MagicMirror2, and basic DIY skills, you can create an awesome voice-controlled smart mirror with motion tracking for under $50. Let's get started!
Overview of Components Needed
Here are the main components you'll need to build your own smart mirror:
Raspberry Pi
The brain of your smart mirror will be a Raspberry Pi, a small, affordable single-board computer. The Raspberry Pi 3 B+ model or newer is recommended due to its faster processor speed and built-in wireless networking. Expect to pay $35-60 for a Raspberry Pi kit.
Monitor or TV
You'll need a monitor or TV to serve as the mirror display. The Raspberry Pi supports HDMI output. Aim for a minimum screen size of 5". You can often find cheap 5-7" portable monitors online. Used monitors can cost as little as $10-20.
Acrylic Sheet
A transparent acrylic sheet will go in front of the monitor to create the mirror effect. Look for acrylic that is 1⁄4” thick so it is sturdy but not too heavy. The size should match your monitor. An 8 x 10” sheet costs around $10.
Wood Frame
Build a wooden frame to mount the mirror components onto. Get 1 x 2 lumber from your local hardware store to build the frame. Paint or stain it to match your home's aesthetics. You'll only need a few feet of lumber for a small frame.
Motion Sensor
A PIR motion sensor detects when someone walks in front of the mirror, allowing it to respond. The Adafruit PIR Sensor is compatible with the Raspberry Pi. Get it for around $10.
Microphone
To accept voice commands, a USB microphone needs to be connected to the Pi. Consider a compact lapel mic. Basic mics cost $5-10.
Cables
You'll need various cables for power and connectivity:
- Micro HDMI cable to connect Pi to the display
- Micro USB power cable for the Pi
- Jumper wires to wire the motion sensor
Cables can be picked up for just a few dollars.
Software
The smart mirror functionality comes from free software:
- Raspbian Raspberry Pi OS
- MagicMirror2 smart mirror interface
- Motion tracking modules
Total cost of components should come out to under $50. Now let's look at setup...
Setting up the Raspberry Pi
The first step is setting up the Raspberry Pi with the operating system and software we need:
Installing Raspbian OS
Raspbian is the official operating system for Raspberry Pi. Download the Raspbian Buster Lite image and use balenaEtcher to flash it onto a microSD card.
Insert the microSD into the Pi and connect power to boot it up. Raspbian will guide you through initial setup like connecting to WiFi and enabling SSH access.
Enabling Camera and Audio
The Pi needs camera and audio access for motion tracking and voice control.
In Raspi-config, enable the camera and audio interfaces. Reboot for changes to take effect.
Connecting to WiFi
Have the Pi join your WiFi network so it can access the internet.
In wpa_supplicant.conf
, add your network name and password. Restart to connect.
Installing Software
From the command line, install the software needed:
sudo apt update
sudo apt install magicmirror2
MagicMirror2 provides the smart mirror functionality. We'll customize it later.
The Pi is now ready to be configured!
Building the Physical Mirror Frame
To mount the screen and acrylic, we need to build a wooden frame:
Cutting Acrylic
Use a table saw to cut your acrylic sheet down to the dimensions of your monitor. Wear eye protection when cutting. Smooth any rough edges with sandpaper.
Building Wooden Frame
Construct a rectangular frame from your 1 x 2 lumber that matches the size of the acrylic sheet. Mitered 45° corners give it a nice finished look.
Make sure the frame is deep enough to accommodate the monitor's thickness. Leave a channel in the back for cables.
Adding Backlighting (Optional)
To evenly illuminate the acrylic, install LED strip lighting along the inside edges of the frame. This makes the mirror appear brighter. Power the lights with a 12V adapter.
That completes the physical frame. Next we’ll set up the smart functionality.
Creating the Smart Mirror Interface
The real magic comes from the MagicMirror2 software. Here is how to configure it:
Using MagicMirror2
The core MagicMirror2 (MM2) program runs on the Pi and generates the smart mirror interface.
In /home/pi
, edit config.js
to customize your mirror's appearance and content modules. For example, you can add a clock, weather, headlines, calendar, etc.
Configuring Motion Tracking
To activate the mirror when you approach it, install the MMM-Motion module.
In config.js
, add MMM-Motion
to the modules list. Set its pin
and detection mode
. Now it will monitor the motion sensor.
Adding Voice Control
The MMM-Assistant2 module lets you issue voice commands. Enable the microphone and add this module to config.js
.
You can say pre-defined commands like "What's the weather today?" to trigger actions.
Customizing Display Modules
Rearrange, resize, and tweak the display modules in config.js
until you are happy with the layout and content.
Set a nice background image and screensaver when idle. The options are endless for personalization.
The smart mirror interface is complete!
Finishing Touches
Add some final touches to complete your smart mirror:
Adding Sound Feedback
Use the MMM-Assistant2 module to enable voice feedback when giving commands. This makes the interaction more natural.
You can also add sound effects for actions like triggering the motion detection.
Setting up Automatic Start
Have the mirror launch MagicMirror2 on boot using pm2
or a systemd service file. This way it starts up automatically whenever the Pi is powered on.
Troubleshooting Issues
If anything isn't working, check the log files in /home/pi/magic_mirror/logs
. Google any specific error messages for solutions. Common issues are dependencies not installed or configuration problems.
With that, you now have an awesome voice-controlled smart mirror with motion detection for under $50! Customize it to your heart's content.
Summary
Building your own smart mirror with a Raspberry Pi is an attainable project for hobbyists. With cheap hardware, free software, and basic DIY skills, you can create a customized interactive mirror.
The key steps are:
- Set up the Raspberry Pi with Raspbian OS
- Install MagicMirror2 software
- Build wooden frame to mount the monitor and acrylic
- Configure motion tracking and voice control modules
- Personalize the display content and layout
For under $50, you can have a feature-packed smart mirror ready to hang in your home!
Let me know if you have any other questions! I'm happy to help explain any part of the process in more detail. Making your own electronics projects is really rewarding.