Introduction: 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.
- 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.