Introduction: Arduino Fingerprint Door Lock (with Keypad and LCD)

Introduction

The Fingerprint door lock, as the name suggests, is an electronic door lock that can be installed on almost any access point in your house. It uses a keypad and fingerprint scanner to grant a user access by controlling an electric door strike with a relay. I started this project because I wanted to work with a keypad and fingerprint sensor as well as become more familiar working with LCD's, I also needed a way to lock my door from the outside so I thought an electronic door-lock would be a great opportunity to over-engineer something and learn some cool stuff :)

The basic operation of the device is as follows:

On power up the device displays a message on the LCD and a red status led lights up, indicating that the door is locked. The user then has the option of pressing a button for entering the password or for changing the password. To change the password the user would need to know the current/default password. If the password is input incorrectly then the display will show that the code was invalid and then revert to the default screen. When the code is entered correctly,the fingerprint scanner activates. If the scanner recognizes a fingerprint that has been enrolled then it will activate the relay and the a green status led for a few seconds, enough to open the door, enter and close it.

Hopefully this instructable will be easy enough to follow so that you can learn something and have a cool device to keep out minor intruders.

Step 1: Parts Bin

Below is the list of components I used for this project

Parts:

  • Atmega328p with arduino bootloader
  • Breadboard
  • 16x2 character LCD
  • ZFM-206SA Fingerprint sensor
  • 4x4 Matrix Keypad
  • ABS Plastic Box enclosure 180x120x55mm
  • LM7805 Voltage Regulator
  • FRS1-S Relay
  • SPDT switch
  • 22pF ceramic capacitor x4
  • 220 Ohm Resistor
  • 1K Resistor
  • 5V Voltage Regulator
  • Tactile pushbutton
  • 16Mhz crystal
  • 4.7K trim pot
  • Red LED
  • Green LED
  • Diode
  • NPN BJT (I used TO92 package)
  • Jumper wires
  • 10mm nylon stand-offs
  • M3x6 bolts and nuts
  • screw terminals
  • 16 pin Ribbon Cable
  • Female headers
  • foam board(optional)
  • Electric door strike kit(12V AC)
  • AA bateries x6
  • 6xAA battery holder

Installation parts(Optional)

  • PVC trunking 3mm
  • 2-wire electric cable
  • Silicone adhesive
  • Screws
  • fischer plugs

Tools:

  • Arduino Uno (used for programming)
  • Soldering/iron
  • Hot glue gun
  • Screwdrivers
  • Insulation Tape
  • Dremel or Rotary tool
  • Drill
  • Impact Drill(optional if drilling through a wall)
  • Perfboard

It's always good to have a decent supply of common components like resistors, capacitors, diodes etc. Keeping a good variety of these helps a lot when starting electronics projects. I also recommend having some experience in working with arduino before starting this project as it will make it much easier to deal with problems that may occur. If you're new to arduino you should still be able to do this project with a little extra effort.

Step 2: Circuit Schematic

The above figure contains the full breadboard schematic made with Fritzing. The schematic is based around an ATmega328p (The microcontroller used in the arduino Uno) with an arduino boot-loader. The breadboard version contains a minimal amount of components needed to run programs. Without the serial interface we cannot flash programs onto it from the PC instead the programming is done on the actual Uno board and the chip is then placed onto the breadboard.

I originally meant to use a barrel jack for power but removed it when it came to putting everything together. It's still there in the schematic. You may want to use one if you wish. Power is regulated from the batteries with a voltage regulator. As you can see in the schematic figure there are only a few components surrounding the ATmega chip. Most important is the 16 MHz crystal and the push-button, which is used for reset functionality. There are four main components to this design, the Keypad input, the fingerprint sensing, the LCD display and the relay output.

You may want to go ahead and assemble the whole schematic before testing the individual components or you may want to test and add components as you go along. The former is recommended if you intend to follow this instructable exactly as is.

Step 3: Testing the LCD and the Matrix Keypad

