RFID Toys Homepage
Holy crap, check out the Dangerous Things store!
Forum Home Forum Home > Projects and such > Book Projects
  New Posts New Posts RSS Feed - RFID door using strike plate + Wiegand interface
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

RFID door using strike plate + Wiegand interface

 Post Reply Post Reply Page  12>
Author
Message Reverse Sort Order
amal View Drop Down
Admin Group
Admin Group
Avatar

Joined: 22 November 2005
Location: United States
Status: Offline
Points: 2060
Post Options Post Options   Thanks (0) Thanks(0)   Quote amal Quote  Post ReplyReply Direct Link To This Post Topic: RFID door using strike plate + Wiegand interface
    Posted: 07 March 2010 at 6:50pm
Originally posted by bolsontanker bolsontanker wrote:

I would, but it's installed in a project box, in the wall, and the wall putty is drying.


Coolio. My reader is on the way already so I'll have something to play with soon enough.

Originally posted by bolsontanker bolsontanker wrote:

As far as duplicate tags go, as I'm sure you know, I'm about as worried about that as I am about someone using a "bump key" method of opening my door, if they want in, they'll get in.


True ;)
Amal ;)
www.amal.net
Back to Top
bolsontanker View Drop Down
Newbie
Newbie
Avatar

Joined: 08 February 2010
Location: Oregon
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote bolsontanker Quote  Post ReplyReply Direct Link To This Post Posted: 07 March 2010 at 6:11pm
I would, but it's installed in a project box, in the wall, and the wall putty is drying.   I don't want to move the box and ruin any progress the drying has made.  It seems when I was doing the initial testing portion, that if one wasn't hooked up it gave me some (what seemed to me like) garbage numbers- same for both tags.  There is a strong possibility that I'm wrong on that though :-P.  As far as duplicate tags go, as I'm sure you know, I'm about as worried about that as I am about someone using a "bump key" method of opening my door, if they want in, they'll get in.
Back to Top
amal View Drop Down
Admin Group
Admin Group
Avatar

Joined: 22 November 2005
Location: United States
Status: Offline
Points: 2060
Post Options Post Options   Thanks (0) Thanks(0)   Quote amal Quote  Post ReplyReply Direct Link To This Post Posted: 07 March 2010 at 12:55pm
Hmm, as you can see the first 24 bits of your two tags are the same, so the reader must be picking up on the last 26 bits of each tag, which means your site codes should be the same for both tags, but they aren't. The Phidgets spits out hexadecimal data for each tag, and the 3rd byte in is C4, which is 196 in decimal format, which your first tag is reporting on the Wiegand interface. From there it gets odd because the next 8 bits of tag 1 is BD, which should be 189 in decimal.

I'm not that familiar with arduino coding but it looks like the bits from pin 2 and 3 (data 0 and data 1) are getting mixed together in the reader1 variable... not that it matters for your application. I went ahead and bought one of these readers just to play with, but you should know the mathematical limitations of Wiegand26 make it much more likely that you'll see code duplication from tags with different IDs. For example, if you have two tags with IDs 01c8a50511 and A0B0a50511, I'm pretty sure the Wiegand reader will spit out the same ID code for both tags.

Now I'm both curious and impatient :) if you have a spare minute, could post the two separate Wiegand data outputs from the DATA 0 and DATA 1 lines for tags 1 and 2?
Amal ;)
www.amal.net
Back to Top
bolsontanker View Drop Down
Newbie
Newbie
Avatar

Joined: 08 February 2010
Location: Oregon
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote bolsontanker Quote  Post ReplyReply Direct Link To This Post Posted: 07 March 2010 at 6:36am
I'm not sure.  I did see the following though while testing:

With this setup the wiegand26 reader has an Arduino serial output of:
example:
Tag 1- 196-15809
Tag 2- 452-3285

- whereas my Phidgets reader has a serial output of:
Tag 1- 2800c4bdc1
Tag 2- 2800c4ccd5
Back to Top
amal View Drop Down
Admin Group
Admin Group
Avatar

Joined: 22 November 2005
Location: United States
Status: Offline
Points: 2060
Post Options Post Options   Thanks (0) Thanks(0)   Quote amal Quote  Post ReplyReply Direct Link To This Post Posted: 05 March 2010 at 11:57am
Nice! Do you know if the readers output the first or last 26 bits of the 40 bit EM4102 tag ID?
Amal ;)
www.amal.net
Back to Top
bolsontanker View Drop Down
Newbie
Newbie
Avatar

Joined: 08 February 2010
Location: Oregon
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote bolsontanker Quote  Post ReplyReply Direct Link To This Post Posted: 05 March 2010 at 11:15am
My project is working wonderfully now.  All that's left is to install it into the wall/door frame.

/* Crazy People
 * By Mike Cook April 2009
 * Three RFID readers outputing 26 bit Wiegand code to pins:-
 * Reader A (Head) Pins 2 & 3
 * Interrupt service routine gathers Wiegand pulses (zero or one) until 26 have been recieved
 * Then a sting is sent to processing
 */
int validSiteCodes[] = {196, 452};
int validSerialNumbers[] = {15809, 3285};// see if site code and serial number are in the lists...

volatile long reader1 = 0;
volatile int reader1Count = 0;

