EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Wiegand Protocol and BX-24

Started by Lewis October 21, 2007
The question is: Is there any direct method that a BX-24 running
BasicX can read the Wiegand data stream from a HID 125kHz RFID (radio
frequency identification) reader.

First let me say that I am possiblely the most "EE" ignorant
individual to have ever have touched a microprocessor. Second let me
say that I have failed miserablely in this quest. Here is my
tail of woes .

We want to record clockin and clockout times using the same RFID cards
that are used by our entry control system. The idea is to read the
cards and transmit the data to a central PC. We also want to employee
to be able to see that the time event was actually recorded via a LCD
display.

The Wiegand Protocol facts (as best I can figure out). The hardware
uses five wires: Power (+5VDC), Data1, Data2, Ground, LED control. The
latter is being ignored. Both data lines are normally held at +5
Volts. One data line pulses zeros the other pulses ones by driving
the line to zero volts for somewhere between 20 to 50 microseconds
(1/1000000). There is a period of around 20 milliseconds (1/1000)
between pulses. The exact timing varies by device (nothing like
consistency). The standard data packet is 26 bits including leading
and trailing parity bits. A later standard uses 36 bits and it is
possible to have up to around 60 bits.

Plan A:
Hang a Intel based PC running Windows XP on the wall with a 15 inch
LED display and use a PCPROX reader. Way overkill.

Plan B:
Get a parallax basic stamp and beat the heck out of two pins reading
the current levels . Not nearly fast enough.

Plan C:
Get a parallax SX and beat the heck out of two pins reading the
current levels or better yet use the pin interrupts. This might work
if I had a year to figure out how to write the assembly language and
work out the timing.

Plan D:
Get a NewMedia BX-24 and beat the heck out of two pins reading the
current levels . Not nearly fast enough.

Plan E:
Use the BX-24 interrupt PIN to get some basic data about this
particular RFID reader.
(1)Using WaitForInterrupt and PulseIn I get durations of 36 for the
pulse and 1900 for the period. (2) Using WaitForInterrupt and
CountTransitions I get 14 on Data1 and 36 on Data2. Assume I have lost
a transition or two between the lines and that looks like 26 bits.

Plan F:
The WaitForInterrupt works. Problem is there is only one interrupt and
two data lines. If I had an AND gate I might be able to use the
interrupt to know when to read the data pins. I do not have an AND
gate but maybe I could rig one with parts from the local electronics
shop (Radio Shack is the only thing handy):

"AND Gate" from Diodes:
http://en.wikipedia.org/wiki/Diode_logic
http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/and.html
Well I totally shot another day trying get these and a few other
approaches to work to no avail.

Question: If I could get a single Interrupt would the BX-24 be fast
enough to read the two pins and determine if it was a one or zero ?
`-----------------------
Public Sub ReadRFID ()
Dim A as Byte
Dim B as Byte
Dim C as Byte
Call WaitForInterrupt (24) ' falling edge
C=GetPin(11)
A=getPin(14)
B=GetPin(13)
Debug.Print "ABC, ";CStr(A);CStr(B);Cstr(C)
End Sub
`-----------------------
Output: ABC, 111
`-----------------------
Answer: No.

Plan G:
Plan "A" is beginning to look better. I am building a fine collection
of microcontrollers. I may add a ZX-24a with Pin Change Interrupts on
all I/O lines.

OK, people feel free to take a shot at me, impune my character, call
me to a senile old fool (I will admit that one) and tell me I am not
smarter that a 5th grader but please tell me if I have missed
something. Can this be done with a BX-24 ?

SIDE NOTE:
A positive thing to come out of this is I managed to put together a
BasicX API for the parallax LCD displays. I have placed a copy of the
sources files in the files section for anyone who might be interested.

LASTLY: Have a nice day.
Lewis-

I have interfaced a number of uPs to weigand inputs in my time......always found it best to put a bit of hardware between the inputs and the uP to catch and stretch the very short pulses....needs a very short ISR latency to respond and see the pulse before it goes away.
I usually NAND the two lines to generate a common clock/interrupt line, and use that to clock either a D flip/flop or a serial shift register, with one of the data lines in the D input.
With a single D flip/flop, you will need to capture the data in the ISR before the next pulse, with a 26 bit shift register you can wait unti lthe bit stream is complete before reading into the uP.

Cheers,
Stuart Parker
www.sparxfly.co.nz

----- Original Message ----
From: Lewis
To: b...
Sent: Sunday, 21 October, 2007 3:56:25 PM
Subject: [BasicX] Wiegand Protocol and BX-24

The question is: Is there any direct method that a BX-24 running
BasicX can read the Wiegand data stream from a HID 125kHz RFID (radio
frequency identification) reader.

First let me say that I am possiblely the most "EE" ignorant
individual to have ever have touched a microprocessor. Second let me
say that I have failed miserablely in this quest. Here is my
tail of woes .

We want to record clockin and clockout times using the same RFID cards
that are used by our entry control system. The idea is to read the
cards and transmit the data to a central PC. We also want to employee
to be able to see that the time event was actually recorded via a LCD
display.

The Wiegand Protocol facts (as best I can figure out). The hardware
uses five wires: Power (+5VDC), Data1, Data2, Ground, LED control. The
latter is being ignored. Both data lines are normally held at +5
Volts. One data line pulses zeros the other pulses ones by driving
the line to zero volts for somewhere between 20 to 50 microseconds
(1/1000000). There is a period of around 20 milliseconds (1/1000)
between pulses. The exact timing varies by device (nothing like
consistency) . The standard data packet is 26 bits including leading
and trailing parity bits. A later standard uses 36 bits and it is
possible to have up to around 60 bits.

Plan A:
Hang a Intel based PC running Windows XP on the wall with a 15 inch
LED display and use a PCPROX reader. Way overkill.

Plan B:
Get a parallax basic stamp and beat the heck out of two pins reading
the current levels . Not nearly fast enough.

Plan C:
Get a parallax SX and beat the heck out of two pins reading the
current levels or better yet use the pin interrupts. This might work
if I had a year to figure out how to write the assembly language and
work out the timing.

Plan D:
Get a NewMedia BX-24 and beat the heck out of two pins reading the
current levels . Not nearly fast enough.

Plan E:
Use the BX-24 interrupt PIN to get some basic data about this
particular RFID reader.
(1)Using WaitForInterrupt and PulseIn I get durations of 36 for the
pulse and 1900 for the period. (2) Using WaitForInterrupt and
CountTransitions I get 14 on Data1 and 36 on Data2. Assume I have lost
a transition or two between the lines and that looks like 26 bits.

Plan F:
The WaitForInterrupt works. Problem is there is only one interrupt and
two data lines. If I had an AND gate I might be able to use the
interrupt to know when to read the data pins. I do not have an AND
gate but maybe I could rig one with parts from the local electronics
shop (Radio Shack is the only thing handy):

"AND Gate" from Diodes:
http://en.wikipedia .org/wiki/ Diode_logic
http://hyperphysics .phy-astr. gsu.edu/hbase/ electronic/ and.html
Well I totally shot another day trying get these and a few other
approaches to work to no avail.

Question: If I could get a single Interrupt would the BX-24 be fast
enough to read the two pins and determine if it was a one or zero ?
`----------- --------- --------- --------- --------- --------- --
Public Sub ReadRFID ()
Dim A as Byte
Dim B as Byte
Dim C as Byte
Call WaitForInterrupt (24) ' falling edge
C=GetPin(11)
A=getPin(14)
B=GetPin(13)
Debug.Print "ABC, ";CStr(A);CStr( B);Cstr(C)
End Sub
`----------- --------- --------- --------- --------- --------- --
Output: ABC, 111
`----------- --------- --------- --------- --------- --------- --
Answer: No.

Plan G:
Plan "A" is beginning to look better. I am building a fine collection
of microcontrollers. I may add a ZX-24a with Pin Change Interrupts on
all I/O lines.

OK, people feel free to take a shot at me, impune my character, call
me to a senile old fool (I will admit that one) and tell me I am not
smarter that a 5th grader but please tell me if I have missed
something. Can this be done with a BX-24 ?

SIDE NOTE:
A positive thing to come out of this is I managed to put together a
BasicX API for the parallax LCD displays. I have placed a copy of the
sources files in the files section for anyone who might be interested.

LASTLY: Have a nice day.
Thank you Stuart.
The idea of the D flip/flop seems a little more in line with what I am
trying to do. That would allow some flexibility to read tags of any
number of bits. Looks like I need to order few bits of hardware.
--- In b..., Stuart Parker wrote:
>
> Lewis-
>
> I have interfaced a number of uPs to weigand inputs in my
time......always found it best to put a bit of hardware between the
inputs and the uP to catch and stretch the very short pulses....needs
a very short ISR latency to respond and see the pulse before it goes away.
> I usually NAND the two lines to generate a common clock/interrupt
line, and use that to clock either a D flip/flop or a serial shift
register, with one of the data lines in the D input.
> With a single D flip/flop, you will need to capture the data in the
ISR before the next pulse, with a 26 bit shift register you can wait
unti lthe bit stream is complete before reading into the uP.
>
> Cheers,
> Stuart Parker
> www.sparxfly.co.nz
Hi,
I found this company that make converters for the Wiegan protocol. Attached are two
link.
One is the site and the other is the brochure for Wiegand converter.
You can set the output to RS- 232.
http://www.cypressworld.com/CD/PDF/cutsheet/CVXCutSheet.pdf

http://www.cypressworld.com/index.htm?p=spec&cat=CVX-1200

rosarite


-----Original Message-----
From: Lewis
To: b...
Sent: Sat, 20 Oct 2007 9:56 pm
Subject: [BasicX] Wiegand Protocol and BX-24






The question is: Is there any direct method that a BX-24 running

BasicX can read the Wiegand data stream from a HID 125kHz RFID (radio

frequency identification) reader.

First let me say that I am possiblely the most "EE" ignorant

individual to have ever have touched a microprocessor. Second let me

say that I have failed miserablely in this quest. Here is my

tail of woes ….

We want to record clockin and clockout times using the same RFID cards

that are used by our entry control system. The idea is to read the

cards and transmit the data to a central PC. We also want to employee

to be able to see that the time event was actually recorded via a LCD

display.

The Wiegand Protocol facts (as best I can figure out). The hardware

uses five wires: Power (+5VDC), Data1, Data2, Ground, LED control. The

latter is being ignored. Both data lines are normally held at +5

Volts. One data line pulses zeros the other pulses ones by driving

the line to zero volts for somewhere between 20 to 50 microseconds

(1/1000000). There is a period of around 20 milliseconds (1/1000)

between pulses. The exact timing varies by device (nothing like

consistency). The standard data packet is 26 bits including leading

and trailing parity bits. A later standard uses 36 bits and it is

possible to have up to around 60 bits.

Plan A:

Hang a Intel based PC running Windows XP on the wall with a 15 inch

LED display and use a PCPROX reader. Way overkill.

Plan B:

Get a parallax basic stamp and beat the heck out of two pins reading

the current levels …. Not nearly fast enough.

Plan C:

Get a parallax SX and beat the heck out of two pins reading the

current levels or better yet use the pin interrupts. This might work

if I had a year to figure out how to write the assembly language and

work out the timing.

Plan D:

Get a NewMedia BX-24 and beat the heck out of two pins reading the

current levels …. Not nearly fast enough.

Plan E:

Use the BX-24 interrupt PIN to get some basic data about this

particular RFID reader.

(1)Using WaitForInterrupt and PulseIn I get durations of 36 for the

pulse and 1900 for the period. (2) Using WaitForInterrupt and

CountTransitions I get 14 on Data1 and 36 on Data2. Assume I have lost

a transition or two between the lines and that looks like 26 bits.

Plan F:

The WaitForInterrupt works. Problem is there is only one interrupt and

two data lines. If I had an AND gate I might be able to use the

interrupt to know when to read the data pins. I do not have an AND

gate but maybe I could rig one with parts from the local electronics

shop (Radio Shack is the only thing handy):

"AND Gate" from Diodes:

http://en.wikipedia.org/wiki/Diode_logic

http://hyperphysics.phy-astr.gsu.edu/hbase/electronic/and.html

Well I totally shot another day trying get these and a few other

approaches to work to no avail.

Question: If I could get a single Interrupt would the BX-24 be fast

enough to read the two pins and determine if it was a one or zero ?

`----------------------

Public Sub ReadRFID ()

Dim A as Byte

Dim B as Byte

Dim C as Byte

Call WaitForInterrupt (24) ' falling edge

C=GetPin(11)

A=getPin(14)

B=GetPin(13)

Debug.Print "ABC, ";CStr(A);CStr(B);Cstr(C)

End Sub

`----------------------

Output: ABC, 111

`----------------------

Answer: No.

Plan G:

Plan "A" is beginning to look better. I am building a fine collection

of microcontrollers. I may add a ZX-24a with Pin Change Interrupts on

all I/O lines.

OK, people feel free to take a shot at me, impune my character, call

me to a senile old fool (I will admit that one) and tell me I am not

smarter that a 5th grader … but please tell me if I have missed

something. Can this be done with a BX-24 ?

SIDE NOTE:

A positive thing to come out of this is I managed to put together a

BasicX API for the parallax LCD displays. I have placed a copy of the

sources files in the files section for anyone who might be interested.

LASTLY: Have a nice day.

The 2024 Embedded Online Conference