Skip to content

Support us

Authors: fire1ce | Created: 2022-04-24 | Last update: 2024-02-26

Magic Mirror 2.0

Magic Mirror Final

To be honest, it's not my first time building a Magic Mirror project. My first magicmirror can be found here. The Magic Mirror 2.0 is based on Raspberry Pi 4 with Docker Container.

References official website.
khassel's magicmirror docker image documentation website.

The Build Process

I had dead iMac 2011 27" with 2k display. I've managed to use it's LCD panel with this product from AliExpress. It actually a full controller for the specific LCD panel, including the inverter for backlight. Basically, it's a full-fledged LCD Monitor with HDMI we need for the Raspberry Pi 4.

I've decided to test the controller for the LCD Panel inside the original iMac's body.

LCD Controller

I've connected raspberry to the new monitor for the magicmirror testing and configuration.

iMac Raspberry P

Since my previous experience with my first magicmirror build, I've decided to add a Motion Sensor to the Raspberry Pi to detect the movement of the person infront of the mirror and turn the display on/off accordingly.
The second thing i've added is a Power Button to turn the Raspberry Pi on, off and restart it without a physical access to the Raspberry Pi.

I couldn't find any open source projects for the functionality I needed of the power button and the Motion Sensor. So I've decided to create my own solution. Bellow are the scripts that I've created:

Thats how i've tested the functionality of the power button and the motion sensor.

PIR Button Test

I've order a reflective glass with 4 holes for mounting. It was a challenge to find a suitable reflective glass for the MagicMirror. The product I've found is not perfect - the glass is tinted, but it's a good enough solution and way better then Glass Mirror Films I've used on my first Magic Mirror Project.

Row Glass

After I've done all the proof of concepts that every thing will work as i intended, I've continue to build the frame to house all the components.

I've used scrap wood I had laying around to build the frame and the mounting for the LCD panel, and the glass

Wood Frame

For mounting the Magic Mirror to the wall i've used the smallest TV Mount I've found.

Frame TV Mount

After the frame is built, I've added the electronics to the frame.

Frame Electronics

Performing senity check on the electronics, and display assembly.

Frame Screen Test

Since I when on the floating effect the glass isn't covering the all the frame, all the exposed parts of the glass are needed to be covered to avoid light leaking.

Glass Cover

And the final Magic Mirror on the wall.

Magic Mirror Final Side

Magic Mirror Final

The Software

The magicmiror is based on MagicMirror project. running on docker on Raspberry OS.

Below the docker compose file for your reference.

version: '3'

    image: karsten13/magicmirror
    container_name: magicmirror
    hostname: magicmirror
    restart: always
      - 80:8080
      - ./config:/opt/magic_mirror/config
      - ./modules:/opt/magic_mirror/modules
      - ./css:/opt/magic_mirror/css
      - /tmp/.X11-unix:/tmp/.X11-unix
      - /opt/vc:/opt/vc/:ro
      - /sys:/sys
      - /usr/bin/vcgencmd:/usr/bin/vcgencmd
      - /etc/localtime:/etc/localtime
      - /dev/vchiq
      - LD_LIBRARY_PATH=/opt/vc/lib
      - DISPLAY=unix:0.0
      - TZ=Asia/Jerusalem
      - CONTAINER_TIMEZONE=Asia/Jerusalem
    shm_size: '1024mb'
      - npm
      - run
      - start