RFID Toys bonus chapter

RFID Toys bonus chapter www.rfidtoys.net Stand-alone RFID Enabled Deadbolt The first project in my book RFID Toys shows how to build an RFID enabled...
Author: Alyson Phelps
7 downloads 4 Views 855KB Size
RFID Toys bonus chapter www.rfidtoys.net

Stand-alone RFID Enabled Deadbolt The first project in my book RFID Toys shows how to build an RFID enabled front door access control system. That project uses a PC to do the processing and included enhanced features such as timed access control, which only allowed access for certain tags during certain times. Readers can also download source code from www.rfidtoys.net and modify it to add other features like email access alerts. I figured most people building that project would also be into home-automation and already have a PC setup for such a project. But, many readers wanted to see a stand-alone version that did not require a PC. I started to build such a project for a demo I was doing and decided to document it. This article is dedicated to my readers!

Parts and tools list Parts list * A general purpose circuit board, Radio Shack part number 276-148a * A +5VDC voltage regulator, Radio Shack part number 276-1770 * A 5V, 20mA reed relay, Radio Shack part number 275-232 * A low power switching diode, Radio Shack part number 276-1122 * A 24 pin IC socket, www.hobbyengineering.com part number A24-LC-TT * A Parallax BASIC Stamp 2 microprocessor, stock #BS2-IC * A Parallax Grand Idea Studio RFID reader module, stock #28140 * A Weiser Lock Powerbolt 1000 electronic deadbolt * Plastic 4x3x1.6 inch project box from www.web-tronics.com, part number PB-3P * Plastic 3x2x1 inch project box from Radio Shack, part number 270-1801 * Plenty of connecting wire * Some extra mounting wood screws Tools list * Soldering iron & solder * Pliers * Screw driver * Hot glue gun

Get started I’m not going to cover how to install the deadbolt. The Powerbolt simply replaces an existing deadbolt, so it shouldn’t be a big deal to install it. If you don’t already have a deadbolt installed in the door you want to secure, follow the directions that come with the Powerbolt. Since I was building a demo, I used a solid board cut-out since it’s far easier to cart around with me and display on a table than a full size door. The thickness of the cut-out is the same as most standard doors.

Step 1: Install deadbolt and RFID reader module Get all the parts and pieces of your Powerbolt out in front of you. I’m assuming you have your old deadbolt removed already.

Prep the faceplate The Powerbolt comes with a nice silver or gold faceplate. Once the deadbolt is installed, the outer edge of the faceplate fits tightly against the door. You’re going to need to run some wires from your RFID reader module to the backside of the door, and going under the faceplate is the easiest way, unless you feel like drilling a new hole in your door just for the RFID reader wires. Put the faceplate and Parallax RFID reader module against the outside of the door. Find a good orientation and mounting place for your RFID reader module. Generally speaking, you’ll want as little room between your reader and the faceplate, so the wiring doesn’t show. Figure 1-1 shows the stand-alone reader I have on the outside of my front door.

Figure 1-1: Example of RFID reader orientation and placement

In Figure 1-2, I’ve placed my parts on the demo cut-out I’m building. The orientation is horizontal for this demo, but you can orient your reader any way you like, as long as the wiring connector block is pointing toward the Powerbolt faceplate.

Figure 1-2: Horizontal RFID reader orientation Now you know where your RFID reader wires are going to dive under the faceplate. As shown in Figure 1-3, get a set of pliers and bend the edge of the faceplate up just a tad. If you’re concerned about scratches to the metal finish, use an old cloth or t-shirt between the pliers and the faceplate.

Figure 1-3: Bending faceplate edge up to accommodate reader wires Now put the faceplate back up against the door like Figure 1-5 and check to see you have enough room for your wires.

Figure 1-4: Small bend leaves room for RFID reader wiring

Prep the RFID reader module The Parallax RFID reader module has 4 pins on it. They are VCC, Enable, SOUT, and GND. The module will not read any tags unless the Enable pin is pulled low. Because you won’t need this level of control, you can just tie the Enable pin to ground by soldering a jumper wire between the two. Soldering it to the back of the jumper block, as shown in Figure 1-5, keeps the pins clean for the connecting wires. Once you have your jumper wire soldered, solder three more wires to the GND, VCC, and SOUT pins. Make sure you solder them close to the jumper block, and make your wires are more than long enough. It’s easier to cut the extra length later than splice on more wire. Once you have the wires soldered, trim down your pins so there isn’t any extra sticking out.

