SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By bolsontanker
Hello all, I'm trying to create a setup with the following: ... ts_id=9218
and ... 3ca6bdd833 ... 518b5ac5a1

Here is the code which I have found which outputs a consistent RFID read (though quite different from the phidgets output). Can someone help me with the following finishing touches-1- get the code to a point that it will take it's reading and compare it to a pre-defined list on the Arduino and grant access only to those in that list {I have no issues with having to open the setup to add RFID codes}
and 2- how do I set the 12v strike lock so that the output from the arduino is able to trigger the lock using the ground {with the 12v + for the strike plate coming from the breadboard power supply, and the negative going to ? (relay, transformer, ?)}
Code: Select all
/* 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

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

void reader1One(void) {
  reader1 = reader1 << 1;
  reader1 |= 1;

void reader1Zero(void) {
  reader1 = reader1 << 1;

void setup()
  // 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
  // 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
  // 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("A");
 //Serial.println(reader1& 0xfffffff);
 int serialNumber=(reader1 >> 1) & 0x3fff;
 int siteCode= (reader1 >> 17) & 0x3ff;

 Serial.print("  ");
  reader1 = 0;
  reader1Count = 0;

This is a visual representation of what I currently have setup:


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

- whereas my Phidgets reader has a serial output of:
Tag 1- 2800c4bdc1
Tag 2- 2800c4ccd5

using those tags as examples how would I set the code up for the wiegand tags up as verified tags which would trigger an output to trigger the strike lock?

Any and all help is appreciated! Thanks :o
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]