Google+ Facebook Twitter Pin It Reddit

Ditch your keys with our Deadbolt Hack Kit!

A convenient and impressive way to make an entrance

Jameco Builds logo By Ryan Winters
Product Manager

Description: RFID Deadbolt Hack Kit
Assembly Time: 2+ hours
Skill Level: Intermediate

Wave your wand (or key fob) and your deadbolt opens like magic. Use your existing deadbolt and this kit, which combines a high-quality servo, a low-profile pushbutton switch, an RGB LED (for status indication), a serial RFID reader kit (with four unique tags), some resistors and transistors, a prototyping board (to assemble the circuit) and a Pro Mini microcontroller (to tell everything what to do) and you'll be the envy of the neighborhood in no time.

Deadbolt Hack

There is also a 6VDC slim power adapter (to power the circuit) and Jameco's moldable plastic, ProtoDough (to make the custom bracket that will connect to your deadbolt pin to the servo).

The deadbolt is not included and it's important to note that you should make sure you are able to modify your deadbolt setup to work with the servo. The project box will fit the serial RFID reader module and servo as long as the knob that actuates the deadbolt is decorative and can be removed. The example in the instructions had a plate that held the lock in place and a flat pin that was easily accessible. Find sample sketches to download in the "Additional Files" archive.

Required Tools:

USB/FTDI adapter to program the Pro Mini
Soldering iron & solder
Angle cutters
Hot water for molding the ProtoDough (+136°F)
Ceramic or metal bowl for melting/mixing ProtoDough
1/2" OD tubing or similar (to make cylinder of ProtoDough to mold the lock pin)
Screwdriver
Hook-up wire (to reach from the power adapter to the project box)
Drill and drill bits (1/4" and 5/8" bit or a little bigger and 2" hole saw)
You will also need to make sure your deadbolt setup can be modified.

Parts you will need:

Qty.
Part Description Manufacturer Part No.
1
1.6" x 2.7" prototying board G/S(PCB228)-R
1
Carbon black anti-vandal metal pushbutton switch TEM12123B
1
Clear RGB LED - Common Anode MSL-504RGB-4P+
2
Transistor, 2N2222A, TO-18 2N2222A
10
1/4 watt resistor, 10kΩ CF1/4W103JRC
10
1/4 watt resistor, 1kΩ CF1/4W102JRC
1
Single row 20-position male pin header (break apart what you need) 7000-1X20SG-R
1
Heavy-duty servo, HS-322HD 33322
1
ABS plastic project box, 6" x 3.5" x 1.87" H2851-R
1
ProtoDough, 250g bag of moldable plastic PROTO DOUGH-250G
1
DFRobot Pro Mini microcontroller, 5V DFR0159
1
Circuit board mounting hardware kit 00106551
1
Serial RFID reader kit with 4 sample tags 32390
1
6VDC 500mA wall adapter with 2.1mm plug MGT-6500SPS
1
Instructions --



Step 1: Review Components, Schematic and Deadbolt

Read all instructions completely before starting and be sure to look at the deadbolt setup used in the example. This will give you an idea of the task at hand and how you may need to make tweaks to the steps to accommodate your lock setup. Notice the knob comes off after removing the screws, but the deadbolt is still securely fastened to the door. This setup is ideal since the plate can be removed and reinstalled to hold the project box firmly to the door with no additional hardware.

The RFID reader module can be press-fit in the bottom of the project box and should be biased to one side (top). The bottom half of the project box will be reserved for the deadbolt and servo assembly. A piece of 1/2" OD plastic tubing that fit around the lock-pin was used to mold the custom bracket.

Make sure you have all the components and review the schematic below.

Step 2: Assemble the Circuit

Tips:
Anode
  • The pushbutton switch can be mounted anywhere on the case as long as it doesn't interfere with the servo's movement. You can use wire leads from the protoboard to the terminals of the switch.

  • The RGB LED is used as a lock status indicator and is not required for proper function. The longest lead is the common anode (positive wire) for the LED and each one of the other leads is the ground point for a single color. Apply 5V to the power pin. A light pipe will best present color, but a hole in the lid will work just as well. Use a 100 ohm resistor for the red LED. The green LED can do without a resistor.

  • Test the RFID reader to verify the tags can be read through the door. The door in the example, a hollow core aluminum door, allows the reader to read tags from both sides. Packing the area behind the RFID reader with too many electronics may cause unwanted performance. Use the GetTags sketch for the unique IDs of the tags you would like to use. Remember to write them down because you will need to enter them into the final code.

  • Consider biasing the circle piece that you will cut out for the deadbolt to a lower corner of the case. This will create a larger area for the electronics rather than if it were in the middle. Leave room for the deadbolt retaining plate. Try to keep the top half clear for the RFID reader.

  • Orient the headers so that once installed with the servo and RFID card reader connected, their connectors or wires don't interfere with the servo or the mechanics of the lock and unlock cycle. You will need the full depth of the case.

  • The FTDI header is for the USB/Serial programmer to upload the code. It is a 6-pin device. Pin-5 GND is unused in this application. Pin-1 (DTR) should be connected to the RESET pin on the ProMini through a 0.1µF capacitor.

  • SchematicClick to enlarge

    Step 3: Mold the ProtoDough

    CAUTION: You can be burned when using hot or boiling water to melt the ProtoDough. Use proper caution and utensils when handling the melted plastic. Metal utensils are a good option since the compound has the tendency to stick to plastic.

    Bring water to a boil. Using a ceramic dish (avoid plastic) add a tablespoon or two of the ProtoDough to the water. The pellets will turn clear when they are moldable. Use a metal spoon and press the pellets in order to form a mass.

    You will need to roll the ProtoDough (shape it like a snake) to make inserting it into the tube easier. It will stick in the tube right away, so make the inside is slightly wet (this will buy you some time). Fully pack the tube with ProtoDough and form a disc-like base perpendicular to the shaft.

    Don't worry if you can't get all of the shaping done in one pass. You can reheat the water to make it pliable again until you achieve the desired shape. To speed up the hardening process put it in the refrigerator.

    When forming the material inside the tube for the lock pin of the deadbolt, the ProtoDough in the tube needs to be moldable. While the ProtoDough is in the shaping state, push it onto the lock pin and slightly into the lock unit. Keep the base parallel to the door to allow the smoothest operation for the servo. The center of the servo horn will need to be on center with the deadbolt pin for it to work correctly. If it is off-center, the rotation will wave off balance.

    The bracket can be removed once it has fully cooled. Use your key from the other side of the door to toggle the lock to mark center. A marker or dot sticker will help. When the dot doesn't change position while turning the lock, you've found center. You can use some of the screws included with the servo to mount it to the servo horn. Use clippers to cut excess screw so it doesn't interfere with the lock mechanism.

    Step 4: Prepare the Enclosure

  • A 2" hole saw will bore a hole to fit the deadbolt mechanism.

  • The 2" hole will be biased more to one side but leave enough space from the edge so there is space for the retaining plate of the lock.

  • Use a 1/2" or 5/8" drill bit in the enclosure face for the button switch (0.62" diameter). You may need to use a file or rotary tool (such as a Dremel) to open the hole. Before drilling the hole, be sure to consider where you've mounted the switch on the protoboard, the direction of the servo and where the RFID reader headers point and the location of the servo, lock and RFID reader.

  • Use a 1/4" drill bit to make a hole for the power supply wires. Hole placement will depend on your installation and preference.

  • Step 5: Connect the Board

  • Feed the power supply lines through a hole in the enclosure before you solder them to the board.

  • The 6V supply is for the servo and 'RAW' pin of the Pro Mini.

  • 5V supply is for the switch.

  • LEDs and RFID reader are sourced from 'VCC' pin on the Pro Mini.

  • Use hook-up wire from the I/O pins on the Pro Mini to various points of the protoboard to connect the two LED colors via the transistors, the switch, the servo header, the RFID reader header and the FTDI USB/Serial programming header.

  • Step 6: Attach the Servo

  • Connect the servo to a header on the board that provides 6V, ground and a signal to D9.

  • Set the servo to 135 (lock) before attaching it to the lock pin. Use the MotorSetup sketch as reference to set the servo to 135. A delay of a few seconds has been added so you can pull the plug at the value you want. Use the serial monitor to confirm the value when you stop the servo. You may need to use different values depending on the rotation required to toggle your deadbolt. "90" should be the center position on the servo.

  • Make sure your deadbolt is in the lock position. When you upload the code provided, it will start from the lock position.

  • Tip: If your deadbolt only requires 90 degrees of movement, divide the degrees of travel by two and add/subtract that number from the center position (90) to get your suggested locked and unlocked positions. Working from the middle will ensure you have enough rotation to complete the lock or unlock movement.

  • Step 7: Attach the RFID

  • Use a detachable cable between the RFID reader module and the connection header on the protoboard. When uploading code, the reader module must be disconnected from the Pro Mini or the upload will fail. At a minimum, the DOUT to D0/RX ("RXI") must be detached before uploading code.

  • You may wire directly from the RFID module to the Pro Mini, but use a jumper block/header or some method to break the connection on the DOUT/RXI signal so you can successfully upload code.

  • The RFID module nearly holds itself in place when pressed into the enclosure. Electrical tape will also keep it in place if needed.

  • The module needs 5V, ground, a signal wire to D0/RX and another signal wire to D2 on the Pro Mini.

  • Step 8: Final Assembly

  • Secure the enclosure to the door. Though this will depend on your specific deadbolt configuration, in the example the deadbolt has a retaining plate holding it in place. Remove the retaining plate and place the enclosure on the door with the 2" hole over the deadbolt. Reattach the retaining plate so it holds the enclosure securely to the door.

  • Install the RFID reader. Press fit the reader into the top of the enclosure. It should sit flush and will be held in place with the friction between the reader and the walls of the enclosure.

  • Install the servo onto the lock pin with the adapter made with the ProtoDough. You can use additional ProtoDough to secure the servo in place. Be sure you are satisfied with the lock operation before making a permanent servo mount.

  • Mount the circuit board to the enclosure using the included hardware (you can leave it hanging if it doesn't interfere with anything). The protoboard has a notch on each side for mounting hardware. Screw a standoff and hex stud together with the protoboard between them. Drill holes through the enclosure face to reach the hex studs and attach the circuit.

  • Attach the servo and RFID headers to the circuit board. Any time you upload code to the ProMini, you will need to disconnect the RFID or the D0/RX line.

  • The servo and deadbolt should both be in the locked position. You can set the servo to the lock position with the MotorSetup sketch. If you need to get your tag IDs, run the GetTags sketch and open the serial monitor.

  • Open the RFID_Deadbolt sketch and change the permitted RFID tags to your numbers. Upload the code to the ProMini. Reattach the RFID header or disconnected D0/RX line. Test the operation with the pushbutton and tags. The RFID reader has a red/green status LED that changes color when a tag is being read. You can test the functionality of the lock by scanning an unapproved card. Once you are satisfied with the placement and operation, close the lid with the included screws.

  • Upload Sketch

    You will need to make sure the RFID Reader is not connected to the circuit board, or at a minimum, the wire connection to D0 needs to be open. This must be done to ensure the code is successfully uploaded.

    Use the MotorSetup sketch to set your servo motor to the center position (or whatever position you need). Use GetTags to find out the unique ID for your specific RFID tags. Record the value for use in the final sketch. RFID_Deadbolt_rev2 is the complete program. You will need to change the variables in the final sketch to match your RFID tags, motor lock and unlock positions (shown below, the highlighted part needs to be changed to your tag ID and motor positions).

    Make sure your deadbolt is in the lock position when you upload the final code. It is best to upload the code and test the function before final attachment to the deadbolt. All sketches can be found in the "Additional Files" ZIP archive on the RFID Deadbolt Hack Kit Product Page.

    20 int lock = 135; //servo position for locked (value from 0 to 180)
    21 int unlock = 45; //servo position for unlocked (value from 0 to 180)
    22 int pos = 135; //starting position, locked
    23 boolean locked = false;
    24
    25 int val = 0;
    26 char code[12];
    27 int bytesread = 0;
    28 char tag1[12] = "84003408F0"; // RFID Tag 1 (change to your tag number)
    29 char tag2[12] = "70006F6E79"; // RFID Tag 2 (change to your tag number)
    30 char tag3[12] = "360065DE91"; // RFID Tag 3 (keyfob)

    The RFID Deadbolt Hack Kit is a fun and impressive way to show off your electronics skills. Whether you're carrying handfuls of groceries, escaping weather or impressing your neighbors, we bet you'll find keyless entry so convenient, you won't want to live without it.


    Ryan Winters is a Product Manager at Jameco Electronics and a Bay Area, California native. He is mostly self-taught and his hobbies include working on cars and computers, fiddling with electronic gadgets and experimenting with robotics.