Figure 1-5: Prepped RFID reader module Run the wires through the deadbolt hole along with the keypad wiring. Hold the faceplate in place with the RFID reader wires positioned in the flange you created so they won’t get pinched. Put the deadbolt lock in place and make sure the keypad and RFID reader wires are up and out of the way of the deadbolt mechanism. There should be a little metal flange coming off the securing bracket that keeps your wires up and out of the way. Screw the deadbolt into place using the long black screws that came with the Powerbolt. The back of your door should look something like Figure 1-6.

Figure 1-6: Deadbolt, keypad, and RFID wires secured to door

Securing the RFID reader module Now, because I’m building a demo, Figure 1-7 shows my bare RFID reader secured using wood screws. You will want something that looks more like Figure 1-1 and Figure 1-8.

Figure 1-7: RFID reader secured to demo board.

The back cover of your larger plastic project box fits over the RFID reader almost perfectly. You may need to trim a bit off the corners of the RFID reader board to make it sit nice. Once you have your reader board fitting nicely, mark the spot where the wires exit the plastic cover and trim off the plastic ledge to make sure the wires won’t get pinched when you secure the cover to the door. Once you have your cover prepped, secure the reader to the door using some wood screws as shown in Figure 1-8. Just make sure you secure the reader as close to the Powerbolt faceplate as you can so the wires are as protected as possible.

Figure 1-8: RFID reader secured to door

Install the Powerbolt control box It’s time to connect the control box to the keypad. Take the front cover off and pull the RFID wiring through the hole in the back toward the front. The keypad connector block simply connects to the pins provided, as shown in Figure 1-9.

Figure 1-9: Connecting the control box and running RFID wires Pull the RFID wiring through to the front and make sure they are clear of the motor and gears. Position the control box and secure it to the door using the included screws. You should have something like Figure 1-10 in front of you now.

Figure 1-10: Connecting the control box and running RFID wires

Prep the Powerbolt control box I love the Powerbolt deadbolt because it’s so easy to hack. They made it drop-dead simple to add alternative authentication methods such as RFID by putting OPEN and CLOSE switch contacts on the control circuit board, shown in Figure 1-11.

Figure 1-11: Inside of Powerbolt control box with OPEN and CLOSE contacts Get two long connecting wires and solder them to the two OPEN switch contacts on the left side, as shown in Figure 1-12. The contacts on the right side of both the OPEN and CLOSE switch contact pads are not connected to the control circuit.

Figure 1-12: Jumper wires connected to OPEN contact pads Put some batteries in your Powerbolt and touch the two OPEN switch connector wires together momentarily. You should hear a little beep noise and the motor should come to life and try to unlock the deadbolt. Feel free to exclaim “It’s alive!” in your most evil mad scientist voice. Remove the batteries after you’ve come to your senses. For now, place the cover back on the control box. You’ll see there are plenty of ways your wires can exit the control box. You can guide your wires to exit out the side as shown in Figure 1-13, cut your own notch in the cover, or use the notch already provided.

Figure 1-13: Wires exiting control box

Step 2: Build the BASIC Stamp carrier board The carrier board will house the BASIC Stamp microprocessor, reed relay, and voltage regulator used to power the RFID reader. The circuit diagram for the carrier board is shown in Figure 1-14.

Figure 1-14: Carrier board circuit diagram

Prep the board Figure 1-15 shows my half-prepped carrier board. It has the 24 pin IC socket, reed relay, and protection diode soldered across the top of the reed relay. I use 5V reed relays so often in projects like these that I keep a stockpile of them with spike protection diodes already soldered to the tops. When placing the IC socket on the board, keep in mind the side with the notch in it indicates pin 1.

