Door Alert

The basics:

The goal of this project was to create a system which would alert Tech Lab staff in the space whenever a visitor entered the area. The system would have two main components to alert us: a visual one around the space, and an audiovisual one coming from the computers.

I separated the project into several modular sections. The first is a script which detects when a visitor enters the space and launches the systems. The second is a program which starts on each computer and when it receives an alert from the first section, flashes the alert and noise on the computer. Finally a third system would activate lights around the space.

The first and last sections were implemented on a Raspberry Pi as it would allow easy interactions between the physical and the digital, while also running autonomously from the other computers in the space, making it less sensitive to new equipment.

To create the visitor detection system, I modified the code from pyimagesearch’s instructions on motion detection using a Pi, Python, and OpenCV. I use OpenCV to take a baseline image (which is the average of 6 images) and compare the current image to the baseline. Any difference gets analyzed and, should the difference be great enough, gets marked as somebody being in the space. This increases a counter and if the next 2 frames also have someone in it, it launches an alert. It then keeps increasing the counter so that another alert won’t be sent out until the space is clear again.

The alert sends a message using TCP to the computers in the space to have them flash an alert on screen. It also sends an electrical signal through one of its GPIO ports to a relay which activates the lights.

Project in action:

 

  • On Github: here
  • Date: October 2016
  • Lead Tech: Benjamin Kasavan
  • Tech Used: Raspberry Pi