introduction
Radio frequency identification technology (RFID) has been rapidly popularized and promoted for its high security and confidentiality, high-speed communication, ease of use, and low cost. It has been widely used in various access control systems, public transportation payment systems, medical insurance systems, parking management systems, warehouse management, vehicle anti-theft, etc., and has driven the development and promotion of readers and various application products. Based on the analysis of the composition and principle of the radio frequency identification system, this paper proposes a radio frequency reader design based on the STC11F32 high-speed microcontroller and the MFRC500 chip; at the same time, the dot matrix graphic LCD and serial memory W25X80, as well as USB chip CH340T and other peripheral devices are expanded on the card reader. The LCD can display various graphics and Chinese characters; the serial memory is used to store dot matrix fonts, graphic libraries, etc.; the USB chip enables the card reader to omit the serial port and power supply port, and can communicate with the PC management software through the USB interface. The card reader is easy to use, low cost, stable circuit operation, and can be applied to various occasions.
1 Composition and basic principles of RF reading and writing system
The most basic RFID system consists of 3 parts:
① Electronic tag (Tag, or RFID tag), composed of a chip and a built-in antenna. The chip stores electronic data in a certain format, which serves as the identification information of the item to be identified and is the real data carrier of the RFID system. The built-in antenna is used to communicate with the RFID antenna.
② Reader, a device that reads and writes electronic tag information. Its main task is to control the RF module to transmit a read signal to the tag and receive the tag's response; decode the tag's object identification information, and transmit the object identification information and other related information on the tag to the host for processing.
③Antenna: the transmitting and receiving device for transmitting data between the tag and the reader.
The basic principle of the radio frequency reading and writing system is as follows: the reader sends a set of electromagnetic waves of fixed frequency to the card. There is an LC series resonant circuit in the card, and its frequency is the same as the frequency emitted by the reader. Under the stimulation of the electromagnetic wave, the LC resonant circuit resonates, so that there is charge in the capacitor. A unidirectional electron pump is connected to the other end of this capacitor to send the charge in the capacitor to another capacitor for storage. When the accumulated charge reaches 2 V, this capacitor can be used as a power supply to provide working voltage for other circuits, transmit the data in the card or access the data of the reader.
2 Card Reader Hardware Design
STC11F32 is a single clock/machine cycle (1T) microcontroller produced by Hongjing Technology Co., Ltd. It is a new generation of 8051 microcontroller with high speed, low power consumption and super anti-interference ability. The instruction code is fully compatible with the traditional 8051, but the speed is 8 to 12 times faster. It has an internal integrated high-reliability reset circuit and can be used in high-speed communication, intelligent control, strong interference and other occasions; it has 32 KB Flash, 29KB EEPROM and 1 280 bytes of SRAM; EA, ALE, PSEN and RST pins can be defined as general I/O, that is, 4 P4 pins; programming supports ISP download function, which is convenient to use.
MFRC500 is a member of Philips' highly integrated card reader IC series for 13.56 MHz contactless communication. This card reader IC series uses advanced modulation and demodulation concepts to fully integrate all types of passive contactless communication methods and protocols at 13.56 MHz. MFRC500 supports all layers of ISO 14443A. The internal transmitter part can directly drive the antenna at a short operating distance (up to 10 cm) without adding active circuits; there are many ways to interface with the microcontroller, either using bus extension or analog bus.
In order to use the 1 KB extended SRAM inside STC11F32, the analog bus interface is used, that is, the P0 port of the microcontroller is connected to the D0~D7 of MFRC500, and EA, ALE, WR, RD, etc. are used as control lines to connect to the NCS, ALE, NWR, NRD, etc. of MFRC500 respectively. Because it is an analog bus method, a pull-up resistor must be added to the P0 port of the microcontroller. Using the analog bus method is a common method, especially for microcontrollers that do not support bus expansion. The use of the analog bus method in this design can prevent bus conflicts between MFRC500 and the RAM inside the microcontroller. Figure 1 is the system hardware schematic diagram of the card reader.
Click to see the original image
CH340T is a USB bus adapter chip produced by Nanjing Qinheng Company. It can realize USB to serial port conversion and is used to expand asynchronous serial ports for computers, or directly upgrade ordinary serial port devices to USB bus. CH340T is a full-speed USB device interface, compatible with USB V2.0. Peripheral components only require crystals and capacitors. The hardware is a full-duplex serial port with a built-in transceiver buffer, supporting communication baud rates of 50 bps to 2 Mbps. It supports commonly used Modem communication signals RTS, DTR, DCD, RI, DSR, etc. CH340T eliminates the serial port and power supply port for the card reader, and can communicate with PC management software through the USB interface.
The LCD uses a dot matrix graphic LCD module FG12864E without a character library. In order to make the card reader applicable to occasions such as library book management that require Chinese character display, the GB2312 Chinese character library and other picture libraries are designed by using the serial memory W25X80. Serial memory is popular for its small size, high density, low power consumption, low price and simple operation. The W25X80 produced by Winbond is an 8 Mb serial memory, divided into 4 096 pages, each page is a 256-byte storage unit, and has a 256-byte buffer and SPI interface. Using Flash to design a Chinese character library is not only very simple to operate, but also can be flexibly applied to multiple design schemes.
3 Card Reader Software Design
The simulation communication between STC11F32 and MFRC500 is the most critical step in software design, because only by opening up the key link of the underlying communication can STC11F32 further realize the basic operation of reading and writing cards by controlling MFRC500. In order to achieve this step, we must first figure out the read and write timing of MFRC500. This design adopts the method of independent read/write strobe and multiplexed address bus. In this way, the read and write timing of MFRC500 is shown in Figure 2.
Based on this timing diagram, the C language implementation code for the STC11F32 microcontroller to read and write one byte from MFRC500 can be written.
(1) Read a data from an address
STC11F32 mainly implements complex read and write control of MFRC500 by calling these two most basic functions. The biggest advantage of using analog bus communication is that the code written in C language can be easily transplanted to various microcontrollers that do not support bus expansion, which enhances the reusability and portability of software modules. After opening up the key links of the underlying communication, each software module can be written and debugged. The overall software process is shown in Figure 3.
After the system is powered on, the I/O pins and serial port of STC11F32 must be initialized first. The I/O setting mainly defines the special pins of STC11F32 (such as EA, ALE, PSEN, etc.) as general I/O to facilitate analog communication with MFRC500. After that, the reset of MFRCS00 must be delayed long enough to ensure that MFRC500 is reset reliably. During the reset process, some register bits of MFRC500 are preset by hardware; after the reset is successful, the necessary configuration of each register of MFRC500 is required.
After the LCD initialization is completed, the LCD will display the relevant prompt information of the system, and then wait for the user to enter the command from the serial port or key, perform the corresponding operation according to the command entered by the user, and return the result of the execution operation to the user and display it on the LCD.
Conclusion
This paper uses the high-speed, low-cost single-chip microcomputer STC11F32 of Hongjing Technology and the MFRC500 chip of Philips to design a contactless radio frequency card reader; according to the standard of ISO/IEC 14443, the design of system hardware and software is completed. It has been proved in actual use that the card reader has stable operation, strong anti-interference ability, high cost performance, flexible operation, and strong market competitiveness.
Previous article:Application of MSP430 MCU in Micro Low Power Data Broadcast Receiver
Next article:Design of colored lights based on single chip microcomputer
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- How to understand this parameter in the MOS tube specification?
- Why is it necessary to use a four-pin Kelvin connected resistor for current detection?
- Purgatory Legend-12864 LCD War
- Live Review: How to Design High-Performance Servo Drives Using Infineon IGBT7
- [Raspberry Pi 4B Review] + ARIA2 Remote Download Server Construction
- Italian court upholds enforceability of open source software license
- New support for C++ code in STM32 and examples of user C modules written in C++ in MicroPython
- Has anyone encountered the situation where the capacitor pulls down the voltage?
- [Analysis of the topic of the college electronic competition] —— 2020 TI Cup E topic "Amplifier nonlinear distortion research device"
- DSP C6000 Peripherals