Back to Top

RFID access zone using Pic microcontroller

Introduction

In the following page i will present you an RFID reader connected to a pic microcontroller. The pic microcontroller is the pic16LF1939 from microchip and the Rfid reader is the MiniProx 5365 from HID global Secure Identity Solutions. Their datasheets can be downloaded from here and here. The pic runs at 16mhz internal clock speed and the oscillation frequency of the Rfid reader is 125mhz. The communication between the pic and the reader is accomplished through the WIEGAND protocol.
I will provide extra info of how this protocol works below.

Photos

Below you can see the circuit on a breadboard. In a few days i will upload the video and a small pcb with smd components i did for the project.

Image not found...
The circuit running on a breadboard.

Schematic Diagram

In the schematic diagram i have placed a relay, you can either connect whatever you wish.

CAUTION !!!!!
IF YOU WILL USE AN ELECTRIC STRIKE AS I DID IN MY VIDEO BEWARE SOME ELECTRIC STRIKES CREATE VERY
STRONG (E.M.P) AND CAUSES THE PIC TO RESET WHEN THE ELECTRIC STRIKE DISARMS.


*E.M.P: Electro Magnetic Pulse

* Placing an inductor wrapped on ferrite is very effective solution to the particular problem.

Image not found...
The schematic diagram.

Materials

