Abellcadabra (Face Recognition Door Lock System)

Introduction: Abellcadabra (Face Recognition Door Lock System)

About: I love watching people make things

Laying around during the quarantine, I tried to find a way to kill the time by building face recognition for house door. I named it Abellcadabra - which is combination between Abracadabra, a magic phrase with doorbell which i only take the bell. LOL

Anyway, this system will perform face recognition by using Amazon Rekognition when user push the doorbell. Rekognition going to compare the image captured with a collection of images in Amazon S3. If the recognition is successful, the door will be opened. If it is not successful, the buzzer will sound and user can have option to unlock using RFID token. There is also a button on the inside of the house where the house owner can unlock the door by pushing it.

All recognitions and unlock performed will be stored in Amazon DynamoDB. I will try to explain step by step to build the whole system. I am using the materials that I already have because it took a long time to get anything else so this is it.

Step 1: Materials & Tools

Material:

  • Raspberry Pi
  • Pi Camera
  • RC servo (will act as door lock)
  • Switch button 2x
  • Buzzer
  • Magnetic switch
  • RC-522 RFID Reader and tag
  • MF, MM , FF breadboard wires
  • Polystrene Ice Box - any size would be ok because this will be our door.
  • 1.5 inch hinge 2x
  • 2.5 mm screw 4x

Tools

  • Screwdriver
  • Double sided tape

Step 2: Setting Up Amazon Web Services

Amazon Web Services is easy to use and is free until you reach 5000 API calls per month. You can register for AWS account here here . You will need to sign up for a free tier amazon Rekognition account. The free tier should be more than sufficient for this project.

After the sign up is successful, click Services > IAM. From here, we will create a user which will have permissions to be used by Raspberry Pi.

  1. Click Users > Add New User
  2. Give name to user created. For Access type check Programmatic access box.
  3. Click Next.
  4. Click on Attach existing policies directly. Check the following policies:

  • AWSLambdaFullAccess
  • AmazonS3FullAccess
  • AmazonDynamoDBFullAccess
  • AmazonRekognitionFullAccess
  • AdministratorAccess

  1. Click Next and Next again because we don't need to add tag.
  2. Check whether the policies chosen is the same as listed then click Create User.

Download the CSV file which contains Access key ID and Secret access key which will be used in coming step. Click Close.

Step 3: Configure Amazon S3 and Amazon DynamoDB

On AWS Console, click Services > S3

S3 works just like Google Drive where you can store documents and images. For this project, we are going to need two Buckets which one is to store a collection of images to be used by Amazon Rekognition (and the second one is to store the captured image.

  1. Click Create Bucket.
  2. Enter bucket name and click Next and Next again.
  3. Untick the "Block all public access"box.
  4. And tick "I acknowledge that the current settings may result in this bucket and the objects within becoming public " box.
  5. Click Next and Create Bucket.
  6. Repeat the step for the second bucket.
  7. click Services > DynamoDB

Amazon DynamoDB will be used in this project to store the recognition and unlock details. the details that will be stored is link to image captured, name of the image recognized or if not recognized the name will be stored as 'unknown', date and time of recognition and the status whether it is successful, no faces matched, no faces detected, RFID unlock or unlocked from inside.

  1. Click Add New Table.
  2. Insert any name for the table.
  3. For primary key, insert 'rid' as primary key.
  4. Click Create.

Step 4: Configure AWS on Raspberry Pi

The first step is to enter your AWS credentials. To do this type in the console of Raspberry Pi:

aws configure

Then enter your AWS IAM credentials that you have created making sure you enter “us-west-2” as your region (or the relevant region that you have setup for AWS Rekognition). Leave the default output format blank.

Step 5: Connect the Items to Raspberry Pi

So the connections of the items are as below.

  • RC Servo - 1, 11, Ground
  • Magnetic Switch - 8, Ground
  • Buzzer - 32, Ground
  • Outside button - 16, Ground
  • Inside Button - 18, Ground
  • SDA pin on RFID Reader - 24
  • SCK pin on RFID Reader - 23
  • MOSI pin on RFID Reader - 19
  • MISO pin on RFID Reader - 21
  • GND pin on RFID Reader - Ground
  • RST pin on RFID Reader - 22
  • 3.3 V pin on RFID Reader - 17

Please connect to the nearest ground.

Step 6: Codes

You can find all the code necessary in my Git repository.

For the steps on how to add faces and use Index Faces.py please check this video .

Step 7: Building the Prototype

As I didn't take any picture during my build, I will just leave the picture of my finished prototype.

The prototype is built to portray a door. The view from shows the view of the door from the outside of the house. Pi Camera was installed to average human eye line height to ensure the image captured will contain face to be recognized. The doorbell button which will activate the Pi Camera to capture image is placed below the Pi Camera. RFID Reader is also placed on the door for the user at the door to unlock the door using RFID tag in case the recognition failed.

The red button is the Inside Button which will be used to unlock the door from inside of the house. Raspberry Pi is placed on the inside of the house so the people from the outside cannot tamper with it. RC Servo is placed on the right side of the door as the lock of the door. Buzzer is placed on the inside of the house to ensure the sound of buzzer can be heard from people inside of the house when it rang. Magnetic switch is placed in between the door and the framework.

Step 8: Testing the Prototype

Run the code on the terminal

sudo python3 filename.py

Just pushed the yellow button on the outside of the house and this photo is captured.

Check your Amazon DynamoDB to check the table is updated and S3 buckets to see that the captured image is stored.

Step 9: Closing

If you decide to make this project yourself, let me know in the comments (:

Thanks for reading.

Be the First to Share

    Recommendations

    • Rocks, Gems, and Stones Speed Challenge

      Rocks, Gems, and Stones Speed Challenge
    • Plastic Challenge

      Plastic Challenge
    • Micro:bit Contest

      Micro:bit Contest

    Comments