Software apps and online services
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.
With the introduction of Microsoft's Project Oxford, 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!
How will you expand the project? What features will you add? Let us know in the comments section below!
- Set up your PC and Raspberry Pi 2 or 3, or MBM according to these instructions.
- Next, wire up the doorbell and power relay as shown below. The power relay will be used to lock and unlock the door.
- Now wire up the same power relay to the lock, or electric door strike, as shown below.
- Plug in your USB webcam, keyboard, and mouse into your Raspberry Pi 2 or MBM.
- Use Command Prompt to navigate to the folder where you want the project:
cd <your folder path>
- Run the git clone command to download the project:
git clone https://github.com/ms-iot/Facial-Recognition-Door.git
- Open the FacialRecognitionDoor.sln solution file, in the FacialRecognitionDoor folder you just downloaded, using Visual Studio 2015.
- 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.
- Replace OXFORD_KEY_HERE with your new key:
- ONLY FOR MINNOWBOARD MAX: Switch the DisableLiveCameraFeed variable from true to false:
- 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.
- 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.
- You can now run the code! Press the Remote Machine button with the green "play" arrow.
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.
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!