/RPI-Zero-MagicMirror

A 50€ Magic mirror using a raspberry pi zero W.

Primary LanguageShellMIT LicenseMIT

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):

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): RPi Zero W Pinout image not found 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).

  1. download Raspbian Lite
  2. flash image to SD-card (I used Balena Etcher)
  3. 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")
  4. Install Node.js
    1. sudo wget https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-armv6l.tar.xz
    2. tar xvf node-v10.16.0-linux-armv6l.tar.xz
    3. cd node-v8.3.0-linux-armv6l
    4. sudo cp -R * /usr/local/
    5. sudo reboot
  5. sudo apt install npm
  6. sudo apt install git
  7. Install MagicMirror:
    1. git clone https://github.com/MichMich/MagicMirror
    2. cd MagicMirror
    3. npm install –arch=armv7l
  8. sudo apt install chromium-browser
  9. sudo raspi-config
    1. -> Boot Options
    2. -> B1 Desktop/CLI
    3. -> B2 Console Autologin
  10. sudo apt-get install xinit
  11. sudo apt install xorg
  12. sudo apt install matchbox
  13. sudo apt install unclutter
  14. copy "chromium_start.sh" and "mmstart.sh" to your homefolder
  15. sudo chmod a+x ~/mmstart.sh
  16. sudo chmod a+x ~/chromium_start.sh
  17. 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

Show guest wifi credentials and QR-code

Other modules

Helpful

Check config:

  • goto your MagicMirror folder
  • npm run config:check