0% found this document useful (0 votes)
36 views21 pages

Biometric Security Box

sesnor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views21 pages

Biometric Security Box

sesnor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Biometric Lock Box

Created by Bill Earl


Guide Contents

Guide Contents 2
Overview 4
Parts and Preparation 5
Remove lining from Lid 6
Lay out components 6
Measure and mark cutouts 6
Cut the cable slot 7
Drill the holes 7
Cut a false lid 7
Circuitry 9
The Microcontroller 9
The Circuit 9
Pre-Assembly 10
Install the keypad and switch 10
Install Circuitry 10
Fit the false lid 11
Cover the false lid 11
Install the false lid and solenoid 11
Program and Test 13
Download Fingerprint and Keypad Libraries 13
Enroll Fingers 13
Load code 13
Test the Latch Operation 13
Final Assembly 18
Make the strike. 18
Temporarily install the strike 18
Test latch operation 19
Rivet the strike 19
Use It! 20
Turn it on 20

© Adafruit Industries http://learn.adafruit.com/biometric-security-box Page 2 of 21


Enter the passcode 20
Scan your fingerprint 21

© Adafruit Industries http://learn.adafruit.com/biometric-security-box Page 3 of 21


Overview

The Biometric Security Box uses the Adafruit Fingerprint Sensor as well as a numeric pass-code
and a mechanical key-lock to provide triple-security. This tutorial is based on a 4x6 card file
box, but can be easily adapted to larger lock-boxes – or even a full-size door!

© Adafruit Industries http://learn.adafruit.com/biometric-security-box Page 4 of 21


Parts and Preparation

Materials:

