Introduction: Facial Recognition Door

About: Hey! i am High school student studying and like to make new things and do inventions

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!

Step 1: Initial Setup

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.

Step 2: Software Setup

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.

Step 3: Software Use

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!

Step 4: SCHEMATICS

Raspberry Pi Fritzing Sketch

Download

Minnowboard Max Fritzing Sketch

Download

Facial Recognition Door Source Code

Download