Arduino Fingerprint Door Lock (with Keypad and LCD)
By JetLab in CircuitsGadgets
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 bootloader. 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.