125K contactless ID card reader design

Views : 1674
Update time : 2019-04-02 15:28:09
0 Preface 

Radio Frequency Identification (RFID) is an automatic identification technology that uses inductive, electromagnetic or electromagnetic waves as a means of transmission to perform contactless two-way communication and acquire relevant data. The technology completes the identification work without manual intervention, is easy to realize automation and is not easy to damage, can recognize high-speed moving objects and can recognize multiple RF cards at the same time, and the operation is quick and convenient, and has been widely used.
Some card readers currently exist require a card reader chip as a base station, which is costly. This paper introduces a 125 kHz RFID reader with discrete components. The circuit structure is simple and the cost is very low. It is used to read the EM4100 ID card.

1 Classification of RFID systems

There are many classification methods for RFID systems. In normal applications, they are divided according to frequency. According to different working frequencies, they can be divided into the following four types:
(1) Low frequency (120 to 135 kHz). The frequency band has strong field penetration, unrestricted use, performance is not affected by the environment, and the price is low. The maximum recognition distance is generally less than 60 cm. It is mainly used in access control, "one card" consumption management, vehicle management and other systems;
(2) High frequency (10 to 15 MHz). Compared with the low frequency, this frequency band has the advantages of anti-collision and the ability to identify multiple tags at the same time, but its performance is affected by the environment. The recognition distance is generally less than 100 cm, which is mainly used in books management, logistics and other systems;
(3) Ultra high frequency (850 ~ 960 MHz). Compared with the higher frequency, the frequency band has the advantage of long-distance identification. The maximum recognition distance can reach 10 m, but its performance is greatly affected by the environment and the price is relatively expensive. It is mainly used for railway vehicle identification, container identification, etc. System
(4) Microwave (2.45 to 5.8 GHz). This band can be used for long-distance identification with a recognition distance of up to 100 m, but it is also the most expensive and is mainly used in intelligent transportation systems.

2 The composition of the RFID system

The RFID system generally consists of a reader, an electronic tag, and an antenna.

(1) Reader: A device that reads or reads/writes electronic tag information. The main task is to control the radio frequency module to transmit a read signal to the tag, and receive the response of the tag, decode the tag identification information, and tag the identification information. Other relevant information is transmitted to the host for processing. A typical reader includes a high frequency module (transmitter and receiver), a control unit, and a coupling element that is coupled to the transponder. In addition, many readers have additional interfaces (RS 232, RS 485, etc.) to transfer the acquired data to another system (such as a personal computer). The system block diagram is shown in Figure 1.

125K contactless ID card reader design - China Card

(2) Electronic tag (transponder): consists of a chip and a built-in antenna. The chip stores a certain format of electronic data and puts it on the recognized object as the identification information of the item to be identified. It is the real RFID system. A data carrier with an internal antenna for communication with the RF antenna. Typically, the transponder does not have its own power supply, and the transponder is active only within the reader's response range. The energy required for the transponder to operate is transmitted to the transponder via the coupling unit (non-contact).
(3) Antenna: A carrier for data transmission between a tag and a reader.

3 hardware circuit design

This design uses AVR series microcontroller ATmega8 as the microcontroller. Atmel's AVR is the first 8-bit microcontroller to truly use the RSIC architecture. It uses advanced technologies such as large fast access register sets, fast single-cycle instruction systems, and single-stage pipelines to make AVR microcontrollers up to 1 MLPS/ High-speed operation processing capability of MHz.

125K non-contact ID card reader design - China Card

