Facial Recognition Security System

Summary

Someone at the university asked for advice on a low cost, “smart” security system. He wanted to monitor people entering his dorm room but he didn’t want a lot of false alarms since his roommate and friends were often in and out of his room when he wasn’t there. The solution – use facial recognition to distinguish between people who are authorized to be there and those who are not. If the person is recognized by the security system, he or she is welcomed into the room; if the person isn’t recognized, a photo of the intruder is stored in the system for the room owner to review when he returns.facial recognition security system

For this project, I wrote an Universal Windows Platform (UWP) application in C# which runs on Windows 10 IoT Core on a Raspberry Pi 3. I connected a Passive Infrared (PIR) motion sensor to detect when someone enters the room. I included a speech synthesizer and added a speaker to announce that a person has been detected. The attached webcam captures an image of the person and sends it to Microsoft Cognitive Services running on Azure for analysis.

This project was a good introduction to facial recognition and the Microsoft Cognitive Service’s Face API made it easier than expected – especially when using their open source SDK. I also resused a lot of the Facial Recognition Door Lock project created by the Windows IoT Team.

Prerequisites

  • You’ll need to have Windows 10 (version 10.0.10240 or better) running on your development machine.
  • You’ll need the Windows 10 IoT Core Dashboard on your development machine.
  • You’ll need to image an SD card with Windows 10 IoT Core – minimum supported OS version for this project is build 10.0.14295.
  • You’ll need Visual Studio 2015 Update 2.

Installing all the prerequisites could take up to an hour or so but most of that time is unattended while the bits download and get installed so plan accordingly. Microsoft has documented the setup process well in a step-by-step guide.

With respect to Visual Studio 2015 Update 2, you may need to customize your installation (if you are installing it for the first time) or modify your existing installation to ensure that you have the most recent version of the Window 10 SDK installed – the Windows 10 SDK is not installed by default in the the Community Edition and it is required for this project (I believe it is installed by default in the Professional and Enterprise editions).

To verify that you completed the setup process correctly use the Windows 10 IoT Core Dashboard; the Dashboard will discover the Pi once Windows 10 IoT Core has booted and connected to the network (you can plug a network cable between the Pi and your network’s router or directly into your development machine’s Ethernet port if you turn on Internet connection sharing).

Use the device portal to configure WiFi. To open the device portal, go to the ‘My Devices’ tab in the Windows 10 IoT Core Dashboard and click on the globe under the ‘Open in Device Portal column’. You’ll be prompted to enter the credentials for the device – “administrator” and “p@ssw0rd” by default. Go the Networking page to setup WiFi.

Components

The following components are required for this project. In the United States, total component costs are less than $75.

  • Raspberry Pi 3 (this project works equally well on the Raspberry Pi 2 but you would then need a separate WiFi dongle if you want to go wireless) (you could also use an Intel MinnowBoard Max or a Qualcomm DragonBoard 410c).
  • Passive Infrared Motion Sensor
  • Supported webcam (I used the Microsoft LifeCam HD-3000 but others are support as well; check the list here)
  • Speaker (plug the speaker’s 3.5mm audio jack directly into theRaspberry Pi; I’d recommend powering the speak separately)
  • Jumper wires

Instructions – Follow these steps

Step 1 – Wire Up the Security System

Time – 5 minutes

The security system is comprised of a PIR sensor, speaker, and webcam connected to a Raspberry Pi 3. The PIR sensor will detect when someone enters your room. The speaker plays the text to speech messages. And, the webcam will capture an image which will be processed by the facial recognition service.

First, connect the PIR motion sensor’s pins to the Raspberry Pi using jumper wires – 5V on the sensor to 5V PWR on the Pi (I used pin 2), GND on the sensor to GND on the Pi (I used pin 6), and signal on the sensor to a GPIO pin on the Pi (I used pin 29 / GPIO 5). Double check the data sheet for your sensor to make sure you correctly identify the sensor’s 5V, GND, and signal pin as their order varies by manufacturer. (I bent the pins on a female header so that I could mount the sensor upright on the mini breadboard.)schematic facial recognition security system

My PIR sensor operates at 5 volts which is why it’s power pin needs to be connected to a 5V power pin on the Pi. But, it’s signal pin operates at only 3.3V which is why it can be connected directly to a GPIO pin. Again, double check the data sheet for your sensor to ensure that the signal’s voltage is 3.3V. If it’s 5V, you’ll have to divide the voltage before connecting it to the Raspberry Pi’s GPIO pin.

For more detail: Facial Recognition Security System


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *