Install Magic Mirror On Raspberry Pi Zero W

By | February 10, 2023

Install Magic Mirror on Raspberry Pi Zero W

This article provides a comprehensive guide to installing MagicMirror² on a Raspberry Pi Zero W. MagicMirror² is an open-source modular smart mirror platform. The Raspberry Pi Zero W, with its compact size and built-in Wi-Fi, is a suitable platform for powering a smart mirror. This guide focuses on a streamlined installation process, utilizing a lightweight operating system to maximize performance on the resource-constrained Pi Zero W.

Preparing the Raspberry Pi Zero W

Before beginning the MagicMirror² installation, the Raspberry Pi Zero W needs to be set up. This involves installing the operating system and configuring essential settings.

  1. Download a lightweight Raspberry Pi OS image. Raspberry Pi OS Lite is recommended for this project due to limited resources on the Pi Zero W.
  2. Use a suitable SD card writing tool (e.g., Raspberry Pi Imager, Etcher) to flash the downloaded image onto a microSD card.
  3. Enable SSH. Create an empty file named "ssh" (without any extension) in the "boot" partition of the freshly flashed SD card. This enables SSH access upon first boot.
  4. Configure Wi-Fi. Create a file named "wpa_supplicant.conf" in the "boot" partition. Add the following lines, replacing "YOUR_SSID" and "YOUR_PASSWORD" with your network credentials:
    country=GB
    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1
    network={
        ssid="YOUR_SSID"
        psk="YOUR_PASSWORD"
    }
            
  5. Insert the microSD card into the Raspberry Pi Zero W and connect the power supply.

Connecting to the Raspberry Pi Zero W

After the initial boot, the Raspberry Pi Zero W will connect to your Wi-Fi network. It is necessary to establish an SSH connection to configure the device further.

  1. Determine the IP address of your Raspberry Pi Zero W. This can be done by checking your router's DHCP client list or using a network scanning tool.
  2. Use an SSH client (e.g., PuTTY, Terminal) to connect to the Raspberry Pi. The command format is ssh pi@YOUR_PI_IP_ADDRESS. The default password is "raspberry".

Updating and Installing Dependencies

Once connected via SSH, it is crucial to update the system and install necessary packages for MagicMirror².

  1. Update the package list with the command: sudo apt update.
  2. Upgrade installed packages with the command: sudo apt upgrade -y.
  3. Install essential build tools and dependencies: sudo apt install build-essential npm git -y.

Installing MagicMirror²

With the prerequisites in place, the MagicMirror² installation can proceed.

  1. Clone the MagicMirror² repository: git clone https://github.com/MichMich/MagicMirror.git.
  2. Navigate into the MagicMirror² directory: cd MagicMirror/.
  3. Install dependencies and start the installation script: npm install && npm run install-mm. This process may take some time.

Configuring MagicMirror²

After installation, the configuration file allows customization of the modules and appearance of MagicMirror².

  1. Open the configuration file: nano config/config.js.
  2. Modify the configuration as needed. The configuration file offers extensive customization options, allowing users to add, remove, and configure modules.
  3. Save and close the configuration file.

Running MagicMirror²

Following configuration, MagicMirror² can be started to verify the setup.

  1. Start MagicMirror² in server mode: npm start.
  2. MagicMirror² should now be running on your Raspberry Pi Zero W. Access it by navigating to the Raspberry Pi's IP address in a web browser on another device connected to the same network. For example: http://YOUR_PI_IP_ADDRESS:8080

Autostarting MagicMirror²

To ensure MagicMirror² starts automatically on boot, configure a systemd service.

  1. Create a systemd service file: sudo nano /etc/systemd/system/mm.service.
  2. Add the following content, modifying the user and group if necessary:
    [Unit]
    Description=MagicMirror
    After=network.target
    [Service]
    Type=simple
    User=pi
    Group=pi
    WorkingDirectory=/home/pi/MagicMirror
    ExecStart=/usr/bin/npm start
    Restart=on-failure
    [Install]
    WantedBy=multi-user.target
            
  3. Enable and start the service: sudo systemctl enable mm && sudo systemctl start mm.

This comprehensive guide describes the steps required to install and configure MagicMirror² on a Raspberry Pi Zero W. Further customization and module installation are possible by referring to the extensive documentation available on the official MagicMirror² website.


Magic Mirror² On A Raspberry Pi Zero

Installing Magic Mirror² On A Raspberry Pi Zero Mirror Central

Raspberry Pi Zero W Magicmirror Forum

My First Smart Mirror In A Frame Of 40 X 30 Cm With Raspberry Pi Zero W Magicmirror Forum

Magicmirror² On A Raspberry Pi Zero W

Building A Smart Mirror Magicmirror² On Raspberry Pi Zero W The Smarthome Journey

Raspberry Pi Zero W

Do It Yourself Easiest Smart Mirror Build On Raspberry Pi Zero W And Quick

Raspberry Pi Zero W Magicmirror Forum

My First Smart Mirror In A Frame Of 40 X 30 Cm With Raspberry Pi Zero W Magicmirror Forum

Magic Mirror With Raspberry Pi

How To Make A Magic Mirror With Raspberry Pi Sparkfun Learn

How To Build A Smart Magic Mirror

How To Build A Smart Magic Mirror

Magicmirror 7 5 Eink Epaper

Magicmirror 7 5 Eink Epaper Bilderrahmen Mit Einem Raspberry Pi Zero W 1 Maker Tutorials

Raspberry Pi Zero Tutorial

How To Build A Smart Magic Mirror Using Raspberry Pi Zero Tutorial

Magic Mirror With Raspberry Pi

How To Setup Build A Magic Mirror With Raspberry Pi Beginners Guide Okdo


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.