Building a #*%$! RFID Entry System, Episode 1

For those of you who have been with AMT from the beginning, you know that we've had a bit of a love-hate relationship with our RFID door entry. Specifically, we'd love one, and we hate it that we don't. Well never fear, I brought together the brightest minds AMT could muster, and after a few hours, an arduino, a parallax RFID board and some ingenuity, we've managed to put together this lovely AMT door panel:

Door panel

Oh god, you clicked on the link? NO, NOOO DON'T LOOK DOWN NOOOOOO!!!!!

No, stop scrolling what have you done!!!!

Okay, fine. You got me. So really, it was more like we cobbled together an incredibly ghetto RFID system. But, the important point to take away here is that it works. So give us some credit, yeah. What follows is not so much a fine tale of engineering, but something like a sordid mess that briefly ventured into deadly territory with some woodworking tools. If you too would like to almost chop your fingers off while building a precarious door system, read on!

Equipment

You will need:

  • An electric strike (we used this one)
  • Something arduino-like and a breadboard to put it on
  • A 12v power source, and a relay that can be triggered by 5v logic
  • An rfid reader, we used the Parallax reader, but the SeeedStudio reader works just as well.
  • A non-conductive casing less than 3 inches thick. We used a piece of 1x4 poplar board, but you could use acrylic, plastic, sculpey, a very thin, dry cat, etc.
  • Heat shrink tubing or electrical tape, some wire, terminal strips
  • Tools! A soldering iron, a drill of some variety, wire strippers, all the usual suspects involved in an electronics project

Step 1

Install your electric strike. I didn't do this, but I'm told it went like this:

  1. Gouge out a hole in your wall for the strike
  2. Drill a more different hole near the strike
  3. Pull the wires from the strike out of your more different hole

Now you should have a bunch of wires. Our strike has a pair of mystery wires which are a 'door closed sensor'. They run out the strike and into the jamb a bit, and don't connect to anything. Apparently these two disconnected wires can detect if the door is closed. Don't ask me, it's like magic!

A sidebar about electric strikes

Strikes come in two configurations, fail-safe and fail-secure. These terms refer to the behavior of the lock in case of a power failure. Now what you're looking for is not 'fail-safe'. It sounds so good, doesn't it? But in case power goes out, the whole thing opens faster than an inappropriate analogy. So, get yourself a strike in fail-secure configuration. In the case of the strike mentioned, you can switch it whichever way you like.

End sidebar

So, the last thing you need to do is figure out how to open the lock. In our case, feeding it 12v on the power line activates the strike, opening the door. Since all of our electronics runs at 5v, we'll need a something to control this kind of power overwhelming, which is where the relay comes in. I'm sure you could read more about relays on the web or something. Post a comment if you find a good tutorial. For what it's worth, we use a latching relay to drive our door. Pulsing one pin high opens the relay and keeps it open. Pulsing the other will close it. I'd tell you more, but I don't much understand it myself.

Step 2

Drive your relay with something.

I lied when I said I didn't know anything about relays. There are two types, mechanical and solid state. A mechanical relay is actually a tiny physical switch activated by a magnet when the input line is driven high. If you know anything about magnets, you'd know that putzing with magnetic fields induces a current. When you drive the pin high, everything might be fine and dandy, but when you let it go, and the magnetic current dissipates, the laws of magnetic induction dictate that the dissipating emf will drive a back-current through your trigger pin... okay, so maybe I wasn't really lying that much. I'm not really sure what that means. But that bit about the back-current is true. If you use a mechanical relay, you'll have to build a protection circuit to prevent this current from destroying your board. Or at least, screwing up operation. Sparkfun can tell you more about it.

Of course, we're badasses, so emf be damned, we're driving our relay directly from a laptop parallel port. (Please do not do this).

Step 3

Connect your RFID to an arduino.

If you're using the parallax device, look here.

Basically, it reads the RFID 10 digit number through the serial RX pin. When it has collected all 10 digits, it writes it out to the arduino TX pin, which is presumably connected to something fun on the other side, like a computer. You can remove the part where it spits out "TAG code is: " and just print the tag code on a line by itself.

Wire up your parallax to your arduino and have a go at it. Test your tags, see if the numbers are read correctly, etc. If you use the seeedstudio reader, you're mostly on your own, until I get around to writing some wiegand reader code.

Step 4

Tie everything together.

Alright, now here's the brains of the operation. You have a method for reading an rfid card, and you have a method for opening the door. All that's left is writing some authentication code.

    while (True):
tag = read_rfid()
if (validate(tag)):
open_door()
reset_rfid()

Simple, isn't it? Read the rfid, validate it and optionally open the door, reset, repeat.

This code can be run anywhere. We have it running on our controller laptop in the corner, but there's no reason you couldn't put this all on the arduino. In fact, we'll probably move it there when we're done.

You can fancy up your validate() call, too. Right now, we just check to see if the tag that's read is in the list of tags we know about, then blindly open the door. But, you could make it so that it goes to a remote web service, validates a user against a database, checks to make sure they've paid, and then texts their phone if they haven't.... hold on, let me write this down in my notebook.

Step 5

Pretty it up and put it up in a case.

... shrug.

Step 6 (Optional)

Throw it all in the garbage and pay a professional. What the heck were you thinking?

Conclusion

Well, this is a poor tutorial, isn't it? The astute amongst you will have noticed the 'episode 1'. Episode 2 is where we start to go into detail about the different components and actually show you what we've done, and what we're going to replace it with. PRO TIP: the previously mentioned harrowing woodshop adventure probably happens in that installment, so stay tuned!

Comments

Building a #*%$! RFID Entry

the latest and greatest in pictures for this project - new cable, new ucontroller

 

Who's online

There are currently 0 users and 144 guests online.

Syndicate

Syndicate content

Ace Monster Toys is a non-profit hackerspace based in Oakland, CA, dedicated towards education, hacking, and maker culture.

Terms of Service | Privacy Policy | Refund Policy | Contact Us

MakerBots