The official Arduino website contains well documented tutorials for using a matrix keypad and an LCD.There are also libraries available that make it easy to interface the components to the arduino. The Liquid-Crystal library is standard and should already be installed in the arduino IDE so you will just need to download and install the keypad library. Keypads are a bit tricky to read. You'll notice that a 4x4 keypad, which has 16 buttons, only has 8 pins. This is because the keypad is arranged into a matrix of 4 columns and 4 rows, thus matrix keypad (To be honest I didn't get it when I first started working with it). When a button is pressed then the row and column pins that correspond to that button are connected. You can test this by using the continuity setting on a multi-meter. How do you detect that on an arduino? I still not sure how it works but there is a library that handles that. That's one of the cons about using libraries, they make things easier to do but the abstraction means you don't really learn how it's done. The tutorials detailing how to use the LCD and Keypad with the arduino libraries can be found here:

http://playground.arduino.cc/Main/KeypadTutorial

https://www.arduino.cc/en/Tutorial/LiquidCrystalDi...

Follow the tutorials to make sure that your keypad and LCD are working correctly and don't forget to modify the example codes to match the pins used in the schematic. For the Keypad you may need to modify the code to use a 4x4 matrix.

Step 4: Configuring Fingerprint Sensor

The Fingerprint sensor that we're using is quite simple to setup. But before we can use it in this project, you first have to register the fingerprints that you want to use, on the sensor itself. Download and install the arduino library from Adafruit here:

https://github.com/adafruit/Adafruit-Fingerprint-S...

We're going to need the serial monitor for this part so you can wire the sensor directly as shown in the Fritzing diagram above. Run the enroll sketch from the examples and register all the fingerprints that you plan to use.

Step 5: The Door Strike and Relay Circuit

The door strike that I got requires a 12V AC signal to operate and came with a power adapter plug to be used with any mains socket supply. This poses a problem since the strike cannot be directly activated from an I/O pin on the arduino. To solve this we can use a general purpose NPN BJT transistor to drive a relay, which electrically isolates the main circuit from the door strike power supply. The circuit for this is included in the main schematic.

Step 6: Upload the Final Code

After you have made sure that all the components are working and that you have your fingerprints stored in the sensor, you can now program the full code onto the board. Just as before you upload the code using the arduino board then remove the chip from the board and plug it into the circuit. I've attached the full code in below. It may not be the cleanest code ever and I've tried to put in descriptive comments.

Once the code has been uploaded the red light should light up as well as the LCD screen and will display the default "Room 0" title. Pressing 'A' will trigger a prompt for the password which is "0000" by default. Once the code is entered correctly the lock will ask for a fingerprint. If you try using a finger that you didn't register nothing will happen but when you use a print that you did register three things are going to happen. First the LCD will identify the fingerprint ID that was found and show the confidence value for which it matched, second the green LED will turn on while the red LED turns off and finally the relay circuit will activate allowing the door lock supply voltage to flow through thus activating the strike and allowing entry. This active mode lasts for 5 seconds.

Pressing the 'B' while at the default screen will ask if you want to change the code. Press '*' to confirm and then once you enter the default code correctly it will allow you to change the code to a new four character password. This new password only lasts while the circuit is turned on. I'll try fixing that using EEPROM in a later version perhaps.

You can simply modify the code if you wish to change the default password or the activation time however you want.

Step 7: Assemble the Perfboard

Now that you've verified that all the components are working and you've also stored your desired fingerprints in the sensor, it's now time to put it all together on perfboard. This step involves quite a lot of soldering. The board layout is shown in the Fritzing diagram above which you can also download to check the connections. Take note of all the line breaks as well. It's not the most efficient design so feel free to design your own board or even make a PCB.

For the ATmega chip solder on the IC holder first and then insert the chip into the holder. It's good practice to do this with IC's since they are generally more sensitive to heat and can get damaged permanently.

Step 8: Assemble the Enclosure

