Raspberry Pi



Motion Detect with calendar

Use a motion detector to switch on your monitor on certain allowed time periods


In this tutorial I will show how you can use a motion detector (Passive Infra Red, PIR) to manage when your HDMI or DVI powered monitor is switched on.


The goal is to save power! If you have e.g. a MagicMirror ( it is useless to have it powered on all the time. Therefore we will use a motion detector to check if someone is in the same room to power on the monitor for a short time (e.g. 5 minutes).


GPIO users and MagicMirror fans


In order to complete this tutorial you will need:

  • a working Raspberry Pi (RPI)
  • a monitor connected to the HDMI output of the RPI (either directly via HDMI or DVI).
  • a Passive Infra Red sensor (Wikipedia, Adafruit, Manual)
  • 3 cables to connect (e.g. Dupont jumper cables) the RaspberryPi to the PIR

Optionally you can use a breadboard in order to simplify things. But because you only need three cables this is not neccessary. 

Required knowledge

In order to complete this tutorial you will need to have some basic knowledge of 

  • Linux shell usage (Bash)
  • Python programming
  • knowledge of the GPIO connector on the RPI


Required tools

In order to complete this tutorial you will need the following tools and/or software:

  • a text file editor like Leafpad or a Python editor like Thonny Python IDE (chances are this is already installed on your Pi. Have a look at your menu (Programming) )
  • access to your Pi (either via keyboard/mouse,  VNC or terminal)


Tutorial lessons

This tutorial exists of a number of lessons which must be followed in order to reach the desired effect. Please review each step by clicking on the title

1 - The basics

2 - Testing the monitor

3 - Connecting and testing the PIR

4 - The Python scripts

5 - Bringing it all together