Actually we are using their module which convert the output of the card reader into Weigand then another weigand to RS232 converter to get the RS232 serial output.
Anyone can guide me how i can start with this.
We are using 4 wire of the reader at the moment.
2 of them is power supply.
The other 2 is Data 0 and Data 1.
The Gallagher reader uses a bespoke encrypted protocol so cant be interfaced with directly.
We need to connect it to a Gallagher weigand protocol converter (see attached data sheet). This has a data0 and data1 line and presents a 40 bit Weigand code - first 16 bits facility code, next 24 bits card number.
You can use the Arduino to decode the weigand output (no need for an rs232 converter here - in fact most are unlikely to work since they are hardwired for 26 bit Weigand format).
The protocol converter needs a 13v power supply and has no pull up resistors - the manual suggests 1.5k pull ups. I am powering the Arduino off the USB so have to link the grounds to get any consistent data.
A neater solution would be to use the same power supply with a voltage converter thus linking the grounds, or using Vin which should take the 13V - never been brave enough to test this though!!
/* Gallagher T11 reader with Weigand Protocol Converter
* Jonathan Richardson April 2012
* Base don 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 40 have been recieved
* Gallager format is 16 bits facility code, next 24 bits card number.
*/
volatile int64_t reader1 = 0; //can't use an int as there are not enough bytes
volatile int reader1Count = 0;
void reader1One(void) {
reader1Count++;
reader1 = reader1 << 1;
reader1 |= 1;
}
void reader1Zero(void) {
reader1Count++;
reader1 = reader1 << 1;
}
void setup()
{
Serial.begin(57600);
// 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(9, HIGH); // show Arduino has finished initilisation - normally pin 13 but I using an Ethernet board
}
void loop() {
if(reader1Count >=40){
//can't serial.println an int64_t so need to use a char buffer
char buffer[100];
sprintf(buffer, "%0ld", (reader1 >> 24) & 0xffff);
Serial.print(buffer);
Serial.print(" ");
sprintf(buffer, "%0ld", reader1 & 0xffffff);
Serial.print(buffer);
reader1 = 0;
reader1Count = 0;
}
}