Magic Mirror with a motion detector

46 thoughts on “Magic Mirror with a motion detector”

      1. Seems I need to learn a little more about the OS. I have been able to figure most of this out without any prior knowledge but I keep trying to do things the Windows way. Essentially I’m just going into the file manager, opening the files and trying to edit them.

  1. Thanks for the writeup! Could you please tell me where exactly you bought the PIR sensor from and what did you use to connect the wires from the sensor to the pi?

    1. Definitely, I bought them on ebay,can’t find the link now, though Adafruit sells them also and probably has a better customer service. I connected it via simple 3-wire strip cable, soldered on 100mil header, really nothing special.

  2. It seems the calendar.php has moved to the controllers folder on

    Here is what I did, everything works except for my google calendar.

    1. Downloaded the magic mirror zip from this site

    2. added ‘en’ language on lines 2 and 13, ‘Toronto,Canada’ on line 10, and my API code for weather on line 14
    3. removed the url from the news code on line 41 so it doesn’t load news
    4. swapped in my private ical google calendar url

    5. swapped in my private ical google calendar url on line 3

    6. added the extra parenthesis on line 33

    7. removed div class=”news medium” from line 20

    Everything works except my calendar still wont load. I have the code on:

    Any help is much appreciated 🙂

    1. hey, I’m not actually familiar with js nor php so I might not give you a very helpful answer but so far I see it putting an url of your iCal config.js line 38 should be enough. I don’t think that changing calender.php is good. Try it out and please let me know if you manage to fix it.

  3. I tried switching it back to the original but had no luck. Here is what my controllers>calendar.php file looks like:

  4. Hello there thanks for the guide post! I plan on following this post to make a similar mirror as a gift.

    I have two questions wondering if you can answer them.

    1. What was the thickness of the two mirror that you used?
    2. I am assuming that you monitor is shorter than the length of the mirror.
    When the monitor is on, can you even notice that the monitor is shorter than the mirror such as some outline or anything?

    Thanks again!

    1. Thanks for compliments.
      1. Thickness of my glass was 6mm, though there are 3mm glasses available
      2. Well, if you take a really deep deep view you can see edges of monitor reflecting light, but in normal mode it’s invisible, just as you can see on the photos.

      1. Yes I could not tell from the pictures at all. What was the size of the monitor that you ended up using?
        I was thinking of using at 27″ inch monitor but may go with at 22″-24″ to save money.

  5. Thanks for the write-up one of the best interfaces i’ve seen on a Magic Mirror. It seems that Holiday api isn’t working on my setup. Am I missing something? Also, have you ever thought about potting a weather map on the mirror as weel?

    1. It could be that you do miss something: someone here commented earlier that original repo has been changed and calender.php comes in the separate folder now. This person also had troubles with it. Could be that Michael’s new version has some bugs. Unfortunately, I’m no authority on php to advise on what to change :/

    1. In a small glass workshop in my hometown, and they do not have a website or something to make them more accessible. If you live in Vienna, Austria, I could provide you their address. It was still expensive, about 114€ for that matter.

  6. I got everything beside a frame.
    Did you order the frame or did you made it yourself ?
    Can you post some detailed photos of it, how it holds the mirror


    1. I ordered it..we had some reconstruction works at our apartment so I asked a carpenter if a wooden frame 118 x 38 x 8 cm would be a trouble to make. How does it hang..good question, I improvised with some spare materials, it s basically an L-shaped piece of iron with the hole. I took two of them and screwed them inside of the wooden frame. Then, I drilled two holes in the wall and screwed two big bolts upon which I later stacked the frame with L-shaped iron pieces. I don’t know how helpful this lousy illustration is, but unfortunately, I didnt take any photos. And sorry for using word “screwed” too often 🙂

      1. Danke! Thats fine. So I will first go and ask a carpenter for the frame maybe even with notches (de: Nuten). If this this is to expensive I will try find a L-Shaped piece of wood and hold the mirror like you with some icon pieces. I really want to try to make it as thin as possible, about 5cm depth.

        I will post the results here 😉

    1. Hello, thanks for writing and sorry for the late response. I checked your steps and understood that you have troubles with turning monitor on, right? In that case you should check your monitor port (HDMI or VGA) and keep in mind that R Pi doesn’t work the same for both of them. For HDMI it is rather simple, because R Pi has native support for HDMI, and it can be done as explained here: However, R Pi doesn’t have native support for VGA and you have to turn couple other options that your HDMI-2-VGA adapter will understand, like explained here:, and also you need to use command: sudo tvservice -p && fbset -depth 8 && fbset -depth 16

      1. I am also having issues getting my monitor to wake back up and look normal. When using the command “sudo tvservice -p” monitor wakes but no image. When using “sudo tvservice -p && fbset -depth 8 && fbset -depth 16” the monitor wakes up and I see an image but resolution and colors are all messed up. I have a straight HDMI cable from PI to monitor and my monitor EDID is being reported as 1920 x 1080 @6oHz. Wondering if the fbset depth of 8 & 16 need to be different values based on my monitor’ resolution…but so far unsuccessful in figuring out. Any suggestions?

        Thanks in advance….

        1. Ended up figuring this out. Had to use the following for my
          #! /bin/bash
          sudo tvservice -p
          fbset -g 1920 1080 1920 1080 32

  7. Hi and thank you for that perfect instructions. Everything works fine up to now. I got two examples of different glas which I just testet. I also tested the PIR sensor behind the glas and it did not work. Without glas everything works perfekt, with the glas the PIR does not recognize the motion anymore… And when I look at your pictures, it looks like the PIR senses trough the glas. Is that correct? Did you do any “trick” that it works?
    Thank you for your answer.

    Best regards


    1. Hello Michael, thanks for writing. Nope, there was no trick, though I had some troubles with the PIR working behind the mirror in the beginning. I thought that glass IR absorption was too high so I tried to play with potentiometer to adjust sensitivity and pulse width. In the end I made it “satisfyingly” enough, though it does not respond very fast all the time. If you find some other solution, please keep me updated.

  8. Hello,

    where did you place the PIR-Sensor? I tried it myself and it doesn’t work behind the mirror.

    Best regards


    1. Hello Lars, thanks for writing. As I said to Michael just above, I had some troubles with the PIR working behind the mirror in the beginning. I thought that glass IR absorption was too high so I tried to play with potentiometer to adjust sensitivity and pulse width. In the end I made it “satisfyingly” enough, though it does not respond very fast all the time. If you find some other solution, please keep me updated.

  9. Added the motion detect based on this post. Thank you! I couldn’t get the PIR to work behind the glass, so I mounted it on top. Looks ok – also added the Alexa Voice service, so now I have a talking mirror. 🙂 I also played with replacing the news headlines on the bottom with family photos, but it was too dark to be practical. your mileage may vary.

  10. I plan on making this over summer. Would it be possible for your mobil to tell your mirror that you are in the house and to start the PI so it inly needs to power the screen using the PIR? I am thinking something like Tasker talking to your WIFI

    1. I wish you a lots of luck! I see no reason why not – there surely are some WiFi apps you can make that enable communication between your smartphone and R Pi, though I’m not familiar with them.

  11. Thank you for the blog entry. I am trying to add PIR to switch on/off the monitor. I have a PI1. Can you please show the connection details. which pin on PIR connects to which one on GPIO. and what ever the rest of hte steps are.

  12. Considering the discussion on the location of the PIR sensor above, it would be helpful if you could share the tickness and material (glass or acrylate) of your mirror. Considering the significant absorption of IR radiation, thinner is better and it will help others to get a PIR behind the mirror working. Many thanks in advance!

  13. Does this method turn the display signal on and off, such that it behaves in a similar manner as if you were unplugging and re-plugging the HDMI cable? Or does it alternate between displaying the mirror and displaying a black screen? My monitor displays “Check Signal Cable” when I unplug the HDMI cable, which wouldn’t be nice to look at while the mirror is “off”.

Leave a Reply to Jason Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s