The hardware circuit is shown in Figure 2. In Figure 2, 1 is the carrier generation and power amplifier circuit. The T/C2 of the MCU works in CTC mode to generate the standard 125 kHz carrier signal. After the current limiting resistor R1, it is sent to the push-pull type. The connected triode power amplifier circuit transmits the amplified carrier signal through the antenna. The antenna L1 and the capacitor C1 form a series resonant circuit with a resonant frequency of 125 kHz. The function of the resonant circuit is to obtain the maximum current on the antenna, thereby generating the maximum magnetic flux and obtaining a larger card reading distance. 2 is a detection circuit, which is used to remove the 125 kHz carrier signal and restore the useful data signal. R2, D1, R3, C2 form the basic envelope detection circuit, C3 is the coupling capacitor, R4, C4 are low-pass filter circuits, D2, D3 are protection diodes, and the output is connected to the filter amplifier circuit. 3 is a filter amplifier circuit, the filter amplifier circuit uses the integrated operational amplifier LM358 to filter and shape the detected signal, and the amplified signal is sent to the input capture pin ICP1 of the timer/counter T1 of the single chip microcomputer, and the received signal is received by the single chip microcomputer. Decoding is performed to obtain the card number of the ID card.

4 software design

The software design of this system consists of two parts: 125 kHz carrier generation and ID card decoding. The carrier signal generation is relatively simple, and the T/C2 of the single-chip microcomputer can be used to operate in the CTC mode. When the comparison is matched, the output OC2 is inverted to obtain a square wave of 125 kHz. The decoding software design is relatively complicated. To decode the ID card, firstly, the storage format and data encoding mode of the ID card should be mastered.

4.1 EM4100 data storage format

Figure 3 is the 64-bit data information of the EM4100, which consists of 5 areas: 9 leading bits, 10 row even parity bits "PO ~ P9'', 4 column even parity bits "PC0 ~ PC3", 40 Data bits "D00 ~ D93" and 1 stop bit S0. The 9 boot bits are masked in the chip at the factory, and the value is "111111111". When it outputs data, it first outputs 9 guide bits. Then, there are 10 sets of data strings consisting of 4 data bits and 1 row parity bit, followed by 4 column even parity bits, and finally stop bit "0". "D00~D13" is an 8-bit The crystal version number or ID identification code. "D20 ~ D93" is 8 sets of 32-bit chip information, that is, the card number.

Whenever the EM4100 transmits 64 information bits, as long as the ID card is still in the working area of ​​the card reader, it will send 64-bit information again in the order of Figure 3, and repeats until the ID card exits the valid work of the card reader. region.

4.2 EM4100 data encoding method

The EM4100 uses Manchester encoding, as shown in Figure 4: Bit data "1" corresponds to the level down, and bit data "0" corresponds to the level jump. In a series of data transmission data sequences, two adjacent bit data transmission transition time intervals should be 1P. If the adjacent bit data has the same polarity (the adjacent two bits are both "O" or "1"), there is a non-data transfer, preliminary between the level transitions of the two bit data transfer. (Level) "Empty jump". The upper, lower, and outer jumps of the level are criteria for determining the characteristics of the bit data transfer. In the Manchester code modulation mode, the time each MT100 transmits one bit of data is 64 oscillation periods, and its value is determined by RF/n. If the carrier frequency is 125 kHz, the time per bit transmitted is 64 divisions of the oscillation period, that is, the bit transmission time is: 1P=64/125 kHz=512 μs, and the time of half cycle is 256 μs.

4.3 decoding software design

The input capture function of the AT/megacontroller T/C1 is a very special feature of the AVR timer/counter. The T/C1 input capture unit can be used to accurately capture the occurrence of an external event and record the time stamp of the event. When an input capture event occurs, the count value in the counter TCNT1 of T/C1 is written into the input capture register ICR1, and the input capture flag bit ICF1 is set to generate an interrupt request. The input capture signal trigger mode can be set by setting the sixth bit ICES1 of the register TCCR1B. The system uses the input capture function of the single chip to decode.
According to the Manchester coding feature, each bit of data consists of a half cycle high level and a half cycle low level, so one bit of data can be split into two bits, that is, the bit data "1" can be regarded as "10". The bit data "O" can be regarded as "01", and the 64-bit data can be regarded as consisting of 128 bits. In order to obtain a complete and continuously stored 64-bit ID information, two rounds of complete 64-bit data are received here, ie 256 bits are received. Then the last stop received by the stop bit must be the start bit received by the current round, and the starting sync head is found accordingly. According to the characteristics of the Manchester code, the valid data of the ID card is obtained ("10" is decoded as "1"; "01" is decoded as "O") and the LCR check is performed. If the check is correct, the ID card number is output to the PC. And prepare for the next decoding; otherwise, directly prepare for the next decoding. In addition, in the program first define an array bit [256] to store the received data; define a variable flag to mark the completion of 256-bit data reception; define a variable error to mark the verification error. Since the ID card is close to the valid working area of ​​the card reader, the input of the MCU input capture pin is high. Therefore, it is set to the falling edge trigger in the main program, the counter TCNTl is cleared, and the input of T/C1 is turned on. Capture function. The main program flow chart is shown in Figure 5.

