Close
0%
0%

A Door Lock with RFID and Alexa App Access

Door Lock which can be controlled using RFID tags and Mobile Application using REST API backend Developed on a Raspberry Pi zero(W)

Similar projects worth following
After Having 5 cups of coffee on a weekend while working and watching my mother run to the door every time to open the door for some one visiting us.The thought crossed my mind that what if she never had to run to the Door and she could just open the door with her mobile or when she goes out for some shopping and comes back what if she could just enter the home as we do in office with our RFID Access.

I thought of Making a Door Lock which could be operated using a Mobile Application, RFID key fobs and buttons too. Having no Experience with hardware i looked up the internet how to do that and found this hardware called as Raspberry Pi got them ordered and started working on it and after 2 months after a lot of hickups by amazon and my busy work schedule i have the lock ready which works but still needs some work to make it perfect!
The Circuit Diagram and Code is available in this Article. The code is available on GitHub

1. Bring up the Raspberry Pi with Raspbian OS

2.Change the ssh password from default for Security Reasons.

3. Do a apt-get update

4. Install Flask for python follow the Below Link


https://www.jeremymorgan.com/tutorials/python-tutorials/how-to-rest-api-python/

5. Install the MFRC522 Drivers and libraries you can follow the below Link

http://www.instructables.com/id/Raspberry-Pi-3-Model-B-MIFARE-RC522-RFID-Tag-Readi/

6. Create the Circuit using the Circuit Diagram attached and the wiring instructions in the Build Section.

7. Make a Acrylic Box for the lock.

8. Download the software using github link in this project.

Door_Lock_Pi_bb.jpg

JPEG Image - 953.86 kB - 09/16/2017 at 22:46

Preview

  • 1 × Raspberry Pi Zero (W)
  • 1 × Servo Motor MGR996
  • 1 × MFRC522 RFID Reader
  • 2 × Push Buttons
  • 20 × Jumper Cables for Connections

View all 10 components

  • Access Log of RFID

    sujay200210/16/2017 at 08:16 0 comments

    Detected
    Card read UID: 82,101,194,16,229
    [82, 101, 194, 16, 229]
    White Card
    The Door is Locked!

    The Door is Locked!

    Detected
    Card read UID: 82,101,194,16,229
    [82, 101, 194, 16, 229]
    White Card
    Entering from App or Reader:The Door is Unlocked!

  • Access log of Rest API Access

    sujay200210/16/2017 at 08:16 0 comments

    Logs from the Access console when the Device is Access by mobile App

    192.168.86.20 - - [14/Oct/2017 22:53:59] "GET /unlockme HTTP/1.1" 200 -
    The Door is Locked!

    The Door is Locked!

    192.168.86.20 - - [14/Oct/2017 22:54:03] "GET /lockme HTTP/1.1" 200 -
    The Door is Locked!

    The Door is Locked!

    192.168.86.20 - - [14/Oct/2017 22:54:06] "GET /lockme HTTP/1.1" 200 -
    The Door is Locked!

    The Door is Locked!

    192.168.86.20 - - [14/Oct/2017 22:54:10] "GET /lockme HTTP/1.1" 200 -
    The Door is Unlocked!

View all 2 project logs

  • 1
    Based on the Description Below Create the Wiring Connections for the Raspberry Pi and components

    BOARD Mode Configuration for the Raspberry Pi

    RFID RC522

    GPIO  ---------> PIN Type in RC522 & Color

    24                    SDA-Green

    23                    SCK-Blue

    19                     MOS- Violet

    21                     IMI - Gray

    25                    GND- Black

    22                    RST- Brown

    17                     3.3V -Red

    Buttons

    GPIO               Switch PIN

    11                      Switch 1 (+) Jumped with 5V of GPIO 4 Rpi

    13                     Switch 2(+) Jumped with 5V of GPIO 4 Rpi

    14                     GND Jumped to both the switch (-)

    Servo 

    GPIO               Servo PINS

    16                    Servo Yellow Cable for Signal

    2                     Servo Red Cable (5V)

    6                     Servo Ground Brown Cable

  • 2
    Use a Raspberry UPS HAT for Power backup

    <TBD> Images will be attached.

  • 3
    Build a Acrylic Case and Lock Engager Based on the Physical Lock you have at home

    Since i wanted the lock to be customisable and not dependent on any specific lock hardware

    I created a generic Acrylic Base but the lock Engager and position of the Servo is dependent on the type of Lock you are using at home. will give some guidelines to build that below

View all 3 instructions

Enjoy this project?

Share

Discussions

rikieriyanbastomi wrote 05/29/2018 at 13:44 point

hey i want to use this project for my final task at my college, but the github link isn´t available :( could you give me the link? thank you!

  Are you sure? yes | no

Rolf Junior wrote 03/01/2018 at 11:20 point

Hey Sujay, I have narrowed my problems down. Everything works as expected. The only problem is that it doesn't start up at boot.

I can start the process by manually executing the start_lock.sh or the locker.py script. 

I believe the problem is at the lock file located at /etc/init.d. I gave the lock file executable permission and I also gave  the "update-rc.d lock defaults" command.

I have tried everything and I can't make it autostart.

Can you please give me some HELP? 

  Are you sure? yes | no

sujay2002 wrote 03/02/2018 at 19:17 point

You can also try crontab -e Add the start_lock.sh inside crontab 

put the line "@reboot /bin/sh /home/pi/start_lock.sh"

  Are you sure? yes | no

Rolf Junior wrote 03/02/2018 at 20:18 point

OMG thank you so much! That made it work. I was about to go crazy!

Really, thank you!

  Are you sure? yes | no

Rolf Junior wrote 10/25/2017 at 20:57 point

Hello! I'm trying to do the same project, but I can't make it work. Can you improve the instructions?

  Are you sure? yes | no

sujay2002 wrote 10/26/2017 at 08:28 point

could you be a little more specific what is not working then i can add more information for that area.

  Are you sure? yes | no

Rolf Junior wrote 10/27/2017 at 00:38 point

My RFID board is a PN532, maybe that is the problem. I can't make my raspberry read a NFC tag...

  Are you sure? yes | no

Rolf Junior wrote 09/28/2017 at 12:22 point

That is brilliant! Very good! Congratulations!

  Are you sure? yes | no

sujay2002 wrote 09/29/2017 at 05:38 point

Thanks for your appriciation!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates