Go Down

Topic: Read Write HID 125K RFID tags (Read 6888 times) previous topic - next topic

Bgsneeze

Hello,
I would like to build a reader/writer for HID 125KHz RFID tags. I am just starting to learn how RFID works and thought building this would be fun. Does anyone know where I could find a chip or shield that will read and write the cards? If I build a reader/writer for HID 125KHz tags can the same circuit be used to read other manufacturers 125KHz tags?
Thank you,
Bgsneeze

Pauly

I'm not sure if this will work with your tags, but it is a RFID read/write shield.
http://adafruit.com/products/789

Do you have a link to your tags?

Grumpy_Mike

Quote
I would like to build a reader/writer for HID 125KHz RFID tags.

Most tags at 125KHz are read only. The ones you can write to are just to put the readable ID into the tag, there is no room for data.

Quote
If I build a reader/writer for HID 125KHz tags can the same circuit be used to read other manufacturers 125KHz tags?

Some but not all. There are different ways a tag can encode data so it has to match the HID way in order to work.

Grumpy_Mike

@Pauly
That link is for:-
Quote
the perfect tool for any 13.56MHz RFID or NFC application.

So it is not a 125KHz tag.

pylon

This is a 125kHz reader:

http://iteadstudio.com/store/index.php?main_page=product_info&cPath=16&products_id=6

Although it claims to be also a writer I've never seen a writable 125kHz tag.

There are two version of it, they differ in the reading interface. To begin go for the UART version.

Bgsneeze

The cards I am looking at using are these: http://www.hidglobal.com/documents/proxcard_ds_en.pdf

For the time being, Just being able to change the ID would work for me to learn with.

Grumpy_Mike

Quote
For the time being, Just being able to change the ID would work for me to learn with.

That is all you can do with those cards you can't write any data.

Bgsneeze

Are there shields or antennas that can be bought/ built for reading/writing the HID 125KHz cards?

gerbon

just a bit of code.. It can maybe help someone...

It's an arduino sketch whitch decode the card number from hid proximity card (36 bit stream) - It can be optimised :-) but I don't have time yet.. Thanks to http://colligomentis.com/2012/05/16/hid-reader-arduino-rfid-card-catcher/ site where I found the basis.


unsigned long bitHolder1 = 0;
unsigned long bitHolder2 = 0;
unsigned int bitCount = 0;
unsigned long cardChunk1 = 0;
unsigned long cardChunk2 = 0;
unsigned long result =0;
char buffer[200];
char val[50];
String value;
String value2;
String cardNumber;
int parity = 0;

// Begin Code for DATA0 and DATA1 Interrupts to get the binary data from the card
// For whatever reason, when wired to the micro DATA1 and DATA0 need to be reversed
void DATA0(void) {
    bitCount++;
    if(bitCount < 23) {
      bitHolder1 = bitHolder1 << 1;
    }
    else {
      bitHolder2 = bitHolder2 << 1;
    }
}

void DATA1(void) {
   bitCount++;
   if(bitCount < 23) {
      bitHolder1 = bitHolder1 << 1;
      bitHolder1 |= 1;
   }
   else {
     bitHolder2 = bitHolder2 << 1;
     bitHolder2 |= 1;
   }
}

// End code for DATA0 and DATA1


void setup() {
 
  Serial.begin(57600);
 
  clearinterrupts();
 
  attachInterrupt(0, DATA0, RISING);  // DATA0 (green) on HID reader, Pin 2 on Arduino
  attachInterrupt(1, DATA1, RISING);  // DATA1 (white) on HID reader, Pin 3 on Arduino
  delay(10);
//  Serial.println("READER_0001");
  bitCount = 0; bitHolder1 = 0; bitHolder2 = 0;
}


void loop() {
   
    // Check if bits received are a valid length to be a card
    if (bitCount >= 26) {
        delay(100);

        // Call function to get our two chunks of card values
       getCardValues();
       
        //Debug stuff
/*        Serial.print("bitHolders: ");
        Serial.print(bitHolder1, BIN);
        Serial.print(", ");
        Serial.println(bitHolder2, BIN);
        Serial.print("cardChunk1: ");
        Serial.println(cardChunk1, BIN);
        Serial.print("cardChunk2: ");
        Serial.println(cardChunk2, BIN);
        Serial.print("Card Value (BIN): ");
        Serial.print(cardChunk1, BIN);
        Serial.println(cardChunk2, BIN);
        Serial.print("Card Value (HEX): ");
        Serial.print(cardChunk1, HEX);
        Serial.println(cardChunk2, HEX); */
        cardNumber = (String(cardChunk1, HEX) + String(cardChunk2, HEX));
       
//        Serial.println(cardNumber);
        value = (String(cardNumber.substring(cardNumber.length()-4)));
        result = (hexToInt(value.charAt(value.length()-1)));
        result = result + ((hexToInt(value.charAt(value.length()-2)))*16);
        result = result + ((hexToInt(value.charAt(value.length()-3)))*256);
        result = result + ((hexToInt(value.charAt(value.length()-4)))*4096);
        value = ("000000" + String(result));
        value = (String(value.substring(value.length()-5)));
        value = (cardNumber.charAt(5) + value);
        result = value.toInt();
        Serial.print(result);
        bitCount = 0; bitHolder1 = 0; bitHolder2 = 0;
        delay(100); // Extend this if you want to see the card value on the LCD screen longer
    }
}

int hexToInt(char nibble)
{
  if (nibble >= '0' && nibble <= '9')
    return nibble - '0';
  else if (nibble >= 'a' && nibble <= 'f')
    return 10 + nibble - 'a';
  else
    return 10 + nibble - 'a';
}

// Function to clear interrupts and prepare them for use
void clearinterrupts () {
  // the interrupt in the Atmel processor messes up the first negative 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);
}

// Function to append the card value (bitHolder1 and bitHolder2) to the necessary array then tranlate that to
// the two chunks for the card value that will be output
void getCardValues() {
  if (bitCount == 36) {
   
       for(int i = 19; i >= 0; i--) {
          if(i == 13 || i == 12){
            bitWrite(cardChunk1, i, 1);
          }
          else if(i > 12) {
            bitWrite(cardChunk1, i, 0);
          }
          else {
            bitWrite(cardChunk1, i, bitRead(bitHolder1, i + 10));
          }
          if(i < 10) {
            bitWrite(cardChunk2, i + 14, bitRead(bitHolder1, i));
          }
          if(i < 14) {
            bitWrite(cardChunk2, i, bitRead(bitHolder2, i));
          }
        }
  }
  else{
    return;
  }
}

sonnyyu

Writable 125KHz tag;-

EM4205/EM4305: 512 bit Read/Write Multi-purpose Contactless Identification Device

EM4200: 128 bit Read Only Low Frequency Contactless Identification Device (replacing EM4100, EM4102, EM4005, EM4105)

Writable HID tag;-

Google "clone HID rfid", I say nothing.

The proximity cards should already be programmed with the prox number ... it's the system controlling the doors that typically gets "programmed" with the card number so that when it is read, the system knows it is valid for access.

URl- http://www.idcardprintersavings.com/HID-Proximity-Cards-s/155.htm

Thank you!!!

Go Up