Garage Door Fingerprint Lock

48K1.1K35

Intro: Garage Door Fingerprint Lock

This is an electronic garage door opener designed around a SparkFun GT-511C1R fingerprint scanner. There is already a very good instructable by user nodcah that describes how to build almost this exact device, from which I took 99% of my inspiration. I'm posting this to easily share with my local makerspace, and for anyone who likes to see things done slightly differently.

STEP 1: Soldering/Wiring

The door opener system consists of two components: a control panel on the outside of the garage with the fingerprint scanner, a small screen, and some buttons in a weatherproof housing; and a small box inside the garage that verifies when a recognized fingerprint has been scanned and opens the door, and also converts whatever power you provide into 3.3 Volts. An ATMega328p microcontroller is the brains of the exterior control panel, and an ATTiny lives in the box inside the garage. The two MCUs communicate over a serial connection. The ATTiny biases a transmitter to close the connection for the garage door switch when it receives a specific code phrase over the serial connection. This way a mildly clever vandal can't break into the garage by ripping off the control panel and crossing a couple wires.

Though the datasheet claims this FPS can handle up to 6 Volts, I'm skeptical since the better model requires 3.3, and since the MCUs are happy with 3.3 Volts and the LCD requires it we'll just power the whole thing that way.

Parts List:

  • GT-511C1R Fingerprint Scanner (make sure to buy the JST connector too)
  • Nokia 5110 LCD
  • ATMega328p microcontroller
  • ATTiny85 microcontroller
  • MCP1700-3V3 voltage regulator
  • 10 uF capacitor (2)
  • 10 kOhm resistor (3)
  • 100 Ohm resistor (3)
  • tall momentary pushbutton (3)
  • ic sockets, 28-pin and 8-pin, protects MCUs when soldering and nice if you want to reprogram them
  • terminal block, for connecting the control panel wires to the interior box without the need to solder
  • weatherproof exterior utility box, like this one maybe
  • a small rectangular piece of acrylic for the front cover of the control panel to keep things classy
  • 5V DC converter, such as a phone charger

Use the attached schematic to solder together the circuits for the control panel and interior module on some protoboard or however you like to roll. You will solder the JST connector and some flying wires (I found ribbon cable keeps things organized) for the FPS and LCD, so they can hang loose and be secured to the front panel of the control panel. Examining the code in later steps will reveal that the buttons wired to pins 12, 13, and 14 (i.e. Arduino pin 6, 7, and 8) serve the functions "up", "OK", and "down", respectively. So, you may want to arrange them this way on the board to keep things nice and logical.

I cut the microUSB connector off of an extra phone charger to power everything, since they're cheap and easy to come by if you stay away from the Apple Store. You could run the whole thing with batteries (although don't give too much voltage to the poor little MCP1700 or he'll get hot), but the FPS must drain a lot of power because when I tried it with 3xAAA it only worked for about a day.

The two modules are connected by three wires - one for 3.3V, one for ground, and one from TX on the ATMega328p to pin 5 (aka Arduino pin 0) on the ATTiny, which will be RX for a software serial connection. Twisting them together makes them easier to thread through and looks neato.

STEP 2: Coding and Flashing