Lock Box - This tutorial uses a "Vaultz" 4x6" card file box. But it can be adapted to fit other
sizes or brands.
Adafruit Menta (http://adafru.it/795) - or other Arduino compatible microcontroller.
Fingerprint Sensor (http://adafru.it/751)
Membrane Keypad (http://adafru.it/419)
Lighted Switch (http://adafru.it/482)
12v power adapter (http://adafru.it/798)
Panel mount power jack (http://adafru.it/610)
MOSFET (http://adafru.it/355)
Diode (http://adafru.it/755)
Small push-pull solenoid (http://adafru.it/412)
Brass Strip - 1/2" x .032"
Pop Rivets - 1/4"
Wire (http://adafru.it/aM5)
Header strip (http://adafru.it/392)
Heat-shrink tubing (http://adafru.it/344)
Wood
Cardboard
Adhesive Felt
Misc tape, screws, cable ties as needed.

© Adafruit Industries http://learn.adafruit.com/biometric-security-box Page 5 of 21


Remove lining from Lid
Carefully peel the fabric lining from the
inside of the box lid. You can discard the
lining.

Lay out components


Arrange the major components in the lid
and mark their positions. Be sure to
leave room for wiring and spacers to
support the false lid.

Measure and mark cutouts


Mark the cutouts for the fingerprint
sensor, power switch and keypad cable
on the top of the lid. Also mark the
position for the power jack on the back
of the box.

© Adafruit Industries http://learn.adafruit.com/biometric-security-box Page 6 of 21


Cut the cable slot
Use an X-Acto or utility knife to cut a
rectangular slot for the keypad cable.

Drill the holes


Drill holes for fingerprint sensor, power
switch and power jack.

Cut a false lid


We will use a false lid to hide the circuitry
inside the lid of the box. Cut a piece of
1/8" (3mm) plywood or hardboard to fit
the inside of the lid. Also cut some 0.85"
(22mm) spacer blocks to go under the
false lid.

© Adafruit Industries http://learn.adafruit.com/biometric-security-box Page 7 of 21


© Adafruit Industries http://learn.adafruit.com/biometric-security-box Page 8 of 21
Circuitry

The Microcontroller
The box in the photographs uses a Menta (http://adafru.it/795) without the mint tin (i.e.
a demented Menta). However, the code and circuitry will also work with an
UNO (http://adafru.it/50), Boarduino (http://adafru.it/72) or any other Arduino compatible
microcontroller. If you are using the Menta or Boarduino, first build it according to the
appropriate tutorial.

The Circuit
Connect the components as shown in the diagram below.

If you are using a Menta, the pin locations are the same as for the UNO in the diagram, you can
mount the MOSFET and Diode and a header for the keypad connector in the prototyping area.

If you are using a Boarduino, be aware that the pin locations will be different from the diagram.

© Adafruit Industries http://learn.adafruit.com/biometric-security-box Page 9 of 21


Pre-Assembly

Install the keypad and switch


If the adhesive on the keypad does not
stick well to the textured box surface,
you can fix the corners down with small
screws or nylon snap-rivets.

Install Circuitry
Position components inside the lid and
glue spacer blocks around them.
Use foam tape to hold the fingerprint
sensor in place.
Place extra spacer blocks in the
center under the solenoid location.
Use tape and/or cable ties to hold
wires in place.

© Adafruit Industries http://learn.adafruit.com/biometric-security-box Page 10 of 21


Fit the false lid
Make cutouts for the power cable, FTDI
header and clearance for the switch.

Note: A smaller switch would fit better


in a box this size, but these metal
lighted switches look SO awesome we
couldn't resist!

Cover the false lid


Apply adhesive felt to the false lid. Cut
flaps around the FTDI header access
and the switch and leave a cutout for the
solenoid footprint.

Install the false lid and


solenoid

Postion the solenoid with the tip of the


shaft just even with the inner edge of the
box lid.

Use wood screws to fasten the solenoid.


Make sure they are long enough to go
through the false lid and fasten securely
to the space blocks underneath.

© Adafruit Industries http://learn.adafruit.com/biometric-security-box Page 11 of 21


© Adafruit Industries http://learn.adafruit.com/biometric-security-box Page 12 of 21
Program and Test

Download Fingerprint and Keypad Libraries

Download the Adafruit Fingerprint Sensor Library (http://adafru.it/aRz) and install it according
to the instructions in readme.txt.
Download the Keypad Library and install according to the instructions
here (http://adafru.it/aUO).

Enroll Fingers

Load the "enroll" example into the Arduino IDE.


Change the mySerial pin definitions to: "SoftwareSerial mySerial(13, 12);"
Follow the tutorial for enrolling fingerprints (http://adafru.it/aUP).

Load code
Load the Biometric Box sketch at the bottom of this page.
Edit the "secretCode" string to define your passcode.
Compile and upload the sketch.

Test the Latch Operation


Power on the box - the led on the power switch should flash a few times, then start
to 'breathe'.
Enter your passcode - the fingerprint sensor should turn on and glow red.
Place your finger on the sensor and you should hear the solenoid click.

/***************************************************
Biometric Box Sketch for the optical Fingerprint sensor
This sketch implements a two-level security scheme requiring the
user to enter a passcode via the keypad before scanning a fingerprint
for access.

Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

Written by Bill Earl for Adafruit Industries.


BSD license, all text above must be included in any redistribution
****************************************************/

© Adafruit Industries http://learn.adafruit.com/biometric-security-box Page 13 of 21


****************************************************/
#include <Keypad.h>
#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>

// Define the states for the lock state machine


#define LOCKED 2
#define PASSWORD_OK 1
#define UNLOCKED 0

// State Variables: Initialize to the locked state


int LockState = LOCKED;
long StartTime = 0;
int position = 0;

// Define your password key sequence here


char* secretCode = "1423";

// Keypad key matrix:


const byte rows = 4;
const byte cols = 3;
char keys[rows][cols] =
{
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};

// Keypad pin definitions


byte rowPins[rows] = {2, 3, 4, 5};
byte colPins[cols] = {6, 7, 8};

// Instantiate the keypad


Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, rows, cols);

// More pin definitions:


int LedPin = 10;
int SolenoidPin = 11;

// Define a Fingerprint sensor on pins 12 & 13


int getFingerprintIDez();
SoftwareSerial mySerial(13, 12);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void setup()
{
pinMode(LedPin, OUTPUT);
pinMode(SolenoidPin, OUTPUT);

// Flash hello
for (int i = 0; i < 3; i++)
{
digitalWrite(LedPin, HIGH);
delay(100);
digitalWrite(LedPin, LOW);
delay(100);
}

© Adafruit Industries http://learn.adafruit.com/biometric-security-box Page 14 of 21


}

// Initialize state and communicatins


setLockState(LOCKED);
Serial.begin(9600);
finger.begin(57600);

// Connect to the sensor


if (finger.verifyPassword())
{
Serial.println("Found fingerprint sensor!");
}
else
{
Serial.println("Did not find fingerprint sensor :(");
while (1);
}
}

void loop()
{
// Run the state machine:

// Locked State - Monitor keypad for valid Password code entry


if (LockState == LOCKED)
{
char key = keypad.getKey();

if (key == '*' || key == '#')


{
position = 0;
setLockState(LOCKED);
}
if (key != 0)
{
if (key == secretCode[position]) // Valid key in Password sequence
{
Serial.print("Matched ");
Serial.print(key);
Serial.print("-at-");
Serial.println(position);
position ++;
}
else // Invalid key - start all over again
{
Serial.println("Invalid Code!");
position = 0;
}
}

// Let the LED 'breathe' while we wait


analogWrite(LedPin, sin((millis() % 3142) / 1000.0) * 255);

if (position == 4) // Password successfully entered - advance state


{
setLockState(PASSWORD_OK);
position = 0;
}

© Adafruit Industries http://learn.adafruit.com/biometric-security-box Page 15 of 21


}
delay(100);
}

// PASSWORD_OK state - Now wait for a valid fingerprint reading


else if (LockState == PASSWORD_OK)
{
if (getFingerprintIDez() != -1)
{
setLockState(UNLOCKED); // Valid fingerprint - advance state to UNLOCKED
}
if (millis () - StartTime > 5000)
{
setLockState (LOCKED); // Time-out - go back to the LOCKED state
}
}

// UNLOCKED state - hold the solenoid open for a limited time


else if (LockState == UNLOCKED)
{
for (int i = 0; i < 30; i++)
{
// Flash the led to indicate the lock is open
digitalWrite(LedPin, LOW);
delay(50);
digitalWrite(LedPin, HIGH);
delay(50);
}
setLockState (LOCKED); // Time-out - go back to the locked state.
}
}

// returns -1 if failed, otherwise returns ID #


int getFingerprintIDez()
{
uint8_t p = finger.getImage();
if (p != FINGERPRINT_OK) return -1;

p = finger.image2Tz();
if (p != FINGERPRINT_OK) return -1;

p = finger.fingerFastSearch();
if (p != FINGERPRINT_OK) return -1;

// found a match!
Serial.print("Found ID #"); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);
return finger.fingerID;
}

// Set the state and the time of the state change


void setLockState(int state)
{
LockState = state;
StartTime = millis ();
if (state == LOCKED)

© Adafruit Industries http://learn.adafruit.com/biometric-security-box Page 16 of 21


if (state == LOCKED)
{
Serial.println("Locked!");
digitalWrite(LedPin, HIGH);
digitalWrite(SolenoidPin, LOW);
}

else if (state == PASSWORD_OK)


{
Serial.println("PASSWORD_OK!");
digitalWrite(LedPin, LOW);
}
else if (state == UNLOCKED)
{
Serial.println("Unlocked!");
digitalWrite(LedPin, LOW);
digitalWrite(SolenoidPin, HIGH);
}
}

© Adafruit Industries http://learn.adafruit.com/biometric-security-box Page 17 of 21


Final Assembly

Make the strike.


Cut a strip of brass about 2.5" (64mm)
long.
Measure the distance from the top of
the solenoid shaft to the edge of the
box lid - typically about 0.44"
(11mm).
Drill a .31" (8mm) hole in one end for
the solenoid shaft. The edge of the
hole should be 11mm from the end
of the strip.
Drill 2 more 1/8" (3mm) holes for
rivets.
Bend the strike above the hole as
shown below.

Temporarily install the strike


Position the strike on the front of the
box and align the top with the edge
of the box as shown.
Fasten it temporarily with machine
screws. Make sure you can unfasten
it from outside the box. We will need
to open the box for adjustments if
the latch binds.

© Adafruit Industries http://learn.adafruit.com/biometric-security-box Page 18 of 21


Test latch operation
If the latch binds or fails to engage the
strike, shim the solenoid and/or adjust
the position of the strike as needed.

Rivet the strike


Once you have verified that everything is
positioned for proper latch operation,
make it permanent and tamper-proof by
replacing the screws with pop-rivets.

© Adafruit Industries http://learn.adafruit.com/biometric-security-box Page 19 of 21


Use It!

Turn it on
Press the power button until it clicks
in the on position.
The led in the power button will blink
three times, then start to 'breathe'.

Enter the passcode


Type in the passcode you
programmed on the keypad.
If you enter it successfully, the
fingerprint sensor will light up.

© Adafruit Industries http://learn.adafruit.com/biometric-security-box Page 20 of 21


Scan your fingerprint
Place your finger on the glass window
of the sensor.
If the sensor recognizes a finger that
you enrolled, you will hear the
solenoid click and the led will start
flashing rapidly.
You will have 3 seconds to open the
box.

© Adafruit Industries Last Updated: 2013-03-07 12:34:11 PM EST Page 21 of 21

You might also like