RPI-Zero-MagicMirror for ~50€
A 50€ Magic mirror using a raspberry pi zero W. Prices always fluctuate a little bit. Therefore when you are reading this it could be like 45-55€. This guide will explain how to set up the MagicMirror2 OS on a raspberry pi zero.
Hardware required for the Mirror (tools not included):
- Raspberry pi zero W - ~11€
- Micro SD-card 16GB - 5€
- micro HDMI to HDMI adapter - ~1€
- Dependent on your monitor inputs a matching cable I used this - ~2€
- micro-USB male - ~1€
- 3.3v Relay - ~1€
- ikea Ribba frame at least 50x50cm - ~10€
- old monitor (or find one on ebay kleinanzeigen/craigslist/etc...) - ~0€-10€
- 5v PSU - ~2€
- if you do not have this lying around:
- some cables for soldering - ~5€
- wood to cover the back of the frame (I used the 50x50cm RIBBA) - ~2€
- maybe some wood to secure the display in place - (~2€)
- PIR motion sensor
- mirror foil - ~10€
Total: 11€ + 5€ + 1€ + 2€ + 1€ + 1€ + 10€ + 0-10€ + 2€ + 5€ + 2€ + 2€ + 10€ = ~50-60€
RPi ZeroW Pinout (BCM numbering is the same as the number behind GPIO): source
Installing the OS on the RPI 0W
I used as a reference this guide however I need to make some changes. Also somethings were unclear to me. But he provides a ready made image that you can use to skip over all the steps described here (I did not test the image).
- download Raspbian Lite
- flash image to SD-card (I used Balena Etcher)
- copy "SSH" and "wpa_supplicant.conf" to the boot-partition of the SD-card (don not forget to change the placeholders in "wpa_supplicant.conf")
- Install Node.js
sudo wget https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-armv6l.tar.xz
tar xvf node-v10.16.0-linux-armv6l.tar.xz
cd node-v8.3.0-linux-armv6l
sudo cp -R * /usr/local/
sudo reboot
sudo apt install npm
sudo apt install git
- Install MagicMirror:
git clone https://github.com/MichMich/MagicMirror
cd MagicMirror
npm install –arch=armv7l
sudo apt install chromium-browser
sudo raspi-config
-> Boot Options
-> B1 Desktop/CLI
-> B2 Console Autologin
sudo apt-get install xinit
sudo apt install xorg
sudo apt install matchbox
sudo apt install unclutter
- copy "chromium_start.sh" and "mmstart.sh" to your homefolder
sudo chmod a+x ~/mmstart.sh
sudo chmod a+x ~/chromium_start.sh
- To start the browser and show the mirror after boot up follow this guide
Installing Modules
Turn on and off the mirror with the PIR-sensor:
I used pin 23 for the relay and pin 22 for the IR-sensor (BCM layout).
- 1st option (Did not get this working)
- 2nd option (setup as described in the link and used the 'toggle_relay.py' as callback script)
- I had to follow this suggestion to turn hdmi off/on:
- in ~/MagicMirror/modules/MMM-PIR/callbackScripts/default/ the files "displayOff.sh" and "displayOn.sh" had to be slightly modified (look at the provided files)
- To toggle the relay:
- install pip:
- sudo apt-get install python3-pip
- install RPi.GPIO:
- python3 -m pip install RPi
- move the turnOn/OffRelay python scripts to the ~/MagicMirror folder
- install pip:
- I had to follow this suggestion to turn hdmi off/on:
Show guest wifi credentials and QR-code
Other modules
Helpful
- goto your MagicMirror folder
npm run config:check