Facial Recognition Door

by Mahir Asrani in Circuits > Raspberry Pi

30 Views, 0 Favorites, 0 Comments

Facial Recognition Door

facialrecognitiondoor-snapshot.jpg

Home security systems are a growing field of projects for Makers. A self-built system is not only less expensive than a bulky professional installation, but it also allows for total control and customization to suit your needs.

Facial recognition applications are now more accessible to makers than ever before. This project utilizes a Raspberry Pi, basic Webcam, and an internet connection to create a door that unlocks itself via facial recognition. If the visitor at the door is recognized, the door will unlock!

Initial Setup

Minnowboard Max Sketch Image.jpg
InkedRaspberry Pi Sketch_LI.jpg
DoorStrikeDiagramCrop.jpg
Power Relay Image.jpg
DoorStrikeImage.jpg

1. Set up your PC and Raspberry Pi 2 or MBM according to these instructions.

2. Next, wire up the doorbell and power relay as shown below. The power relay will be used to lock and unlock the door.

3. Now wire up the same power relay to the lock, or electric door strike, as shown below.

4. Plug in your USB webcam, keyboard, and mouse into your Raspberry Pi 2 or MBM.

Software Setup

ConstantsAPIKeyScreenshot.jpg
Facial-Recognition-Door_Constants_cs_at_develop_·_ethankusters_Facial-Recognition-Door.jpg
cs-remote-machine-debugging.jpg
cs-remote-connections.jpg

1. Use Command Prompt to navigate to the folder where you want the project:

2. Run the git clone command to download the project: git clone

https://github.com/ms-iot/Facial-Recognition-Door

3. Open the FacialRecognitionDoor.sln solution file, in the FacialRecognitionDoor folder you just downloaded, using Visual Studio 2015.

4. On the right panel, under the "FacialRecognitionDoor" project, navigate to the Constants.cs file. You should see a section at the top entitled "General Constants". The first thing you need to do here is enter your Oxford API key. Follow the instructions here to acquire your key.

5. Replace OXFORD_KEY_HERE with your new key:

6. ONLY FOR MINNOWBOARD MAX: Switch the DisableLiveCameraFeed variable from true to false:

7. On the top menu of Visual Studio, select Debug and ARM if you are using a Raspberry Pi. If you're using an MBM, select Debug and x86.

8. The MBM configuration is shown here. Raspberry Pi users should select ARM instead of x86.

9. Press Remote Machine. In the "Remote Connections" dialog you will have to enter your Remote Machine IP address and use "Universal (Unencrypted Protocol)" for Authentication Mode.
Use WindowsIoTCoreWatcher to find your IP address.

For more information on how to deploy your application on a Windows IoT device, please see this documentation.

10. You can now run the code! Press the Remote Machine button with the green "play" arrow.

Software Use

SecondScreenAnnotated.jpg
ThirdScreenAnnotation.jpg
FourthScreenAnnotated.jpg
SixthScreenAnnotated.jpg
FourthScreenAnnotatedNew.jpg

The following screenshots were taken on a PC that was set up to act as a Raspberry Pi would.

When you first run the project, this is the screen you should see. On an MBM you would have set the DisableLiveCameraFeed variable to false in step 6 of Software Setup and instead of seeing the camera icon, you would see a live feed of what the camera is seeing.

Click the "plus" icon.

There are three buttons located on the bottom app bar. The first is a "plus" icon. This is used to add a new user to your "whitelist." Any user on the whitelist is essentially marked as a "friend" and allowed to unlock the door using their face. Try pressing the "plus" button now. You should see this screen:

Position yourself or a friend in front of the webcam and press the Capture ID Photo button. You should see this screen with your newly captured selfie:

If you're happy with the photo, enter the name of the person in the photo and press Confirm. If not, just press Cancel and take another photo.

After pressing Confirm, you will be sent back to the main page, but you will now see a user under the Whitelisted Visitors section:

Click on that user's image in the upper-left corner of the page to navigate to that user's profile page:

On this page, you can use the plus icon to add more photos as we have done. This will improve the overall accuracy of the facial recognition door. You can also press the trashcan icon to delete this user. When you're finished, press the home icon.

You're now ready to unlock the door! Position the registered user in front of the webcam and press either the virtual door icon (located next to the previously used plus icon) or the physical "doorbell" button you wired up. You should hear audio feedback informing you that the door has been unlocked!

Now try pressing the doorbell button when an unregistered user is in front of the door. You should hear audio feedback informing you that the door has detected a stranger and will not unlock!

SCHEMATICS

Raspberry Pi Fritzing Sketch

Download

Minnowboard Max Fritzing Sketch

Download

Facial Recognition Door Source Code

Download