Define a trigger edge flag tr=1 (used to indicate the trigger caused by the falling edge) in the input capture interrupt program, and define an unsigned character variable i to count the number of received data, due to unsigned Character data ranges from 0 to 255, so when 256 bits are received, the value of i becomes 0 again. Then, it is judged whether it is a legal jump. From the above analysis, the time of the level jump is 256 μs or 512 μs as a legal jump. This system uses an 8 MHz clock. If T/C1 is set to no prescaler, the system cycle is O. For 125μs, the corresponding count value of 256μs should be 2 048, and the corresponding count value of 512μs should be 4 096. Taking the count value TCNTl less than 5,000 is the legal transition basis. If TC-NT1 is greater than 5,000, it is considered to be an illegal jump caused by the interference signal, and it is ignored. The TCNT1 is between 3,000 and 5,000. 512μs jump basis. If it is a legal transition, it is considered to receive a bit of data "1" because it is a falling edge triggered interrupt; if it is a legal transition and 3 000 < TCNTl < 5,000, it is considered that two bits of data "1" are received.
Then change the input capture trigger mode to the rising edge trigger, and set the trigger edge flag tr=0 (used to indicate the trigger caused by the rising edge). A similar operation is performed when the interrupt is triggered by a rising edge. Figure 6 is a flow chart of the interrupt handler.

  5 Conclusion 

The power amplifier and the detection part of the design hardware circuit are composed of discrete components, no need to read the card base station chip, the circuit structure is simple, and the cost is extremely low; the software part is written in C language, and a decoding method of Manchester coding is proposed. Since the transmission distance of RS 232 is only 15 m at the maximum, for the occasion where long-distance data transmission is required, the RS 485 circuit can be added to increase the transmission distance, thereby realizing long-distance data acquisition and implementing related control. In some applications that require a far-reaching card reading distance, the efficiency of the power amplifier can be improved by improving the power amplifying circuit (for example, using a class D power amplifying circuit), thereby increasing the transmitting power and increasing the card reading distance. Through the test, the system can successfully read the EM4100 ID card. After fine-tuning the antenna, the maximum reading distance can reach 15 cm, and the card reading is stable and the success rate is high. It can be applied to systems such as access control and public transportation.
Related News
Mobile nursing information system for patient identification using wristbands and PDAs Mobile nursing information system for patient identification using wristbands and PDAs
Mar .26.2019
SATO applies barcode and RFID technology to patient wristbands, infusion labels, pathology labels and specimen labels, and prints information using barcode printers.
The PDA mobile terminal scans the wristband or label information to quickly and accurate
what is RFID wet inlays RFID Dry Inlays and RFID stickers what is RFID wet inlays RFID Dry Inlays and RFID stickers
Mar .20.2019
RFID wet inlays are passive RFID inlays with an adhesive backing that can be either applied to a product directly or converted into smart labels (integrated into a paper or plastic label). “Dry” inlay does not include the adhesive layer. Wet inlays are lo
One Shoulder Chiffon Pleated Kesen Length Real Image Bridesmaid Dress One Shoulder Chiffon Pleated Kesen Length Real Image Bridesmaid Dress
Mar .11.2015
One Shoulder Chiffon Pleated Kesen Length Real Image Bridesmaid Dress One Shoulder Chiffon Pleated Kesen Length Real Image Bridesmaid Dress One Shoulder Chiffon Pleated Kesen Length Real Image Bridesmaid Dress
Rfidttx u00a9 All Rights Reserved.    POWERED BY UEESHOP