by philba » Tue Feb 14, 2012 10:31 pm
Yeah, there are 2 lengths of card IDs - this is because most companies want greater security with longer IDs. It gets worse because there is no standard for the layout of the bits. The 36 bit codes can have 4 parity bits spread in several different locations. So, you can't simply extract the id number from the card without knowing the format. I wouldn't worry about it, just take the whole id number, parity bits and all, and use that as your database index. I've never seen any read errors. The wiegand interface and protocol is ridiculously resilient - it's like 500 baud with 50 uS wide data pulses on one of two data lines. If you see pulses on both lines - reject it. I bet it would withstand an EMP! (ok, probably not...). Yes, you will have to swipe a card once to record it rather than just reading the tag number off the card (though many don't actually have it printed) but I've always felt that's a better approach anyway.
See my comment about how you can read the wiegand device without knowing the length in advance. I've tested this technique and it works nicely. Sorry, I don't have the code to give out but it really is pretty easy to write.