Smart mirror with weather and calendar
Build it step by step
0 of 7 doneFlash the Pi
Raspberry Pi OS with desktop, enable SSH.
Install MagicMirror
Follow the project's steps.
Add clock, weather, calendar
Edit config.js.
Test on a monitor
Run it and check each module.
Add the PIR
Make the screen sleep after 2 minutes.
Auto-start
Use pm2 to launch at boot.
Build the frame
Mirror in front, monitor behind, vents left open.
How do you build a smart mirror with weather and calendar?
A Raspberry Pi behind a two-way mirror shows the time, weather and today's calendar using MagicMirror². You need Raspberry Pi 4 Model B (4 GB), Raspberry Pi 15 W USB-C power supply, SanDisk microSD card 32 GB (A1, Class 10), Raspberry Pi micro-HDMI to HDMI cable and PIR Motion Sensor HC-SR501. It takes 7 steps and about 300 minutes.
- Level
- Intermediate
- Time
- About 300 min
- Parts
- 5
Parts list
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| PIR VCC | Pi pin 2 (5 V) | Power |
| PIR GND | Pi pin 6 (GND) | Ground |
| PIR OUT | Pi pin 11 (GPIO17) | Motion signal (3.3 V output) |
| Pi micro-HDMI | Monitor HDMI | Picture |
| Pi USB-C | Raspberry Pi power supply | Power |
| Monitor | Its own power adapter | Monitor power |
Code
MagicMirror² is a free Node.js app that draws modules on a black background, which looks like floating text behind a two-way (one-way) mirror. Follow the project's own installation page for the right Node version, as it changes. The weather module can use Open-Meteo, which needs no key; the calendar needs the private iCal address of your calendar, which acts like a password, so keep it in your own config file and do not share it or put it in a repository. Rotate the screen to portrait in the Pi's display settings if you mount a monitor upright. Behind the mirror an old monitor gets warm, so leave ventilation gaps at the top and bottom of the frame and never cover the vents. The monitor's power adapter is a mains device: use the supplied, undamaged adapter and keep it out of the frame, with the lead through a proper strain relief. Fit the mirror securely so it cannot fall; acrylic mirror is safer than glass.
# Smart mirror setup. Run on the Pi (Raspberry Pi OS with desktop, 64-bit). Not an Arduino sketch.
# 1. Update and install Node.js as the MagicMirror project's instructions say (check their page for the version).
sudo apt update && sudo apt full-upgrade -y
# 2. Install MagicMirror from the official project.
git clone https://github.com/MagicMirrorOrg/MagicMirror
cd MagicMirror
npm run install-mcm
cp config/config.js.sample config/config.js
# 3. Edit config/config.js. Add or change modules, for example:
# { module: "clock", position: "top_left" },
# { module: "weather", position: "top_right",
# config: { weatherProvider: "openmeteo", type: "current", lat: 12.97, lon: 77.59 } },
# { module: "calendar", header: "Today", position: "top_left",
# config: { calendars: [ { url: "YOUR_PRIVATE_ICAL_ADDRESS" } ] } },
nano config/config.js
# 4. Test it.
npm run start
# 5. Make it start at login with pm2 as the project's documentation describes.
# ---- Screen off when nobody is near: save as ~/pir_screen.py and run it at login ----
# from gpiozero import MotionSensor
# import subprocess, time
# pir = MotionSensor(17)
# off_after = 120
# last = time.time()
# while True:
# if pir.motion_detected:
# last = time.time()
# subprocess.run(["vcgencmd", "display_power", "1"])
# elif time.time() - last > off_after:
# subprocess.run(["vcgencmd", "display_power", "0"])
# time.sleep(1)
# (On recent Raspberry Pi OS with Wayland use wlr-randr to switch the output instead; check your image.)Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Power on | Mirror shows time and weather within a minute |
| Walk up | Screen wakes |
| Leave | Screen turns off after 2 minutes |
| Reboot | The mirror starts by itself |
If it does not work
Blank screen
Check the HDMI cable and the monitor input.
Weather missing
Check latitude and longitude and network access.
Calendar empty
Check the iCal address is correct and public to the app.
PIR triggers constantly
Turn the sensitivity down and shield it from heat sources.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the smart mirror with weather and calendar?
Raspberry Pi 4 Model B (4 GB), Raspberry Pi 15 W USB-C power supply, SanDisk microSD card 32 GB (A1, Class 10), Raspberry Pi micro-HDMI to HDMI cable and PIR Motion Sensor HC-SR501.
How long does the smart mirror with weather and calendar take to build?
About 300 minutes for a intermediate maker, in 7 steps.
How do I know the smart mirror with weather and calendar works?
Power on: Mirror shows time and weather within a minute. Walk up: Screen wakes. Leave: Screen turns off after 2 minutes.
Blank screen: what should I check?
Check the HDMI cable and the monitor input.
Weather missing: what should I check?
Check latitude and longitude and network access.
Calendar empty: what should I check?
Check the iCal address is correct and public to the app.
PIR triggers constantly: what should I check?
Turn the sensitivity down and shield it from heat sources.