For the box casing I drilled holes for the banana sockets at the top and the switch on the side. The board is attached to the case using 10mm nylon standoffs and M3 bolts.There should be space to drill on the corners of the board, then drill those corresponding holes in the casing. For power I managed to fit the 6xAA battery holder at the bottom where the power supply is. The screw terminal at the top is connected to wires soldered on the plug sockets. I also drilled and cut slots at the back so that I could hang it on screws on the wall. Your installation method may be different depending on where you plan to install.

Measure the dimensions of the LCD, keypad and sensor face and place mark out where you want to put them on the Lid. I used the Dremel to cut out the spaces. I also drilled holes for the LED's next to the LCD, I think I used a 3mm bit. I used hot glue to attach the keypad and the fingerprint sensor and LED's. I used some foam board that I had lying around but you may want to use whatever else you like just to cover the open space around there. The LCD I actually bolted to the case. I didn't want to use hot glue in case I decided to remove it and use it in another project. Bolts don't look to great on the cover so glue may be the better option.

The cable connectors also need to be assembled. This requires quite a bit of soldering. You need a 16 pin connector for the LCD and a 8 pin connector for the keypad. The latch pins are soldered and clipped onto the cable and then snap into the housings. The completed cables can be seen in step 1 and 2.

In hindsight I don't think I should have used such a big switch or put the sockets at the top since someone could just unplug them and just connect them manually to activate the door lock or flip the switch to reset the password. Although the purpose of this project is more for learning, I would go for a more rigid design and a diffferent material for some real security.

Step 9: Installation

I'm not going to detail everything I did regarding cable installation and door strike installation since I wouldn't be able to cover everyone's situation. Some may be working with a gate or wood etc.

I replaced the current door strike that I had with my new electric door strike. The kit that I bought came with a separate key slot piece that I put in as well. There was no way to access the terminals on the door strike once in was in so I put some small wires in them and drilled a hole in the door frame to pull them through.

Next I had to deliver power to the door strike. The closest plug that I could use was the one on top of my garage door motor. I put the door strike power supply there. I installed pvc trunking along the roof truss and along the wall to where the door lock device is going to be. I then drilled a hole in the wall through to the door lock device. The door strike kit also came with a switch button which I connected in parallel with the door lock so that you can easily open the door from inside. The cables were connected using PVC enclosed screw terminals or chocolate blocks as their called in some places. On the outside of the wall I drilled some holes inserted fischer plugs and screws that I used to hang up the box onto.

Comments

author
NIHARIKAM7 made it! (author)2017-03-25

can you tell me ... what is "menu" referring to in your code..

and why it is always equals to 1 , 3 and 4

whduiskwhd.PNG
author
JetLab (author)NIHARIKAM72017-05-03

Hi the "menu" variable controls the menu screen and the numbers represent the setting that you're in. To be honest I can't remember why I don't have a 2 (There was a reason). I probably should have been more descriptive though

author
Siddhaanth Iyer (author)2017-02-26

i am not getting a ZFM-206SA Fingerprint sensor. which other fingerprint sensor can i use?

author
JetLab (author)Siddhaanth Iyer2017-05-03

You could lookup the GT-511C1R although it has less storage capacity for ID's but worth a try

author
madrasi (author)2016-12-20

This is a great project and I would love to build it for my apartment but I am trying to teach myself how to do things like this so do you think a new-be to electronics be able to build this project? I would love to get into coding and I have been reading a lot on it this last year but still don't know if I could do it. My biggest problem on that is finding the right C++ program that is the essayist one to use. This would be a project that I do for fun and getting a little experience and would only be my loss if it don't work. Am I crazy or just stupid for thinking about doing this? lol Your honest opinion Please

author
JetLab (author)madrasi2017-01-03