I used the Arduino IDE to write and compile the attached code for the two MCUs- garagefinger.ino for the ATMega328p in the control panel and tiny_switch.ino for the ATTiny85 inside the garage. NokiaLCD.cpp and NokiaLCD.h are barebones libraries for the LCD that I put together from examples on the Arduino site - they should be put in the "libraries" folder for your Arduino IDE, wherever that lives (on Windows it's usually %HOMEPATH%\Documents\Arduino\libraries).

You will also need to obtain Arduino libraries for the FPS. Note that the FPS libraries linked on SparkFun's site will not work - they are for the more expensive model (GT-511C3) and not this cheapo version. Working libraries for the GT-511C1R can be found on github.

If you think a clever hacker might read this and solder the wires coming out of your garage onto something with a serial connection, you'll want to replace all instances of "secretstring" in each file to your own password - you may want to make it longer if you're really paranoid. You should also change the String buf in tiny_switch.ino so that it has the same length as your password. The variable overrideCode defined at the top of garagefinger.ino also contains an 8-bit representation of the sequence of up/down button presses that can be used to open the garage door and load new fingerprints into the sensor without scanning an known fingerprint. This is useful the first time you use the device, since the scanner's memory will be empty. One of the menus has an option to change the override sequence, after which the new sequence will be stored in EEPROM and will remain even if the device is powered off. You might want to change this initial value as well, in case you think clever, patient hackers are waiting to steal all the cool stuff you have in your garage by entering the standard override code before you have a chance to change it.

There are several ways to compile the code onto the MCUs. If you have an Arduino, you can simply compile the code directly onto it, then pop out the ATMega328p and use it in this project - but that won't work for the ATTiny. You could use the Arduino as ISP method described in NaughtySlayer18's instructable Programming the ATTiny. If you, like me, have a Raspberry Pi, you can use it to program your AVRs by downloading Kevin Cuzner's build of avrdude for the Raspberry Pi and following his detailed instructions. You will need to put the compiled files garagefinger.hex and tiny_switch.hex on your Pi, which Arduino normally hides from the user. On Windows, look in the most recent build* directory in %HOMEPATH%\AppData\Temp (be aware Arduino seems to delete this directory upon exit).

STEP 3: Assembly

I used this weatherproof outlet box as the container for the control panel on the outside of the garage. I cut a piece of acrylic to fit into the interior of the box. Any reasonably rigid material could be used - I went with acrylic because I could cut it precisely with a laser cutter and it looks boss. I cut holes in the acrylic for the buttons, LCD, and FPS, as well as holes for screws to hold the protoboard in place and make it possible to remove in case I want to reprogram the chip with even cooler menus. I cut some standoffs out of acrylic, tapped holes in them for screws, and glued them into the outlet box with Gorilla Glue. I used hot glue to secure the FPS and LED to the control panel, but a less reckless and lazy person could use more tiny screws.

I mounted the outlet box on the outside of my garage after drilling a 1/2" hole through the doorframe and threading the 3 connecting wires through. I stuck the ATTiny's board inside a little project box, which I attached to the inside of the doorframe using some hook-and-loop tape (e.g. Velcro). I screwed the 3 wires from the control panel into the proper locations on the terminal block on the ATTiny board, as well as two wires from the garage door motor's door button terminals, leading to the collector and emitter of the transistor. I left the mind-numbingly primitive button wired in parallel to the garage door motor so I can still use it when I'm inside the garage.

STEP 4: Usage

Pushing any of the three buttons will light up the screen and fingerprint scanner. The device waits for a finger to be pressed on the scanner. If the finger scanned is recognized, it will open the door and present a menu system that can be used to do things such as open/shut the door again, add or delete fingerprints to/from the scanner's memory, change the brightness/contrast of the display, etc. For the most part, the device will time out after roughly 8 seconds, turning off the screen and scanner and requiring authorization to get back into the menu system. To change the timeout length, study and modify the waitForButton function in garagefinger.ino.

An override sequence of up/down button presses, followed by "OK" can be used to gain access to the system. This is useful the first time the device is activated, since there will be no scans in the fingerprint scanner's memory, or if you want to allow someone access to the garage if you are away on vacation. The initial sequence is given by the 8-bit binary representation of the number stored in the variable overrideCode in garagefinger.ino, with "1" representing "up" and "0" representing "down". The code can be changed using the menu system, after which it will be stored in EEPROM and thus be saved even if power is disconnected from the device. A word of warning: if you change the override sequence and forget it without adding any fingerprints to the device, you will be effectively locked out and have to reprogram the ATMega328p and force an EEPROM erase to clear the forgotten code (or you could use a hammer to reprogram the whole thing and just not go in your garage any more).

Note that this gizmo is effectively still just a button - it doesn't know if your garage is open or closed. A little modification of the code and the addition of a photoresistor or, better yet, a Hall effect sensor could remedy this fairly easily. Then the code could be modified to allow the door to be closed without needing to scan a fingerprint, or to close the garage door after a preset amount of time if it is left open.

25 Comments

For better security, you could add challenge-response authentication between the outside and inside modules. That way simple replay attacks won't work either. (e.g. in Wargames, the way David used a tape recorder to break out of the room.)

another item on security is that plastic is a bad enclosure ,its better to use metal with a tamper switch

the board and parts can be taken by the thief and plastic can easy get cracked

A metal enclosure would mainly be better for making it resistant to vandalism, so is a good idea, but wouldn't do much to make it more resistant to being cracked by a determined opponent, since they will be able to get in one way or another. The tamper switch is a good idea though - the way to use it is to program the device to instantly delete its cryptographic key if the tamper switch is activated or the box loses external power (you'd need to add e.g. a large capacitor to give it enough time after losing external power). Then even an advanced adversary with the capability to snoop directly into the electronics as they are running may inadvertently thwart their efforts just by opening it up. You'd then have to have a way to manually reset the system and send the outside box a new key (after confirming that no covert additions have been made to capture it during this process) for initial setup, for when the power goes out, or for when you need to service the system.

You want to improve the security, when a screwdriver is enough to open the box ?

The point of using a challenge-response protocol is that it then doesn't matter if the outside hardware becomes compromised (e.g. by someone with a screwdriver) because they will still be unable to get the door to open - the only way to open the door is to use the original control pad because only it can formulate a correct response to the challenge sent by the interior module.

Good call (and good reference). You'd need to add an extra wire from TX on the ATTiny to RX on the ATMega, though - unless maybe you set up a hash algorithm on the ATTiny. Now you've got me thinking about how to code it.

Another thought - I wonder what kind of
security the FPS library uses? The serial connection between that and
the ATMega chip could be vulnerable too.

There are libraries for arduino that implement the needed crypto for a challenge-response already, for example https://github.com/lucadentella/ArduinoLib_TOTP.

hi sir im joseph i would like your project ..i need your code for my thesis project

here is the link to the board ,its TTL so should be easy to hook up to arduino or if use EZ ROBOT board it has interface already made

i already bought 5 for my robots

http://www.digikey.com/product-search/en?mpart=B5T001001G&v=39
Face ID board is very costly but I use them in my robots for face recognition so I only need another low cost wifi camera for the door
Robot board like arduino I use is EZ robot plus recognition board
Most locks you buy has a tamper switch and way you use it ,you have Bell or alarm circuit ,so does stop anyone breaking in

Nobody is going to stay there with alarm sounding off
Second you would set it up so the alarm stays on till you reset it from the inside

That's design I am working besides face ID and wifi plus can easy add to the robots I design to unlock the door if needed
Biggest cost is the scanner with shipping
Would great to see it go down in price

Nice work. How much did this cost?

I would like to know how to start this project.....I'm new to this world....
could you please explain it briefly abt how to do this project sir...I would like to do it....this was my frst project I like to do......

Couldn't someone just smack the outer box off the wall and jump the exposed wires? A wireless connection from inside to outside would make it more secure, albeit more expensive as well.

Shorting the wires won't work - the inside box expects a specific code phrase over a serial connection on one of the wires - not trivial to replicate. However, there are security concerns with this or your wireless method re AJMansfield's comment below. Wireless is cool though, and less destructive.

Glad to know I'm a mildly clever vandal. That was my first thought. :)

This is great and so nice of you to credit the original. :-)

More Comments