Back to projects

Smart Mirror

A few years ago I built a smart mirror. It was a project that was already very popular and you could just follow instructions from various sources to make a functional one with about zero technical skills. The idea is to look into a mirror that hides a black screen where lighter colored content will pop out, thanks to the science behind two-way mirrors

Steps for the projects included:

  • Acquiring a Raspberry Pi, a monitor and a 2-way mirror
  • Building a wooden frame to maintain the screen
  • Install Raspberry Pi OS and MagicMirror module

I disassembled a monitor and bought a two-way mirror on Amazon at a fair price. For the frame I cut some pine wood at the exact dimension needed and simply glued them together with wood glue. I knew the mirror will only be sitting on a surface and never be suspended due to the weight of the monitor and delicate nature of it. The front part is holding the mirror into place and I went for a decorative moulding to stay close to a regular mirror aesthetic.

The whole process is quite easy if you use a miter saw but I somehow managed to get my measurements wrong for the mouldings and had to redo it.

 

Disassembling the monitor

Cutting the wood

Assembling the pieces

Stain for a better look

Looking into it now, I realize how little thought I put into the back of the frame as I assembled the hardware with the leftover wood I had from previous projects. I will need to put a proper back panel and rearrange the wires to avoid a fire hazard…

Back

While it was a fun project at the time, I gave up trying to customize what I could understand of the code as a complete novice.  I moved on with other hobbies and the mirror has been collecting dust for years.

 

Fast forward to today, after learning the basics of Python I needed a project to practice my skills outside of the exercices provided online. I really felt like building a program with graphical user interface to have something tangible. Having pity for my mirror sitting in the basement, I decided to give it a second shot. I figured that a smart mirror would be an endeavour simple enough as the interface solely shows a black background with text displayed to the user. Furthermore, it would allow me to use APIs to finally get a practical use of my mirror by displaying any information I want.

The information I wanted to display for a minimum setup were: 

  • Compliments randomized everyday from a list
  • Time and date updated every minute
  • Local weather updated every 12 hours

Those are standard and inspired by the MagicMirror module that I had previously installed.

After several days of work with Tkinter and demystifying why my OpenWeather API key was not functioning, here is the result:

Even though it is nothing fancy, as a total beginner I am quite happy with the result and the learnings I got from it. The fact that a lot of people have documented their own magic mirror projects and a portion of them being in Python, gave me the opportunity to look at other people's code and understand how the Tkinter library works. I did write my own code after many tries and it is available on Github

Learnings from this project:

  • program a GUI with Tkinter Python library
  • practice the use of APIs and loops in Python
  • setup a Raspberry Pi and establish a SSH connection with it 
  • little woodworking practice 

The project does not end there. Now that I have successfully set up my smart mirror, here comes the fun part where I can add more features to it:

  • connect with the local transit API and use GTFS Realtime to get the time of passage of next the bus at the nearest station 
  • integrate a passive infrared (PIR) sensor to the mirror so the screen comes out of sleep only when someone goes in front of it 

Stay tuned for the results of those ☝️