Figure 1-15: Carrier board with IC socket, relay, and protection diode From here you’ll need to add the +5V voltage regulator. First solder the input lead on the voltage regulator to the VIN pin on the Stamp, which is pin 24 on the IC socket. Solder the GND pin on the voltage regulator to the neighboring VSS pin on the Stamp, which is pin 23 on the IC socket. Now connect some long DC power wires to the VIN and VSS pins as well. Now connect the wires coming out of the Powerbolt control box to your carrier board. From the RFID reader module, solder the VCC lead to the output pin of the voltage regulator. Solder the GND wire to the GND pin on the voltage regulator. Solder the SOUT wire to pin 18 on the IC socket, which is I/O pin 13 on the Stamp. Solder the two OPEN deadbolt control switch lead wires to the two switched pins on the reed relay. Polarity isn’t a concern for these leads, so just solder one lead to one relay switch pin and solder the other lead to the other relay switch pin. The reed relay coil needs power still, so solder one coil lead to pin 14 on the IC socket, which is I/O pin 0 on the Stamp. Solder the other coil lead to pin 4 on the IC socket, which is the second VSS (ground) pin on the Stamp. With your reed relay coil leads connected, it’s time to solder your protection diode across the relay coil leads. Relays are electromagnetic coils, and when you energize a relay you generate a magnetic field. When you cut power to the relay, that field collapses through the relay coil and generates quite a voltage spike. The protection diode allows that current to effectively short through the diode instead of try to force its way through your circuitry,

which could damage your components. Grab your diode and solder the cathode lead (the end with the colored band) to the coil lead that is connected to pin 14 on the IC socket. Solder the anode lead (the side opposite the colored band) to the coil lead that is connected to ground. I’ve mounted my carrier board with wood screws, as shown in Figure 1-16. You’ll be mounting yours in a nice and tidy project box when you’re done.

Figure 1-16: Carrier board connected to RFID reader and Powerbolt control box

Step 3: Program BASIC Stamp and finish project All that’s left to do now is program your BASIC Stamp microprocessor, plug it into the carrier board, and put on the finishing touches.

Program your Stamp I’m not going to go into the details of how to program your BASIC Stamp. If you’ve never used a BASIC Stamp microprocessor before or you’re having difficulty programming the one you have, consider purchasing a BASIC Stamp 2 carrier board from www.parallax.com, part number 27120. The carrier board lets you easily connect your Stamp to your computer’s serial port for programming (9V battery required). Download the BS2 code from www.rfidtoys.net/downloads/RFID_DoorDemo.BS2 and load it into your BASIC Stamp editor. You’ll need to update the code with the number of authorized tag IDs and their ID values. First update the number of tags. Line 40 looks like this: LastTag

CON

5

Change the trailing 5 to the number of authorized tags you have. So, if you have 3 tags: LastTag

CON

3

Now you’ll need to change the authorized IDs stored in the Stamp’s EEPROM. A few lines below the LastTag line is the tag list: ' -----[ EEPROM ' valid tags Tag1 Tag2 Tag3 Tag4 Tag5

Data ]---------------------------------------DATA DATA DATA DATA DATA

"0000000000" "1111111111" "2222222222" "3333333333" "4444444444"

' ' ' ' '

access access access access access

card card card card card

1 2 3 4 5

Update the tag IDs with your authorized IDs. The number of tag IDs stored must match the value of LastTag you specified above. Save your updated code and store it in a safe place. Now connect your Stamp to your PC, connect power to it, and run the code. Your Stamp should now be updated.

Finish it up Disconnect your Stamp from it’s power source and from your PC. Insert the Stamp into the IC socket on your project carrier board, making sure that pin 1 on the Stamp matches up with pin 1 on the IC socket! Once you have your Stamp in place, connect 9V - 12V power to the DC power leads that connect to VIN and VSS on your Stamp. Run an authorized tag across the RFID reader module. You should hear a beep and the deadbolt should unlock. Now all you have to do is mount your carrier board in the small project box. Place your carrier board on the inside of the back cover of the project box. Cut notches in the ledge of the plastic project box cover for all your wires so they won’t get pinched when you close it up. Use a little bit of hot glue to secure the carrier board to the back cover, then place the project box on top and use the screws provided to close it up. Now secure the project box to the door using whatever adhesive method you’re comfortable with. I used some plastic wire gutters I found at the local hardware store for my DC power supply. As shown in Figure 1-17, I ran it straight across the door horizontally, but you can run yours vertically if you want. It might look a litter better running vertically while keeping the horizontal portion at the very top or very bottom of the door, depending on how you run your power supply wires.

Figure 1-17: Finished RFID enabled deadbolt project Even though this project is fairly straightforward, I hope you gained some insight as to how RFID can be used in our daily lives. Feel free to drop by the reader forum at www.rfidtoys.net for more tips, tricks, and information about RFID and RFID enabled projects. Thanks everyone! Amal Graafstra