Resistors
R1-R4 Resistor 330 Ohm 1/4 Watt
R5 Resistor 10 KOhm 1/4 Watt
R6 Resistor 2.2 KOhm 1/4 Watt
Capacitors
C1 Electrolytic Capacitor 10 uF 35 Volts
C2 Electrolytic Capacitor 100 uF 25 Volts
Diodes
D1 1N4007 General Purpose Diode Rectifier
Transistors
Q1 BD679 (NPN Silicon Darlington Transistor)
Intergrated Circuits (Ic's)
IC1 PIC 16LF1939 Microcontroller
IC2 MCP1702 (250 mA Low Quiescent Current LDO Regulator)

Video

Here's the video with the circuit in action.....Enjoy!

Capturing the pulses

That was a little bit tricky!!!.Since there was the first time interfacing with these readers cards and protocols Kam (pcbheaven) brought me his oscilloscope in order to see what's the readers output when reads a card. We took a pattern similar to this.....

Image not found...

And i say similar to this because i cannot remember if the bits were same as the drawing bits i drew.
The 37 bits were received in 80msec.
Bit from bit has 2msec delay
And each bit has a duration of 40μsec

References

Wiegand Protocol

The Wiegand interface consists of three wires called

Data Zero (usually green),
Data One (usually white), and
Data Return (usually black).

The three wires carry Wiegand data, also called the Wiegand signal.
Since the card data is binary, the reader simply receives the radio frequency (RF) data from the card, and translates it from RF to Wiegand

The article below was copied from Wikipedia.
"The communications protocol used on a Wiegand interface is known as the Wiegand protocol. The original Wiegand format had one parity bit, 8 Many access control system manufacturers adopted Wiegand technology but were unhappy with the limitations of only 8 bits site codes (0-255) and 16 bits for card numbers 0-65535)so they designed their own formats with varying complexity of field numbers and lengths and parity checking. The physical size limitations of the card dictated that a maximum of 37 wiegand wire filaments could be placed in a standard credit card as dictated by CR80 or ISO/IEC 7810 standards before misreads would effect reliability hence most Wiegand formats used in physical access control are less than 37 bits in length.
An advantage of the Wiegand signaling format is that it allows very long cable runs, far longer than other interface standards of its day allowed."



Data Signals

Figure 1 below displays the timing pattern for data bits sent by the reader to the access control panel.
This timing pattern falls within the Wiegand guidelines as proscribed by the SIA's Access Control Standard Protocol for the 26-Bit Wiegand Reader Interface
(a Pulse Width time between 20 uS and 100 uS, and a Pulse Interval time between 200 uS and 20 mS).
The Data 1 and Data 0 signals are held at a logic high level (above the Voh level) until the reader is ready to send a data stream.
The reader places data as asynchronous low-going pulses (below the Vol level) on the Data 1 or Data 0 lines to transmit the data stream to the access control panel
(the "saw-teeth" in Figure 1).
The Data 1 and Data 0 pulses will not overlap or occur simultaneously. Below the schematic is provided the minimum and maximum allowable pulse width times
(the duration of a pulse) and pulse interval times (the time between pulses) for Pyramid Series Readers.

Image not found...
Tpw : Pulse Width Time = 100 μs
Tpi : Pulse Interval Time = 1 ms


HID Wiegand Protocol (Taken from HID)

So as you read to the article above,manufacturers created their own protocol depending of their needs.
HID uses both the the Standard 26-Bit Format and the Corporate 1000 format consisting of 35 bits with 2 more parity birs. HID gives a variety of formats and i will post some here just for mention.

The Standard 26-Bit Format
The format in which a card is programmed is determined by the data pattern that will be compatible with the access control panel.
All HID credentials (card, fobs, tags, etc.) can be programmed with the standard 26-bit card data format. The Standard 26-bit Format is an Open Format.
An Open Format means that anyone can buy HID cards in a specific format and that specific format description is publicly available.
The 26-bit format is a widely used industry standard and is available to all HID customers. Almost all access control systems accept the standard 26-bit format.
26-bit originated with true Wiegand swipe card technology. The Standard 26-bit format has 255 possible facility codes from one to 255.
There can be up to 65,535 card ID numbers, from one to 65,535, per facility code. The total number of cards that can use the entire range without duplication is 16,711,425. There are no restrictions on the use of this format. It is not documented by HID and HID does not restrict duplication of card numbers. Image not found...

* The maximum Facility Code is 255 because if all eight Facility Code bits are set to ones, they equal 255 decimal.
* The maximum Card Number is 65,535 because when all sixteen Card Number field bits are ones, it equals decimal 65,535.

A NOTE ON PARITY: A parity bit is used as a very simple quality check for the accuracy of the transmitted binary data. The designer of the format program will decide if each parity bit should be even or odd. A selected group of data bits will be united with one parity bit, and the total number of bits should result in either an even or odd number. In the example above, the leading parity bit (even) is linked to the first 12 data bits. If the 12 data bits result in an odd number, the parity bit is set to one to make the 13-bit total come out even. The final 13 bits are similarly set to an odd total


Other Hypothetical Formats
To further clarify how formats may be organized, we present two additional hypothetical examples.
NOTE: Since actual formats do require a varying degree of security, we will only present hypothetical examples with the exception of standard 26-bit In the standard 26-bit format, H10301, or the programmable field is specified as the Facility Code. The incrementing field is called the Card Number.
These data groupings can have many different names depending upon which format is under discussion. The same name usually means something different from format to format. Therefore, another hypothetical format could look like this:

Image not found...

The Leading Parity bit could relate to one subset of the data string and the Second Parity bit relate to an entirely different subset. This format also has fields named Facility Code and Card Number, but if you compare it to H10301, its format is very different, and would probably not work on a customer's system that was setup for H10301. The person who creates the format's unique field names has the ability to assign the names as well. Review the following hypothetical format:

Image not found...

This format has three parity bits, a five-bit programmable field called Job Number, another four-bit programmable field called Run Code, and an 18-bit incrementing field called Employee Number


Corporate 1000
HID offers a unique card data format program named Corporate 1000, where the end user owns the unique format and HID guarantees that the customer's format will not be duplicated. Furthermore, the customer must provide written authorization to HID for an integrator or distributor, etc. to be able to purchase the specified Corporate 1000 cards from HID. This gives the customer absolute control over the manufacture, distribution and delivery of their specific cards. Additional Corporate 1000 facts:

* The customer's access control panels must be capable of decoding the Corporate 1000 format.
* All Corporate 1000 formats are 35 bits long but the data will be arranged in different increments along that 35-bit string.

A card number, for example, may be broken into three or more parts and randomly spaced along the string. This ensures uniqueness in every Corporate 1000 format.

* HID currently manages several hundred unique Corporate 1000 formats and many more are still readily available.
* As with all other formats, Corporate 1000 formats are identical in 125 kHz Prox and 13.56 MHz iCLASS contactless smart card technology.