View Full Version : Wiegand how to read the pulses?

11-13-2009, 11:38 PM
Hello everyone:

I am trying to do a project with BS2. The point is to use a generic RFID reader with the Wiegand protocol. I’ve read through the forum and have found that BS2 is not fast enough to get the pulses of the reader with that protocol. Unfortunately I cannot change the microcontroller, like suggested in other post, so I was thinking in somehow make the pulses last longer.

The first idea that came to my mind was to change the pulses with a “NOT” and use a capacitor that could charge in the few microseconds the Wiegand pulse last, and that it discharge in about 1ms or something like that, so that the SB2 could have time to read it, and the next pulse is not missed.

Another idea is to use a 555 monostable that with each pulse it will trigger, and make this state last, again, about 1ms in hopes that BS2 can read it.

I am really not sure anything like this would work. Any other ideas? Thanks for your help.

Berenice Beltran

Mike Green
11-14-2009, 12:30 AM
You can certainly use some kind of pulse stretcher as you suggest. The problem is that the pulses are coming in about once a millisecond and that's about as fast as a Stamp can handle. This website (www.emesystems.com (http://www.emesystems.com) - click on "app-notes" near the bottom) has a long discussion about Stamp timing and execution speed. The very simplest statements execute in about 150us, but it doesn't take much to exceed 1ms.

One possibility would be to use an external shift register clocked by the leading edge of the "or" of "data0" and "data1" with some extra delay in the clock line (the other sections of a triple-or gate) and the data line connected to "data1". You'd need 4 ICs like a 74HC595 plus a triple 3-in OR gate. The other OR input would be controlled by the Stamp so it could also shift the register (to read it out).

11-14-2009, 03:48 AM
Thank you very much Mike. Although I didn't understand quite well how you suggest me to conect everything, I did understand that I should use 4 IC that capture 8 bits each, in order to capture the 26-bit chain that the reader sends. I assume that then I should read the values from the latches and clear them again for the next values to come.

I hope I got your idea right, I will look through it and let you know if it worked.

Thanks again

Mike Green
11-14-2009, 04:13 AM
There are two ways of reading the 74HC595s. You can use the output enable pins to enable each 8-bit shift register in turn onto an 8-bit bus formed by 8 Stamp I/O pins. That would require a total of 12 I/O pins from the Stamp. You could also use a 13th I/O pin to clear all 4 shift registers. The four 74HC595s would be wired in series to form a 32-bit shift register.

Another way would be for the Stamp to produce a serial clock using the SHIFTOUT statement and clock out the 32 bits when the Wiegand lines are quiet (idling at high).