Hey man I think having a project is a great way to learn something since you have a specific goal in mind and it motivates you to keep learning and working towards that goal. You'll definitely come across problems along the way but they are not worth worrying about so much that you don't even attempt anything. I'm sure you've come across a lot of great resources in you research however you will only know whether you can do it if you try and when you start inevitably succeeding your confidence will grow as well. As for this project, the resources are definitely there, you may need to learn some new skills but it can be done.

author
madrasi (author)JetLab2017-05-02

Thank you for your support. I am working on building this but all I have now is my phone because I have a hacker in my laptop and can't afford to pay to get him out of it. If I do get this built I will contact you and let you know. Thanks again for your support.

author
marsekal (author)2017-02-10

good job

author
TimothyR32 (author)2017-01-22

I'm trying to figure how to connect the door strike to the circuit. Help please?

author
amp99perry (author)2017-01-05

sorry please forgive me

author
JetLab (author)2017-01-03

This is my first ever instructable and my only one at this point in time. I have however entered this same instructable into more than one contest.

author
MagdyI1 (author)2016-12-24

its great project , can u upload the design of circuit ?

author
JetLab (author)MagdyI12017-01-03

You can check the fritzing diagram as well as download the fritzing file which contains the full circuit.

author
sahmada (author)2016-12-18

The cathode pin of D2 diode is not connected to anywhere. Please review the circuit and correct it. or let us know how it would be connected.

author
JetLab (author)sahmada2016-12-19

My bad, it's meant to be connected to the other side of the relay coil. I have fixed it now in the diagram.

author
sahmada (author)JetLab2016-12-19

Thanks man, I got it :)

author
nhatnamt (author)2016-12-19

Great project. But what specific electric door strike mode was yours, I can't seem to find one with a key

author
TheRealNapalm (author)2016-12-18

nice project. But I personally always think how I could get around such a security device. I your case you put every component outside. So I would break the case and power the door opener to open the door.

Don't you think for a minimum of security only the keyboard and the fingerprint reader should be outside and the rest behind the door?

On the Oder side, if the fingerprint is stored in the reader outside of the house someone could connect a notebook to the fingerprint reader or even exchange it with an own one and make the fingerprint reader tell your Arduino that everything is ok.

That's just my first thought ...

Still nice project. Regards.

author
JetLab (author)TheRealNapalm2016-12-19

Thanks man. You make some good points, I didn't think of separating just the inputs to the outside of the door. I have seen similar systems that would suffer from the "break the case" weakness in office environments so I guess it could still work in for some applications.

As for the fingerprint reader problem, I guess I'll just have to hope that the intruders aren't all that tech savvy.

But perhaps I'll see what kind of upgrades I can implement if I make version 2.

author
WannaDuino (author)2016-12-18

WannaDuino!!! Likes iT!!!

Verry good and amazing IBLE.

This is a great build for an inside door, in this state. Not to be used to realy secure your front door, at this time. But it can be. For sure.

But thats why we do INSTRUCTABLES isn't it? i really thinking to make it.

WannaDuino!!!

author
Suicid (author)2016-12-18

Hi dude, great project!

But i'd rather listen to the ppl said about housing. In such security systems I'd rather split HW in two parts - HW that control the lock (open-close) I'd put somewhere inside a house. Outside i'd keep the only devices which need for input (eg in your case display, kbd and fp sensor) and route cables inside.

It reduce probability of "brute force hacking", like TheRealNapalm said.

author
BongoM (author)2016-12-18

Man cool project! This is outside my skill level. Let me know if you decide to kickstarter this item - I'd pledge for a couple.

author
Swansong (author)2016-12-15

Great instructable, thanks for sharing!

author
JetLab (author)Swansong2016-12-16

Thanks!! Glad to share something that others might find interesting

About This Instructable

30,670views

497favorites

License:

Bio: I am an electronics hobbyist from Cape Town South Africa always interested in learning new skills and having fun doing it.
More by JetLab:Sensor Platform Robot With IR ControlArduino Fingerprint Door Lock (with Keypad and LCD)
Add instructable to: