Arduino Wiegand Decoder for HID RFID Reader
A few people have asked me more about interfacing with HID RFID readers. Although I have already published a wiegand decodering using a PIC, that was my first microcontroller project ever, and I was using some custom hardware that was made by someone else (it was a generic board for PIC18's made by a friend). If you're starting from scratch, it wouldn't be particularly easy to re-implement that code. I decided to make a wiegand decoder using the Arduino, since it's a very popular development platform and a lot of people already have the hardware for it.
Operation
This program will decode the wiegand data from a HID RFID Reader (or, theoretically, any other device that outputs wiegand data). The Wiegand interface has two data lines, DATA0 and DATA1. These lines are normall held high at 5V. When a 0 is sent, DATA0 drops to 0V for a few us. When a 1 is sent, DATA1 drops to 0V for a few us. There is usually a few ms between the pulses.
This project was made with an Arduino Uno and a HID RFID reader. Your reader should have at least 4 connections (some readers have more). Connect the Red wire to 5V. Connect the black to ground. Connect the green wire (DATA0) to Digital Pin 2 (INT0). Connect the white wire (DATA1) to Digital Pin 3 (INT1). That's it!
Operation is simple - each of the data lines are connected to hardware interrupt lines. When one drops low, an interrupt routine is called and adds the bits to a buffer. After some time of not receiving any bits, the Arduino will decode the data and output it over serial. I've only added the 26 bit and 35 bit formats, but you can easily add more. For more information about data formats, check out this page.
This was my second Arduino project, and I'm always amazed at how simple it is to get things up and running. It only took me an hour! I especially like having easy functions such as attachInterrupt, as it's much easier than hunting down registers on a PIC or boot.tpl files on a PSoC.
Project Downloads
January 2012 @ GT