void reader1One(void) {
  reader1Count++;
  reader1 = reader1 << 1;
  reader1 |= 1;
}

void reader1Zero(void) {
  reader1Count++;
  reader1 = reader1 << 1;
}

void setup()
{
  Serial.begin(9600);
  // Attach pin change interrupt service routines from the Wiegand RFID readers
  attachInterrupt(0, reader1Zero, RISING);//DATA0 to pin 2
  attachInterrupt(1, reader1One, RISING); //DATA1 to pin 3
  delay(10);
  // the interrupt in the Atmel processor mises out the first negitave pulse as the inputs are already high,
  // so this gives a pulse to each reader input line to get the interrupts working properly.
  // Then clear out the reader variables.
  // The readers are open collector sitting normally at a one so this is OK
  for(int i = 2; i<4; i++){
  pinMode(i, OUTPUT);
   digitalWrite(i, HIGH); // enable internal pull up causing a one
  digitalWrite(i, LOW); // disable internal pull up causing zero and thus an interrupt
  pinMode(i, INPUT);
  digitalWrite(i, HIGH); // enable internal pull up
  }
  delay(10);
  // put the reader input variables to zero
  reader1 = 0;
  reader1Count = 0;
  //digitalWrite(13, HIGH);  // show Arduino has finished initilisation
}

void loop()
{
  if(reader1Count >=26){
//Serial.print(" Reader 1 ");
//Serial.println(reader1,HEX);
 // Serial.println("A");
 //Serial.println(reader1& 0xfffffff);
 int serialNumber=(reader1 >> 1) & 0x3fff;
 int siteCode= (reader1 >> 17) & 0x3ff;

 Serial.print(siteCode);
 Serial.print("  ");
 Serial.println(serialNumber);
  reader1 = 0;
  reader1Count = 0;
if(IsTagValid(siteCode, serialNumber)
){
  digitalWrite(13,HIGH);
}
  else
    digitalWrite(13,LOW);
    delay(2000);
    digitalWrite(13,LOW);   // Open the door. It's cold out here!
}
     }

boolean IsTagValid(int siteCode, int serialNumber)
{
   boolean valid = false;

   // Determine how many valid tags there are
   int validTagCount = sizeof(validSiteCodes)/sizeof(int);

   // Loop through the arrays to see if siteCode
   // and serialNumber are present

   for(int t=0; t<validTagCount; t++)
   {
    if(validSiteCodes[t] == siteCode &&
       validSerialNumbers[t] == serialNumber)
    {
        valid = true;
        break;
    }
   }

   return valid;
}  



Took me a while to get back to this- busy week- here is the working code  ;)
Back to Top
bolsontanker View Drop Down
Newbie
Newbie
Avatar

Joined: 08 February 2010
Location: Oregon
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote bolsontanker Quote  Post ReplyReply Direct Link To This Post Posted: 27 February 2010 at 9:40pm
So this is how far I've gotten now that my parts have shown up.
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1267227582/0

Basically I think I have the hardware figured out- I'm going to use the setup I've simply drawn on that thread and then I want to output to digital pin 13 which will run to trigger the TIP31A to send 12vDC to the door lock.

I have someone who is trying to help me with the code, but additional help is definitely welcome :-).
Back to Top
bolsontanker View Drop Down
Newbie
Newbie
Avatar

Joined: 08 February 2010
Location: Oregon
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote bolsontanker Quote  Post ReplyReply Direct Link To This Post Posted: 21 February 2010 at 9:26am
I asked the e-bay seller specifically whether it just read EM4102 or if it read all EM41xx tags and his response that it read all EM41xx tags.  So that's what I know on that subject thus far.
Back to Top
amal View Drop Down
Admin Group
Admin Group
Avatar

Joined: 22 November 2005
Location: United States
Status: Offline
Points: 2060
Post Options Post Options   Thanks (0) Thanks(0)   Quote amal Quote  Post ReplyReply Direct Link To This Post Posted: 20 February 2010 at 10:17pm
Cool man :) I'm interested to see what tags it work with and data that reader kicks back because it's a good price for all that in one package.
Amal ;)
www.amal.net
Back to Top
bolsontanker View Drop Down
Newbie
Newbie
Avatar

Joined: 08 February 2010
Location: Oregon
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote bolsontanker Quote  Post ReplyReply Direct Link To This Post Posted: 20 February 2010 at 10:15pm
I'm still waiting on the rest of my parts to show up.  I have an ID-20 as a back-up if I can't work out the details on this, but the all-in-one solution that this setup has (led, buzzer, reader, weatherproof) is pretty nice and will make for an easy installation- just drill a hole, mount it outside, and connect the wires.  I had all the parts for the ID-20 setup and then I think I fried the ATmega... or the Arduino itself :-/ with my tinkering/learning.  I have another Arduino on it's way and the parts to solder together a AVR ISP MK II programmer (found on ebay as well).  I'm completely new to all this, but trying to learn fast (actually just discovered the Arduino, and there-by basic electronics, on January 31st in that Instructable I posted before and have been trying to learn as much as possible since).  When my new Arduino shows up I will test out that code and see what raw data it sends through to Processing. 
Back to Top
 Post Reply Post Reply Page  12>
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.172 seconds.