# Design and Implementation of a Low-Cost Universal RFID Wireless Logistics Terminal in the Process of Logistics Traceability

Authors: Xiaosheng Yu; Zhili Wang
Journal: Journal of Sensors
 (2021)

---

## Abstract

The logistics traceability system can cover the whole process of the product from the source of production to the consumption cycle. By distinguishing the key nodes of the product in the logistics sales process, the data information of the production and storage of the corresponding product is collected and entered at the corresponding node, so that the entire process is visible and controllable. On the basis of determining the overall system plan, this paper designs and develops the UHF RFID reader system and traceability system platform. In terms of the reader system, by analyzing its core functions and performance index requirements, the overall design scheme and frame structure of the reader system’s software and hardware are determined. The main control circuit is based on the STM32F103RET6 single-chip microcomputer; the RF transceiver circuit is based on the MagicRF M100. Simultaneously, we design a variety of communication circuits including LoRa and RJ45 to facilitate wireless communication with the traceability platform. In terms of software, through the research and analysis of the EPC Class-1 Generation-2 protocol standard, the multitag anticollision algorithm—Q algorithm—is adopted. This algorithm has the advantages of high recognition efficiency and a large number of successfully recognized tags per unit time. According to the design plan, the system is wirelessly networked in the B/S mode and the product information collected through RFID technology is transmitted to the management level to dynamically understand the information dynamics of logistics in real time. Using radio frequency, computer network, communication, and other technologies, the hardware and software systems of the system are integrated. The performance indicators of the hardware system are tested through experiments, and the design indicators are compared to prove the feasibility of the equipment application. After setting up the local area network and configuring the server configuration, the traceability system was accessed and the verification of the basic functions of the system was completed. The test results show that the low-cost universal RFID wireless logistics terminal has high accuracy and real-time performance in the process of logistics traceability.


---

## Body

## 1. Introduction

In the current new era of rapid development of information technology, for urban and rural construction, especially the strategy of rural revitalization, it must rely on information technology to achieve it. Therefore, all aspects of agricultural social life are increasingly dependent on new technologies to promote the industry. In people’s daily life, the demand for products is showing a trend of rapid growth but it is not easy to preserve under traditional craftsmanship, which will lead to deterioration of quality, affect the quality of life of consumers, and threaten people’s health [1, 2]. It is precisely based on this demand that the application of logistics cold chain technology is born. In essence, this technology is to apply traditional cold chain technology to the logistics process to ensure that those with higher temperature requirements during storage and transportation can be stored at low temperature during transportation. The research in this article is also based on the emerging information technology, analyzes and improves the current cold chain logistics of aquatic products, and optimizes the traditional traceability system and traceability model to make it more convenient and efficient [3–5].Because RFID technology has the characteristics of low cost and high technology in information collection, it has been studied by domestic and foreign enterprises and academia [6]. They use RFID technology to implement product traceability management and trace the entire supply chain system of products to ensure the safety and quality of auto parts in the circulation link; modern Internet information technology can largely eliminate the possibility of product fraud in all links. Based on RFID technology, the product can be traced from the time that the product is shipped from the supplier [7]. With the rapid development of network information technology, sensor technologies with lower cost, lower power consumption, and higher stability are emerging in an endless stream, especially that the emergence of wireless sensor technology has laid the foundation for the realization of this system [8]. What needs to be seen is how to apply Internet technology to the production, and logistics management of products in a more efficient manner in recent years has become the focus of relevant domestic enterprises and research institutions [9]. In addition, as far as the enterprise is concerned, the use of RFID traceability-based part management mode can effectively manage the quality of the product, avoid product defects, and at the same time enable the company to prompt the company to recall when there is a product quality problem. Active and effective measures can be taken to enable logistics companies to continuously reduce risks during their operations and improve their comprehensive competitiveness [10].Aiming at the problems that the existing lightweight RFID protocol does not satisfy the security, scalability, and reusability of the IoT operating system, a scalable low-cost SRSFP+ protocol under the IoT environment is proposed. First, this article uses traditional analysis methods to point out the existence of tag and reader counterfeiting attacks and tracking attacks in the SRSFP protocol. Secondly, it analyzes that the SRSFP protocol does not satisfy the strong forward untraceability under the untraceability model. The SRSFP+ protocol is proposed, which can realize the collaboration of card readers supporting the Internet of things environment (cloud environment) and efficiently find tags. This article introduces the core software and hardware functions and design schemes of the UHF RFID reader system. In terms of hardware, it mainly introduces the design ideas and realized functions of MCU, power supply, radio frequency transceiver, communication, and other parts of the circuit. The software introduced the relevant introduction of the UHF RFID reader system under the EPC C1G2 protocol in detail and simulated and analyzed the encoding and carrier modulation methods used in the forward link of the system. Subsequently, the process of reading and writing operations between the reader and the tag and the multitag anticollision algorithm adopted in the system is introduced. Based on the hardware and software design of the traceability system, this paper uses radio frequency, computer network, communication, and other technologies to integrate the hardware and software systems of the system into a network. The performance index of the hardware system was tested through experiments and compared with the design index, which proved the feasibility of equipment application. After setting up the local area network and configuring the server configuration, the traceability system was accessed and the verification of the basic functions of the system was completed.


## 2. Related Work

In the logistics industry and other fields, the application of RFID does not only involve RFID technology itself but a huge system engineering involving many aspects including technology, management, hardware, software, network, system security, and radio frequency [11]. The current RFID research mainly focuses on security and privacy protection issues, RFID technical standards, RFID tag costs, RFID technical research, and RFID application systems. Judging from the current status quo, RFID will face many problems that need to be resolved in at least a few years, especially security and privacy protection issues, standard issues, and tag cost issues [12].As the U.S. government has supplemented the regulations on the entire process of food circulation, all companies and stakeholders related to food production, processing, and transportation must establish a complete video security monitoring system. It is worth mentioning that since then, the US government has required that all products sold must indicate the place of origin. After that, the U.S. government established a corresponding agricultural information network to systematically customize and publish specific product logistics information, so that consumers can quickly obtain corresponding agricultural product information through the network. Relying on this system, a set of specific agricultural product whole-process supervision programs has been set up, so that ordinary consumers can also control relevant product information in real time through the traceability system.In terms of physical methods, such as the Kill command mechanism method of the Auto-id Center automatic identification center, it is mainly to implement the Kill command on the used label to make the label permanently invalid [13]. The problem that this method brings is to limit the subsequent use of the label. Legal access and the one-time use of the label increase the cost, and it is difficult to judge whether the label is really completely invalid. Once the label is damaged, it can no longer be activated, which will hinder legal applications. Another method is the so-called “Faraday cage,” that is, a metal cover is placed on the label to prevent illegal interrogation, but at the same time, it blocks legal access to the label by authorized readers. Active jamming is another physical means to protect the radio frequency tag from monitoring, but it will cause serious damage to the RFID system when the energy is too high [14, 15]. The “Block Tag” method adds an additional “affiliated tag,” which increases the cost.The ultralightweight security protocol is mainly aimed at the problem of low tag computing power. It only runs the most basic logical operations in the tag, including AND and XOR operations. It has low requirements for tags and can meet the low cost of tags [16]. However, the communication information encryption ability is low and it is easy for an attacker to inversely calculate the key information of the tag by eavesdropping on the information and the security of the system is low. The security protocol based on the ellipsoid curve is to use the ellipsoid curve encryption algorithm to encrypt the communication information to achieve the security requirements of RFID [17]. The ellipsoid curve encryption algorithm has low requirements for calculation and can meet the cost requirements of the label to a certain extent. It can also guarantee the security of the system very well and is an important branch of the RFID security protocol. The security protocol based on the supply chain is mainly for the special application in the supply chain of the RFID system application. In the supply chain, the application of the RFID system includes the initialization phase, the verification phase, and the ownership change phase. The initialization phase and the verification phase are the same as other security protocols [18]. The ownership change stage is a unique stage based on the supply chain security agreement, and it is also the most important link, because it involves the update of the important secret information of the label.Read access control is mainly composed of some security protocols [19, 20]. Compared with physical methods, security protocols based on cryptography are more flexible in the application process. In other words, the tag will not leak information before a certain reader is authenticated by itself. The main principle of the Hash-Lock protocol proposed by Erman et al. and Oner et al. is to use metaID instead of real tag ID. The randomized Hash-Lock protocol proposed by Weis is based on a randomized response mechanism [21, 22]. There is also a digital library RFID protocol proposed by David et al. It is authenticated by a pseudorandom function based on preshared secrets. So far, no obvious security loopholes have been found in this protocol. However, in order to support this protocol, it is necessary to include two functional modules, namely, random number generation and secure pseudorandom function, in the tag circuit [23–25]. Therefore, this protocol is completely unsuitable for low-cost RFID systems.


## 3. Low-Cost Universal RFID Framework and Protocol in the Logistics Wireless Network Environment

### 3.1. System Model of Security Protocol Architecture

The System Model of Security Protocol Framework (SRSFP) protocol has a main reader, multiple client readers and RFID tags, a WML (wireless markup language) server, back-end server, and cloud.The mobile RFID system uses the EPC intermediate file in the EPCglobal organization framework, and the SRSFP protocol works at the ALE layer. Figure1 is the system model of the security protocol architecture in the mobile RFID system. The system model includes the EPC Dialogue Protocol (LLRP), Application Level Event Operation Protocol (ALE), Discovery Configuration and Initialization Protocol (DCI), and Product Electronic Code Information Service Protocol (EPCIS).Figure 1
The system model of the security protocol architecture.The SRSFP protocol can replace a specific system component or add a new system component, both of which will not affect the overall integrity of the framework. The retrieval technology in the SRSFP protocol reduces the complexity of operations. The recleaning label technology improves the efficiency of label retrieval, enabling a safely cleaned label to successfully pass the system’s security verification at a faster rate without having to perform SC3 and SC4. The SRSFP protocol uses the bit value of the security verification switch SCH to update the tag ID. SCH characters are stored in the back-end database to continuously track the security status of a tag.The security cleaning technology and malicious detection technology of the SRSFP protocol can resist malicious data insertion during the mutual authentication process. The system model of the security protocol framework in the mobile RFID system uses the black box method, which provides the function of upgrading or replacing system components, so that the main framework can easily update the technology. The black box method can enhance the reusability of the RFID security protocol by integrating new upgrade technologies.


### 3.2. Mutual Authentication SRSFP Protocol

The reader generates r1 and then calculatesq=hRDBRIDi⊕r1. Then, the reader generates Psb+1 and sends r1, q, and Psb+1 to the tag to start the conversation. The transmission data between the tag and the reader uses a 130-bit frame. The protocol will use a bit start (SGap) and a frame end (EGap) to separate these 130-bit frames to improve transmission efficiency. CRC (cyclic redundancy check) 32-bit characters to verify error detection during information transmission. The information transmission framework in the traditional protocol and the new protocol is shown in Table 1.Table 1
Data and structure sent by readers and tags in the traditional protocol and the new protocol.
CRCEGapSGapPayloadThe structure of the traditional protocol and the total number of bits321286New protocolR output structure and specific number of bits16116New protocolT output structure and specific number of bits32214The label generation r2 calculates the random valueW′=hRCT⊕W. The hash operation of the tag reading and writing count (RCT) value and the tag setting value (W) obtains RC′T=hRCT⊕W. They use K′=rotTIDi,Psb+1, RC′T=RCT+1 to encrypt TIDi, that is, r3=hr2⊕k′⊕q. Encryption methods such as hash function, random number, and cyclic shift rotation can resist tracking, forward, and backward untraceable attacks. The tag responds to the client’s reader request information including r2, W′, RCT, and r3 information. We make the client reader use the nearest client reader and the RDB in the main reader to start the RIDi certification process. System component 1 (SC1) performs the reader authentication procedure. If RIDi is found to be true in RDB, the protocol continues to SC2. The SC2 certification process is used to identify TIDi.


## 3.1. System Model of Security Protocol Architecture

The System Model of Security Protocol Framework (SRSFP) protocol has a main reader, multiple client readers and RFID tags, a WML (wireless markup language) server, back-end server, and cloud.The mobile RFID system uses the EPC intermediate file in the EPCglobal organization framework, and the SRSFP protocol works at the ALE layer. Figure1 is the system model of the security protocol architecture in the mobile RFID system. The system model includes the EPC Dialogue Protocol (LLRP), Application Level Event Operation Protocol (ALE), Discovery Configuration and Initialization Protocol (DCI), and Product Electronic Code Information Service Protocol (EPCIS).Figure 1
The system model of the security protocol architecture.The SRSFP protocol can replace a specific system component or add a new system component, both of which will not affect the overall integrity of the framework. The retrieval technology in the SRSFP protocol reduces the complexity of operations. The recleaning label technology improves the efficiency of label retrieval, enabling a safely cleaned label to successfully pass the system’s security verification at a faster rate without having to perform SC3 and SC4. The SRSFP protocol uses the bit value of the security verification switch SCH to update the tag ID. SCH characters are stored in the back-end database to continuously track the security status of a tag.The security cleaning technology and malicious detection technology of the SRSFP protocol can resist malicious data insertion during the mutual authentication process. The system model of the security protocol framework in the mobile RFID system uses the black box method, which provides the function of upgrading or replacing system components, so that the main framework can easily update the technology. The black box method can enhance the reusability of the RFID security protocol by integrating new upgrade technologies.


## 3.2. Mutual Authentication SRSFP Protocol

The reader generates r1 and then calculatesq=hRDBRIDi⊕r1. Then, the reader generates Psb+1 and sends r1, q, and Psb+1 to the tag to start the conversation. The transmission data between the tag and the reader uses a 130-bit frame. The protocol will use a bit start (SGap) and a frame end (EGap) to separate these 130-bit frames to improve transmission efficiency. CRC (cyclic redundancy check) 32-bit characters to verify error detection during information transmission. The information transmission framework in the traditional protocol and the new protocol is shown in Table 1.Table 1
Data and structure sent by readers and tags in the traditional protocol and the new protocol.
CRCEGapSGapPayloadThe structure of the traditional protocol and the total number of bits321286New protocolR output structure and specific number of bits16116New protocolT output structure and specific number of bits32214The label generation r2 calculates the random valueW′=hRCT⊕W. The hash operation of the tag reading and writing count (RCT) value and the tag setting value (W) obtains RC′T=hRCT⊕W. They use K′=rotTIDi,Psb+1, RC′T=RCT+1 to encrypt TIDi, that is, r3=hr2⊕k′⊕q. Encryption methods such as hash function, random number, and cyclic shift rotation can resist tracking, forward, and backward untraceable attacks. The tag responds to the client’s reader request information including r2, W′, RCT, and r3 information. We make the client reader use the nearest client reader and the RDB in the main reader to start the RIDi certification process. System component 1 (SC1) performs the reader authentication procedure. If RIDi is found to be true in RDB, the protocol continues to SC2. The SC2 certification process is used to identify TIDi.


## 4. RFID Wireless Logistics Terminal System Design

### 4.1. Framework Design of the Reader System

The reader system in this article is shown in Figure2. It is mainly composed of four modules: radio frequency transceiver circuit, STM32F103RET6 main control circuit, peripheral communication circuit, and traceability platform. At the same time, when the reader communicates with the traceability platform, it supports four hardware communication methods: LoRa wireless communication, USB serial port, RS485, and RJ45 Ethernet interface, which makes the communication between the hardware system and the platform more convenient.Figure 2
Reader system architecture.


### 4.2. The Hardware Design of the Reader System

#### 4.2.1. MCU Processor

In the system, the main functions that the MCU processor needs to achieve are data analysis, processing, and uploading, that is, the RFID-related data collected by the radio frequency circuit is processed to form a specified data frame communication format. Secondly, it can realize a variety of communication methods, complete the interaction with the host computer platform, and then complete the transmission and reception of data and commands.This reader needs to implement multiple communication methods of LoRa, USB, RS485, and RJ45. Among these communication methods, the LoRa module, the USB driver chip CH340G, and the 485 driver chip SP3485 are all serial communication and the RJ45 driver chip W5500 is SPI communication. As well as FLASH storage, M100 communication, etc., the MCU must have the functions of multiple communication methods. This reader system is designed to be applied in practice and to facilitate people’s lives. In this process, the reader needs to have not only the ability to work in a variety of complex environments but also the ability to process various information of computing products. So, the reliability requirements are relatively high. The selection of the single-chip processor must withstand the test of the market and the selected single-chip microcomputer must have a certain versatility, so that the software and hardware resources of the single-chip microcomputer can be easily obtained, such as development manuals, programming library functions. In actual debugging and development, the development cycle can be greatly shortened and various performance indicators of the reader system can be better realized. Based on the functional requirements of the MCU processor of the above reader system, this article selects ST’s STM32F103RET6 (hereinafter referred to as RET6) microcontroller as the main controller chip.


#### 4.2.2. Power Module

This article selects the MP2359 DC step-down chip to design the 5 V power supply voltage generation circuit. This chip is made with CMOS technology and has a built-in DC/DC conversion circuit. The maximum current that the chip can provide is 1.2 amperes. Inside the chip, there are mainly integrated oscillation circuits, PWM control circuits, and internal voltage regulators. The external components are mainly circuits composed of commonly used electronic components such as inductors, resistors, diodes, and capacitors. All internal and external circuits form a complete step-down DC conversion DC circuit. In actual application, this system uses 12 V DC power adapter as input.


#### 4.2.3. RF Transceiver Chip

What this article uses is the MagicRF M100 chip produced by Wuxi Qilian Electronics Co. Ltd. The chip adopts a 32-Lead QFN package, and the package size is the smallest among relevant RF chips in the world. In addition, the chip integrates a single-ended output power amplifier with a maximum of 4 dBm. When working at the maximum power, the current in the chip is only 80 mA. In terms of performance, the chip sensitivity is about −69 dBm in the case of −10 dBm local blocking, which can identify weaker signals. It has the advantages of low power consumption, small size, and low cost.MagicRF M100 is a highly integrated CMOS SoC reader chip. The chip has the characteristics of low power consumption and small size and is an excellent solution for low-cost readers and modules. The protocols supported by the chip are ISO18000-6C and EPC Class-1 Generation-2 international standard protocols; the operating frequency range is 840~960 MHz; the sensitivity is −10 dBm; under local blocking conditions −69 dBm, the test packet error rate is 1%. The working power supply voltage is 3 V~3.6 V; the chip integrates the RF transceiver, digital baseband; modulation, coding, and data rate transmission is 80 kHz DSB-ASK; the reception is 80 kHz FM0. It supports LBT and FHSS frequency hopping modes. It integrates a low-noise VCO and frequency synthesizer and integrates a 4 dBm single-ended on-chip driver amplifier. In the case of 8 bits, GPIO general-purpose input/output ports can be configured.The radio frequency circuit part used in this article is mainly composed of radio frequency chip M100 and related auxiliary circuits. Its main functions are to provide energy for activating the tag; to realize the modulation of the command signal transmitted in the forward link and the demodulation of the RF signal transmitted back by the tag in the reverse link. M100 internally performs signal processing and communicates with the main control circuit.


#### 4.2.4. Power Amplifier

In the forward link of the radio frequency transceiver, the radio frequency signal power generated by the modulation oscillation circuit is generally very small, which cannot meet the actual design requirements. Therefore, it is necessary to design a power amplifier circuit to realize the reading of tags as far away as possible. The output power and efficiency are two important reference indicators for designing power amplifier circuits. How to improve output power and efficiency is the core of the design goals of RF power amplifiers. On the one hand, it is necessary to ensure that the radio frequency output power is large enough. On the other hand, it is necessary to match the impedance of the input and output ports of the power amplifier circuit to maximize the efficiency of the amplifier circuit.It stipulates the multiple that the power amplifier can amplify the small signal input in the work. When choosing a power amplifier, select the appropriate amplifier model and number of amplifier stages according to the expected goals of the system. The gain valueG is expressed as
(1)GdB=10log2PinPout.The noise figure is the ratio of the signal-to-noise ratio of signal input and output. In actual work, the value of this value can be used as a reference to judge the quality of amplifier components. In the circuit design of the radio frequency part, low-noise processing must be considered. The noise figure of the circuit is mainly determined by the components and related matching circuits. The noise figure expression is(2)NF=2log2N0SiNiS0.The standing wave ratio (SWR) is calledS, which means that the entire impedance of the line does not match and it represents a function of the load. In order to determine VSWR, the ratio of transmit power to received power must be calculated, which is equal to the ratio of the maximum voltage to the minimum voltage present on the transmission line:
(3)VSWR=2Vinc+Vref1Vinc−0.5Vref1.For RF amplifier circuits, ideally, the value of the gain in the passband range should remain constant, but in actual applications, it is not the case. The gain will fluctuate and sometimes vary greatly, and the gain flatness represents the power. The value of the amplifier’s gain “severe increase” or “rapid decrease” in the specified frequency band can usually be expressed by the difference in decibels between the highest gain and the lowest gain.(4)ΔG=0.5GmaxGmindB.


#### 4.2.5. Directional Coupler

In a passive UHD RFID system, since the transmitting link and the receiving link share the same antenna, the receiver must tolerate large leakage signals (self-interference) from the transmitter because of the limited isolation. Therefore, in order to reduce self-interference, a directional coupler is used in the design of this article to reduce self-interference, thereby relaxing the linearity requirements of the RF front end. Although its sensitivity is somewhat lost, it is still acceptable for the system and worth using.Coupling refers to the ratio of input power P1 to output power P3:
(5)C=2log2P1P3=5lgS13−1.Isolation refers to the ratio of input power P1 to output power P4:
(6)I=2log2P1P4=5lgS14−1.Orientation refers to the ratio of the output power P3 at the coupling end to the output power P4 at the isolation end:
(7)D=2log2P3P4=5lgS13S14.The input standing wave ratio is denoted byp, which refers to the standing wave ratio at the end of the match:
(8)p=1−S111+2S11.


### 4.3. Tag Communication Process

The reader first sends a continuous wave (CW) signal to activate and “power on” the tag, and then, the tag returns the required signal to the reader by backscattering the CW signal. If the tag is a corresponding tag, a communication link will be established between the reader and the tag. Then, the reader sends a DSB/SSB/PR-ASK modulation signal to command the tag and then sends a CW signal to energize the tag. At the same time, the reader listens to the backscattered signal of the tag. It should be emphasized that during the reception of useful signals, the transmitter has been sending CW signals. In this process, signal coding technology and carrier modulation technology are bound to be involved.The reader needs to transmit a continuous carrier wave to the tag to provide energy to the tag. During this transmission, the energy density at the distancer from the reader is the ratio of the transmitted energy PTX to the spherical surface. The energy we receive at the tag PRX is
(9)PRX=Ac•PTX2πr2.In the formula,Ac is the effective aperture of the tag antenna, that is, the electromagnetic wave area that actually passes through the tag antenna:
(10)Ac=1−λ24π.After counting the antenna gain of the reader and the electronic tag, the energy received at the tag is(11)PRX=GRXGTX1−PTX4πr2.In the process of data communication between the reader and the electronic tag, because electromagnetic waves are used for noncontact communication, it is very susceptible to electromagnetic interference from other signals in the air, so a verification code must be set to verify the data. A verification code is added after the data frame, and the receiving end checks the accuracy of the data according to the verification code.The system in this paper adopts the widely used CRC check and sets a 16-bit check code. CRC check mainly uses modulo 2 division based on binary numbers, that is, when the first digit of the part of the remainder is 1, the quotient is 1; otherwise, the quotient is 0. In this process, first, we convert the data to be sent into binary data and express it in the form of a polynomialMx. For example, the polynomial generated by binary data 110010 is x5+x4+x. Subsequent division by the agreed polynomial Rx is also expressed in binary. The remainder bit sequence is obtained by modulo 2 division, which is the CRC check code, which is added to the back of the data to be sent for transmission. Then, we check at the receiving end. If there is no error in the data transmission process, it must be divisible by the same polynomial Rx. If the remainder is not 0, it means that a bit is wrong and the data is invalid.


### 4.4. Tag Read and Write Operation Process

The operation process of the reader to read and write electronic tags is shown in Figure3. First, the reader system is powered on and reset and enters the initialization state. After the electronic tag receives the continuous carrier signal and the access command, the internal circuit of the tag is powered on and starts to work and the data transmission channel is established. The reader then selects the electronic tag through the query command and sends the Req_RN command to make the tag enter the arbitration state and then determines whether the tag returns RN16 data, and if so, it can send, read, and write instructions. If it is a read command, the tag will return the PC, EPC, and CRC data information. If the write command is operated, the reader first selects the tag, obtains the tag data, and then completes the rewrite operation on the tag data.Figure 3
Flow chart of reader’s read and write operations on tags.


### 4.5. System Software Design

The programming software selected for this system is Keil uVision5, which uses C language to perform modular programming on the single-chip microcomputer RET6 through operating registers and refines the functions of each functional module. It is mainly divided into the main program, radio frequency communication subprogram, serial communication subprogram, LoRa communication subroutine, network communication subroutine, etc. The main program of the system, as the call instruction of each module subprogram, is very important in the operation of the system. A reasonable design of the main program can not only successfully complete the monitoring function of the system and improve the working efficiency of the system but also increase the program’s availability.In this UHF RFID reader system, the RF chip M100 provides RF front-end signal and received signal processing and EPC Class-1 Generation-2 protocol processing functions. In terms of the program structure of the radio frequency part, the system mainly includes several parts such as the M100 initialization program and the MCU serial port interrupt program. When the radio frequency system is working normally, first, we execute the initialization program to configure the working parameters of the M100 and then perform corresponding operations on the received data commands. When the serial port pin of RET6 receives a data frame in the correct format, the interrupt is turned on and the data is forwarded to the upper computer. If no valid data is received, the loop wait is maintained.


#### 4.5.1. RF Chip M100 RF Communication Control

When the system is working, M100 as a slave uses the USART interface to communicate with the main control circuit part RET6, and the main control circuit initiates all communication processes. At the beginning, the main program completes the initialization of the USART and I2C interface of the chip and then sends a handshake command through the serial port to shake hands with the M100. After success, the configuration command is written to the RF chip through the USART interface or I2C interface to complete the initialization of the M100. At this point, the configuration of the reader and the instruction operation of the tag can be realized. Among them, when reading multiple tags, if successful, the tag storage information is returned, and if multiple tag collisions occur, the tag anticollision processing algorithm module is executed to resolve the collision.


#### 4.5.2. Anticollision Algorithm

For passive UHF RFID systems, collision problems are mainly divided into two categories: one is collisions caused by signal interference when multiple readers access the tag at the same time. The other type is the collision between the tag and the tag when a reader/writer accesses the data information of multiple tags at the same time, which causes the internal data recognition error of the tag. When dealing with the collision problem, the former type is easier to deal with and it can be solved by rationally arranging the positions of multiple readers. Therefore, this article mainly sets out to solve the second type of collision problem.There are two types of algorithms to solve the multilabel anticollision problem: one is the tree algorithm and the other is the Aloha algorithm. The former is mainly focused on the research of bit identification and tracking that produces collisions, while the latter does not need to detect the specific location of collisions between multiple tags. Therefore, in contrast, considering that the UHF RFID system reader hardware cannot detect specific collision positions, this paper selects the first type of algorithm for design research.When reading multiple tags, when the reader sends an instruction and multiple tags respond at the same time, the phenomenon that the reader cannot operate the tags normally is called a tag collision. Therefore, the label anticollision problem during multilabel reading must be eliminated. The tag anticollision processing algorithm module designed in this paper adopts the time slot Q algorithm provided by the EPC C1 G2 protocol. The Q algorithm is an Aloha algorithm based on dynamic frame time slots. It has nothing to do with the serial number of the tag. It performs anticollision processing based on probability and slotting ideas.Assume that the number of electronic tags waiting to be recognized around the reader isn and the frame length is L. The reader randomly selects any integer from the range of 0,L, and because all tags are independent of each other in the selected time slot and do not affect each other, they obey the binomial distribution law. Therefore, the probability P that there are r tags corresponding to the ith slot at the same time is
(12)Pm=r=Cnr−1•L−r•1−L−1n−r−1.Whenr=1, that is, only one electronic tag generates a response, indicating that the ith time slot is a successful time slot. At this time, the probability P is
(13)Pm=1,r=−1=Cn−11•L−1•1−L−1n−r.Then, the expectationE for a successful time slot in a frame is
(14)Em=1=L−1C1n−1•L•1−L−1n−2.The throughput rateη of the system is
(15)η=Cn−11•L−1•n−L−1n−1.Taking the derivative ofn to find its poles, we get
(16)L=m•e−n−1•1−n1+n.


## 4.1. Framework Design of the Reader System

The reader system in this article is shown in Figure2. It is mainly composed of four modules: radio frequency transceiver circuit, STM32F103RET6 main control circuit, peripheral communication circuit, and traceability platform. At the same time, when the reader communicates with the traceability platform, it supports four hardware communication methods: LoRa wireless communication, USB serial port, RS485, and RJ45 Ethernet interface, which makes the communication between the hardware system and the platform more convenient.Figure 2
Reader system architecture.


## 4.2. The Hardware Design of the Reader System

### 4.2.1. MCU Processor

In the system, the main functions that the MCU processor needs to achieve are data analysis, processing, and uploading, that is, the RFID-related data collected by the radio frequency circuit is processed to form a specified data frame communication format. Secondly, it can realize a variety of communication methods, complete the interaction with the host computer platform, and then complete the transmission and reception of data and commands.This reader needs to implement multiple communication methods of LoRa, USB, RS485, and RJ45. Among these communication methods, the LoRa module, the USB driver chip CH340G, and the 485 driver chip SP3485 are all serial communication and the RJ45 driver chip W5500 is SPI communication. As well as FLASH storage, M100 communication, etc., the MCU must have the functions of multiple communication methods. This reader system is designed to be applied in practice and to facilitate people’s lives. In this process, the reader needs to have not only the ability to work in a variety of complex environments but also the ability to process various information of computing products. So, the reliability requirements are relatively high. The selection of the single-chip processor must withstand the test of the market and the selected single-chip microcomputer must have a certain versatility, so that the software and hardware resources of the single-chip microcomputer can be easily obtained, such as development manuals, programming library functions. In actual debugging and development, the development cycle can be greatly shortened and various performance indicators of the reader system can be better realized. Based on the functional requirements of the MCU processor of the above reader system, this article selects ST’s STM32F103RET6 (hereinafter referred to as RET6) microcontroller as the main controller chip.


### 4.2.2. Power Module

This article selects the MP2359 DC step-down chip to design the 5 V power supply voltage generation circuit. This chip is made with CMOS technology and has a built-in DC/DC conversion circuit. The maximum current that the chip can provide is 1.2 amperes. Inside the chip, there are mainly integrated oscillation circuits, PWM control circuits, and internal voltage regulators. The external components are mainly circuits composed of commonly used electronic components such as inductors, resistors, diodes, and capacitors. All internal and external circuits form a complete step-down DC conversion DC circuit. In actual application, this system uses 12 V DC power adapter as input.


### 4.2.3. RF Transceiver Chip

What this article uses is the MagicRF M100 chip produced by Wuxi Qilian Electronics Co. Ltd. The chip adopts a 32-Lead QFN package, and the package size is the smallest among relevant RF chips in the world. In addition, the chip integrates a single-ended output power amplifier with a maximum of 4 dBm. When working at the maximum power, the current in the chip is only 80 mA. In terms of performance, the chip sensitivity is about −69 dBm in the case of −10 dBm local blocking, which can identify weaker signals. It has the advantages of low power consumption, small size, and low cost.MagicRF M100 is a highly integrated CMOS SoC reader chip. The chip has the characteristics of low power consumption and small size and is an excellent solution for low-cost readers and modules. The protocols supported by the chip are ISO18000-6C and EPC Class-1 Generation-2 international standard protocols; the operating frequency range is 840~960 MHz; the sensitivity is −10 dBm; under local blocking conditions −69 dBm, the test packet error rate is 1%. The working power supply voltage is 3 V~3.6 V; the chip integrates the RF transceiver, digital baseband; modulation, coding, and data rate transmission is 80 kHz DSB-ASK; the reception is 80 kHz FM0. It supports LBT and FHSS frequency hopping modes. It integrates a low-noise VCO and frequency synthesizer and integrates a 4 dBm single-ended on-chip driver amplifier. In the case of 8 bits, GPIO general-purpose input/output ports can be configured.The radio frequency circuit part used in this article is mainly composed of radio frequency chip M100 and related auxiliary circuits. Its main functions are to provide energy for activating the tag; to realize the modulation of the command signal transmitted in the forward link and the demodulation of the RF signal transmitted back by the tag in the reverse link. M100 internally performs signal processing and communicates with the main control circuit.


### 4.2.4. Power Amplifier

In the forward link of the radio frequency transceiver, the radio frequency signal power generated by the modulation oscillation circuit is generally very small, which cannot meet the actual design requirements. Therefore, it is necessary to design a power amplifier circuit to realize the reading of tags as far away as possible. The output power and efficiency are two important reference indicators for designing power amplifier circuits. How to improve output power and efficiency is the core of the design goals of RF power amplifiers. On the one hand, it is necessary to ensure that the radio frequency output power is large enough. On the other hand, it is necessary to match the impedance of the input and output ports of the power amplifier circuit to maximize the efficiency of the amplifier circuit.It stipulates the multiple that the power amplifier can amplify the small signal input in the work. When choosing a power amplifier, select the appropriate amplifier model and number of amplifier stages according to the expected goals of the system. The gain valueG is expressed as
(1)GdB=10log2PinPout.The noise figure is the ratio of the signal-to-noise ratio of signal input and output. In actual work, the value of this value can be used as a reference to judge the quality of amplifier components. In the circuit design of the radio frequency part, low-noise processing must be considered. The noise figure of the circuit is mainly determined by the components and related matching circuits. The noise figure expression is(2)NF=2log2N0SiNiS0.The standing wave ratio (SWR) is calledS, which means that the entire impedance of the line does not match and it represents a function of the load. In order to determine VSWR, the ratio of transmit power to received power must be calculated, which is equal to the ratio of the maximum voltage to the minimum voltage present on the transmission line:
(3)VSWR=2Vinc+Vref1Vinc−0.5Vref1.For RF amplifier circuits, ideally, the value of the gain in the passband range should remain constant, but in actual applications, it is not the case. The gain will fluctuate and sometimes vary greatly, and the gain flatness represents the power. The value of the amplifier’s gain “severe increase” or “rapid decrease” in the specified frequency band can usually be expressed by the difference in decibels between the highest gain and the lowest gain.(4)ΔG=0.5GmaxGmindB.


### 4.2.5. Directional Coupler

In a passive UHD RFID system, since the transmitting link and the receiving link share the same antenna, the receiver must tolerate large leakage signals (self-interference) from the transmitter because of the limited isolation. Therefore, in order to reduce self-interference, a directional coupler is used in the design of this article to reduce self-interference, thereby relaxing the linearity requirements of the RF front end. Although its sensitivity is somewhat lost, it is still acceptable for the system and worth using.Coupling refers to the ratio of input power P1 to output power P3:
(5)C=2log2P1P3=5lgS13−1.Isolation refers to the ratio of input power P1 to output power P4:
(6)I=2log2P1P4=5lgS14−1.Orientation refers to the ratio of the output power P3 at the coupling end to the output power P4 at the isolation end:
(7)D=2log2P3P4=5lgS13S14.The input standing wave ratio is denoted byp, which refers to the standing wave ratio at the end of the match:
(8)p=1−S111+2S11.


## 4.2.1. MCU Processor

In the system, the main functions that the MCU processor needs to achieve are data analysis, processing, and uploading, that is, the RFID-related data collected by the radio frequency circuit is processed to form a specified data frame communication format. Secondly, it can realize a variety of communication methods, complete the interaction with the host computer platform, and then complete the transmission and reception of data and commands.This reader needs to implement multiple communication methods of LoRa, USB, RS485, and RJ45. Among these communication methods, the LoRa module, the USB driver chip CH340G, and the 485 driver chip SP3485 are all serial communication and the RJ45 driver chip W5500 is SPI communication. As well as FLASH storage, M100 communication, etc., the MCU must have the functions of multiple communication methods. This reader system is designed to be applied in practice and to facilitate people’s lives. In this process, the reader needs to have not only the ability to work in a variety of complex environments but also the ability to process various information of computing products. So, the reliability requirements are relatively high. The selection of the single-chip processor must withstand the test of the market and the selected single-chip microcomputer must have a certain versatility, so that the software and hardware resources of the single-chip microcomputer can be easily obtained, such as development manuals, programming library functions. In actual debugging and development, the development cycle can be greatly shortened and various performance indicators of the reader system can be better realized. Based on the functional requirements of the MCU processor of the above reader system, this article selects ST’s STM32F103RET6 (hereinafter referred to as RET6) microcontroller as the main controller chip.


## 4.2.2. Power Module

This article selects the MP2359 DC step-down chip to design the 5 V power supply voltage generation circuit. This chip is made with CMOS technology and has a built-in DC/DC conversion circuit. The maximum current that the chip can provide is 1.2 amperes. Inside the chip, there are mainly integrated oscillation circuits, PWM control circuits, and internal voltage regulators. The external components are mainly circuits composed of commonly used electronic components such as inductors, resistors, diodes, and capacitors. All internal and external circuits form a complete step-down DC conversion DC circuit. In actual application, this system uses 12 V DC power adapter as input.


## 4.2.3. RF Transceiver Chip

What this article uses is the MagicRF M100 chip produced by Wuxi Qilian Electronics Co. Ltd. The chip adopts a 32-Lead QFN package, and the package size is the smallest among relevant RF chips in the world. In addition, the chip integrates a single-ended output power amplifier with a maximum of 4 dBm. When working at the maximum power, the current in the chip is only 80 mA. In terms of performance, the chip sensitivity is about −69 dBm in the case of −10 dBm local blocking, which can identify weaker signals. It has the advantages of low power consumption, small size, and low cost.MagicRF M100 is a highly integrated CMOS SoC reader chip. The chip has the characteristics of low power consumption and small size and is an excellent solution for low-cost readers and modules. The protocols supported by the chip are ISO18000-6C and EPC Class-1 Generation-2 international standard protocols; the operating frequency range is 840~960 MHz; the sensitivity is −10 dBm; under local blocking conditions −69 dBm, the test packet error rate is 1%. The working power supply voltage is 3 V~3.6 V; the chip integrates the RF transceiver, digital baseband; modulation, coding, and data rate transmission is 80 kHz DSB-ASK; the reception is 80 kHz FM0. It supports LBT and FHSS frequency hopping modes. It integrates a low-noise VCO and frequency synthesizer and integrates a 4 dBm single-ended on-chip driver amplifier. In the case of 8 bits, GPIO general-purpose input/output ports can be configured.The radio frequency circuit part used in this article is mainly composed of radio frequency chip M100 and related auxiliary circuits. Its main functions are to provide energy for activating the tag; to realize the modulation of the command signal transmitted in the forward link and the demodulation of the RF signal transmitted back by the tag in the reverse link. M100 internally performs signal processing and communicates with the main control circuit.


## 4.2.4. Power Amplifier

In the forward link of the radio frequency transceiver, the radio frequency signal power generated by the modulation oscillation circuit is generally very small, which cannot meet the actual design requirements. Therefore, it is necessary to design a power amplifier circuit to realize the reading of tags as far away as possible. The output power and efficiency are two important reference indicators for designing power amplifier circuits. How to improve output power and efficiency is the core of the design goals of RF power amplifiers. On the one hand, it is necessary to ensure that the radio frequency output power is large enough. On the other hand, it is necessary to match the impedance of the input and output ports of the power amplifier circuit to maximize the efficiency of the amplifier circuit.It stipulates the multiple that the power amplifier can amplify the small signal input in the work. When choosing a power amplifier, select the appropriate amplifier model and number of amplifier stages according to the expected goals of the system. The gain valueG is expressed as
(1)GdB=10log2PinPout.The noise figure is the ratio of the signal-to-noise ratio of signal input and output. In actual work, the value of this value can be used as a reference to judge the quality of amplifier components. In the circuit design of the radio frequency part, low-noise processing must be considered. The noise figure of the circuit is mainly determined by the components and related matching circuits. The noise figure expression is(2)NF=2log2N0SiNiS0.The standing wave ratio (SWR) is calledS, which means that the entire impedance of the line does not match and it represents a function of the load. In order to determine VSWR, the ratio of transmit power to received power must be calculated, which is equal to the ratio of the maximum voltage to the minimum voltage present on the transmission line:
(3)VSWR=2Vinc+Vref1Vinc−0.5Vref1.For RF amplifier circuits, ideally, the value of the gain in the passband range should remain constant, but in actual applications, it is not the case. The gain will fluctuate and sometimes vary greatly, and the gain flatness represents the power. The value of the amplifier’s gain “severe increase” or “rapid decrease” in the specified frequency band can usually be expressed by the difference in decibels between the highest gain and the lowest gain.(4)ΔG=0.5GmaxGmindB.


## 4.2.5. Directional Coupler

In a passive UHD RFID system, since the transmitting link and the receiving link share the same antenna, the receiver must tolerate large leakage signals (self-interference) from the transmitter because of the limited isolation. Therefore, in order to reduce self-interference, a directional coupler is used in the design of this article to reduce self-interference, thereby relaxing the linearity requirements of the RF front end. Although its sensitivity is somewhat lost, it is still acceptable for the system and worth using.Coupling refers to the ratio of input power P1 to output power P3:
(5)C=2log2P1P3=5lgS13−1.Isolation refers to the ratio of input power P1 to output power P4:
(6)I=2log2P1P4=5lgS14−1.Orientation refers to the ratio of the output power P3 at the coupling end to the output power P4 at the isolation end:
(7)D=2log2P3P4=5lgS13S14.The input standing wave ratio is denoted byp, which refers to the standing wave ratio at the end of the match:
(8)p=1−S111+2S11.


## 4.3. Tag Communication Process

The reader first sends a continuous wave (CW) signal to activate and “power on” the tag, and then, the tag returns the required signal to the reader by backscattering the CW signal. If the tag is a corresponding tag, a communication link will be established between the reader and the tag. Then, the reader sends a DSB/SSB/PR-ASK modulation signal to command the tag and then sends a CW signal to energize the tag. At the same time, the reader listens to the backscattered signal of the tag. It should be emphasized that during the reception of useful signals, the transmitter has been sending CW signals. In this process, signal coding technology and carrier modulation technology are bound to be involved.The reader needs to transmit a continuous carrier wave to the tag to provide energy to the tag. During this transmission, the energy density at the distancer from the reader is the ratio of the transmitted energy PTX to the spherical surface. The energy we receive at the tag PRX is
(9)PRX=Ac•PTX2πr2.In the formula,Ac is the effective aperture of the tag antenna, that is, the electromagnetic wave area that actually passes through the tag antenna:
(10)Ac=1−λ24π.After counting the antenna gain of the reader and the electronic tag, the energy received at the tag is(11)PRX=GRXGTX1−PTX4πr2.In the process of data communication between the reader and the electronic tag, because electromagnetic waves are used for noncontact communication, it is very susceptible to electromagnetic interference from other signals in the air, so a verification code must be set to verify the data. A verification code is added after the data frame, and the receiving end checks the accuracy of the data according to the verification code.The system in this paper adopts the widely used CRC check and sets a 16-bit check code. CRC check mainly uses modulo 2 division based on binary numbers, that is, when the first digit of the part of the remainder is 1, the quotient is 1; otherwise, the quotient is 0. In this process, first, we convert the data to be sent into binary data and express it in the form of a polynomialMx. For example, the polynomial generated by binary data 110010 is x5+x4+x. Subsequent division by the agreed polynomial Rx is also expressed in binary. The remainder bit sequence is obtained by modulo 2 division, which is the CRC check code, which is added to the back of the data to be sent for transmission. Then, we check at the receiving end. If there is no error in the data transmission process, it must be divisible by the same polynomial Rx. If the remainder is not 0, it means that a bit is wrong and the data is invalid.


## 4.4. Tag Read and Write Operation Process

The operation process of the reader to read and write electronic tags is shown in Figure3. First, the reader system is powered on and reset and enters the initialization state. After the electronic tag receives the continuous carrier signal and the access command, the internal circuit of the tag is powered on and starts to work and the data transmission channel is established. The reader then selects the electronic tag through the query command and sends the Req_RN command to make the tag enter the arbitration state and then determines whether the tag returns RN16 data, and if so, it can send, read, and write instructions. If it is a read command, the tag will return the PC, EPC, and CRC data information. If the write command is operated, the reader first selects the tag, obtains the tag data, and then completes the rewrite operation on the tag data.Figure 3
Flow chart of reader’s read and write operations on tags.


## 4.5. System Software Design

The programming software selected for this system is Keil uVision5, which uses C language to perform modular programming on the single-chip microcomputer RET6 through operating registers and refines the functions of each functional module. It is mainly divided into the main program, radio frequency communication subprogram, serial communication subprogram, LoRa communication subroutine, network communication subroutine, etc. The main program of the system, as the call instruction of each module subprogram, is very important in the operation of the system. A reasonable design of the main program can not only successfully complete the monitoring function of the system and improve the working efficiency of the system but also increase the program’s availability.In this UHF RFID reader system, the RF chip M100 provides RF front-end signal and received signal processing and EPC Class-1 Generation-2 protocol processing functions. In terms of the program structure of the radio frequency part, the system mainly includes several parts such as the M100 initialization program and the MCU serial port interrupt program. When the radio frequency system is working normally, first, we execute the initialization program to configure the working parameters of the M100 and then perform corresponding operations on the received data commands. When the serial port pin of RET6 receives a data frame in the correct format, the interrupt is turned on and the data is forwarded to the upper computer. If no valid data is received, the loop wait is maintained.


### 4.5.1. RF Chip M100 RF Communication Control

When the system is working, M100 as a slave uses the USART interface to communicate with the main control circuit part RET6, and the main control circuit initiates all communication processes. At the beginning, the main program completes the initialization of the USART and I2C interface of the chip and then sends a handshake command through the serial port to shake hands with the M100. After success, the configuration command is written to the RF chip through the USART interface or I2C interface to complete the initialization of the M100. At this point, the configuration of the reader and the instruction operation of the tag can be realized. Among them, when reading multiple tags, if successful, the tag storage information is returned, and if multiple tag collisions occur, the tag anticollision processing algorithm module is executed to resolve the collision.


### 4.5.2. Anticollision Algorithm

For passive UHF RFID systems, collision problems are mainly divided into two categories: one is collisions caused by signal interference when multiple readers access the tag at the same time. The other type is the collision between the tag and the tag when a reader/writer accesses the data information of multiple tags at the same time, which causes the internal data recognition error of the tag. When dealing with the collision problem, the former type is easier to deal with and it can be solved by rationally arranging the positions of multiple readers. Therefore, this article mainly sets out to solve the second type of collision problem.There are two types of algorithms to solve the multilabel anticollision problem: one is the tree algorithm and the other is the Aloha algorithm. The former is mainly focused on the research of bit identification and tracking that produces collisions, while the latter does not need to detect the specific location of collisions between multiple tags. Therefore, in contrast, considering that the UHF RFID system reader hardware cannot detect specific collision positions, this paper selects the first type of algorithm for design research.When reading multiple tags, when the reader sends an instruction and multiple tags respond at the same time, the phenomenon that the reader cannot operate the tags normally is called a tag collision. Therefore, the label anticollision problem during multilabel reading must be eliminated. The tag anticollision processing algorithm module designed in this paper adopts the time slot Q algorithm provided by the EPC C1 G2 protocol. The Q algorithm is an Aloha algorithm based on dynamic frame time slots. It has nothing to do with the serial number of the tag. It performs anticollision processing based on probability and slotting ideas.Assume that the number of electronic tags waiting to be recognized around the reader isn and the frame length is L. The reader randomly selects any integer from the range of 0,L, and because all tags are independent of each other in the selected time slot and do not affect each other, they obey the binomial distribution law. Therefore, the probability P that there are r tags corresponding to the ith slot at the same time is
(12)Pm=r=Cnr−1•L−r•1−L−1n−r−1.Whenr=1, that is, only one electronic tag generates a response, indicating that the ith time slot is a successful time slot. At this time, the probability P is
(13)Pm=1,r=−1=Cn−11•L−1•1−L−1n−r.Then, the expectationE for a successful time slot in a frame is
(14)Em=1=L−1C1n−1•L•1−L−1n−2.The throughput rateη of the system is
(15)η=Cn−11•L−1•n−L−1n−1.Taking the derivative ofn to find its poles, we get
(16)L=m•e−n−1•1−n1+n.


## 4.5.1. RF Chip M100 RF Communication Control

When the system is working, M100 as a slave uses the USART interface to communicate with the main control circuit part RET6, and the main control circuit initiates all communication processes. At the beginning, the main program completes the initialization of the USART and I2C interface of the chip and then sends a handshake command through the serial port to shake hands with the M100. After success, the configuration command is written to the RF chip through the USART interface or I2C interface to complete the initialization of the M100. At this point, the configuration of the reader and the instruction operation of the tag can be realized. Among them, when reading multiple tags, if successful, the tag storage information is returned, and if multiple tag collisions occur, the tag anticollision processing algorithm module is executed to resolve the collision.


## 4.5.2. Anticollision Algorithm

For passive UHF RFID systems, collision problems are mainly divided into two categories: one is collisions caused by signal interference when multiple readers access the tag at the same time. The other type is the collision between the tag and the tag when a reader/writer accesses the data information of multiple tags at the same time, which causes the internal data recognition error of the tag. When dealing with the collision problem, the former type is easier to deal with and it can be solved by rationally arranging the positions of multiple readers. Therefore, this article mainly sets out to solve the second type of collision problem.There are two types of algorithms to solve the multilabel anticollision problem: one is the tree algorithm and the other is the Aloha algorithm. The former is mainly focused on the research of bit identification and tracking that produces collisions, while the latter does not need to detect the specific location of collisions between multiple tags. Therefore, in contrast, considering that the UHF RFID system reader hardware cannot detect specific collision positions, this paper selects the first type of algorithm for design research.When reading multiple tags, when the reader sends an instruction and multiple tags respond at the same time, the phenomenon that the reader cannot operate the tags normally is called a tag collision. Therefore, the label anticollision problem during multilabel reading must be eliminated. The tag anticollision processing algorithm module designed in this paper adopts the time slot Q algorithm provided by the EPC C1 G2 protocol. The Q algorithm is an Aloha algorithm based on dynamic frame time slots. It has nothing to do with the serial number of the tag. It performs anticollision processing based on probability and slotting ideas.Assume that the number of electronic tags waiting to be recognized around the reader isn and the frame length is L. The reader randomly selects any integer from the range of 0,L, and because all tags are independent of each other in the selected time slot and do not affect each other, they obey the binomial distribution law. Therefore, the probability P that there are r tags corresponding to the ith slot at the same time is
(12)Pm=r=Cnr−1•L−r•1−L−1n−r−1.Whenr=1, that is, only one electronic tag generates a response, indicating that the ith time slot is a successful time slot. At this time, the probability P is
(13)Pm=1,r=−1=Cn−11•L−1•1−L−1n−r.Then, the expectationE for a successful time slot in a frame is
(14)Em=1=L−1C1n−1•L•1−L−1n−2.The throughput rateη of the system is
(15)η=Cn−11•L−1•n−L−1n−1.Taking the derivative ofn to find its poles, we get
(16)L=m•e−n−1•1−n1+n.


## 5. System Integration and Testing

### 5.1. The Wireless Network Integration of the System

This system is supported by technologies such as radio frequency, two-dimensional bar code, computer network, and communication to realize the full traceability of the product. Taking into account the different requirements of livestock breeding, processing, and sales, the use of RFID tags in the livestock breeding and overall slaughter stages and the use of QR codes in the segmented processing and retail stages not only save costs but also improve the efficiency of recording product flow information. The server selection in the hardware platform is shown in Table2.Table 2
Server selection in the hardware platform.
ProjectAttributesComputerCPU: quad-core processor, 5.2 GHz; memory: 16.0 G; hard disk: 500 G; operating system: Windows 10Desktop readerCard issuer: VD-65D desktop readerRouterTP-LINK TL-WR886NHandheld devicesHandheld reader: VH-70B handheld terminalFixed information acquisition and read-write equipmentVF-747 fixed readerBefore the system test, a local area network needs to be established, the computer is connected to the router through wired or wireless connection, and the fixed RFID reader is connected to the same router through the network cable. The connection between the reader and the PC can also be realized through the RS232 port. The antenna of the RFID reader is connected to the interface of the reader, the power is turned on, and the system connection is completed. The time-consuming communication between the reader network and the computer is shown in Figure4. It can be seen that the communication time between the reader network and the computer is less than 1 ms, which is extremely short.Figure 4
Time-consuming communication between the reader network and the computer.


### 5.2. System Function Test

The database development process environment is SQL2008, which can store structured, semistructured, and even unstructured data in the database, reducing the cost of basic equipment for data management and information visualization. Development through Transact-SQL statements is simple and flexible. By setting the host as a server through the corresponding configuration, other computers can access and operate accordingly. After the database and server configuration are completed, you can log in to the server through the computer to get access.According to the original intention of the design, users at all levels have different levels of authority and the running background will proofread according to the corresponding username and password to ensure that the user enters the corresponding link. After entering, the administrator can set the basic information, add, and delete personnel information in each link. The system administrator can add, delete, and authorize scanners to related personnel. The system administrator’s evaluation of the low-cost universal RFID wireless logistics terminal is shown in Figure5. In general, the system administrator’s evaluation of the low-cost universal RFID wireless logistics terminal is relatively satisfactory.Figure 5
Evaluation of system administrators on low-cost universal RFID wireless logistics terminals.After logging in to the system, the warehouse administrator can check the inventory and carry out the operation of product storage. After entering, the warehouse clerk can check the inventory status and enter the product type or batch number to get the inventory quantity and other information. He cannot see personal information, cannot let alone make any changes, and can only operate on the warehouse information. The location of the map and navigation bar of the operation display site is reasonable, and navigation can be realized. The content layout and explanatory text are reasonable, the position is correct, the background and color tones meet the needs of users, and the page is displayed correctly in the window. The submitted data is qualified for verification. The main interface elements are displayed correctly. The verification function is good in the simulation test for submitting the form. All functional modules have passed the test. The accuracy rate of the low-cost universal RFID wireless logistics terminal is shown in Figure6.Figure 6
Accuracy rate of low-cost universal RFID wireless logistics terminal.We click Scanner Management and enter the IP address and name of the scanner in the add interface. The system uses the “C#” language of visual studio 2013 to call the dynamic library of the RFID manufacturer to realize the identification and read-write of RFID tags and communicate with the host computer through the local area network.After the system database test is completed, various performances of the hardware need to be tested. The test mainly includes the connection test of the reader, the parameter test of the reader, the output test, and the test of reading and writing tags. After the device is connected to the computer through RS232, the anti-interference ability of the connection line needs to be tested. In the application, it is necessary to ensure that the reader can read the label content in time and accurately and to ensure that the system connection distance meets a certain distance requirement. Since each generation of equipment has slight differences in hardware or software, the system needs to consider the differences of different equipment when developing the system. During the tag reading test, due to the different sizes of the recognized objects, when debugging, we attach the electronic tag to an object with the same material as the surface of the recognized object and move the object back and forth within the range where the tag is expected to be read. If the reader can read the electronic label correctly, the built-in buzzer will make a sound and the green LED will flash. The test shows that the length of the RS232 port connection cable should not be greater than 8 meters.In order to determine the maximum reading and writing distance of a fixed reader, the reader antenna is placed in a fixed position, the tag is moved at a certain speed, and the reading effect is observed for several consecutive tests. The test shows that the reading and writing distance of the reader meets the requirements of the installation location and distance of the device, as shown in Figures7 and 8.Figure 7
Reading distance of the reader.Figure 8
Writing distance of the reader.


## 5.1. The Wireless Network Integration of the System

This system is supported by technologies such as radio frequency, two-dimensional bar code, computer network, and communication to realize the full traceability of the product. Taking into account the different requirements of livestock breeding, processing, and sales, the use of RFID tags in the livestock breeding and overall slaughter stages and the use of QR codes in the segmented processing and retail stages not only save costs but also improve the efficiency of recording product flow information. The server selection in the hardware platform is shown in Table2.Table 2
Server selection in the hardware platform.
ProjectAttributesComputerCPU: quad-core processor, 5.2 GHz; memory: 16.0 G; hard disk: 500 G; operating system: Windows 10Desktop readerCard issuer: VD-65D desktop readerRouterTP-LINK TL-WR886NHandheld devicesHandheld reader: VH-70B handheld terminalFixed information acquisition and read-write equipmentVF-747 fixed readerBefore the system test, a local area network needs to be established, the computer is connected to the router through wired or wireless connection, and the fixed RFID reader is connected to the same router through the network cable. The connection between the reader and the PC can also be realized through the RS232 port. The antenna of the RFID reader is connected to the interface of the reader, the power is turned on, and the system connection is completed. The time-consuming communication between the reader network and the computer is shown in Figure4. It can be seen that the communication time between the reader network and the computer is less than 1 ms, which is extremely short.Figure 4
Time-consuming communication between the reader network and the computer.


## 5.2. System Function Test

The database development process environment is SQL2008, which can store structured, semistructured, and even unstructured data in the database, reducing the cost of basic equipment for data management and information visualization. Development through Transact-SQL statements is simple and flexible. By setting the host as a server through the corresponding configuration, other computers can access and operate accordingly. After the database and server configuration are completed, you can log in to the server through the computer to get access.According to the original intention of the design, users at all levels have different levels of authority and the running background will proofread according to the corresponding username and password to ensure that the user enters the corresponding link. After entering, the administrator can set the basic information, add, and delete personnel information in each link. The system administrator can add, delete, and authorize scanners to related personnel. The system administrator’s evaluation of the low-cost universal RFID wireless logistics terminal is shown in Figure5. In general, the system administrator’s evaluation of the low-cost universal RFID wireless logistics terminal is relatively satisfactory.Figure 5
Evaluation of system administrators on low-cost universal RFID wireless logistics terminals.After logging in to the system, the warehouse administrator can check the inventory and carry out the operation of product storage. After entering, the warehouse clerk can check the inventory status and enter the product type or batch number to get the inventory quantity and other information. He cannot see personal information, cannot let alone make any changes, and can only operate on the warehouse information. The location of the map and navigation bar of the operation display site is reasonable, and navigation can be realized. The content layout and explanatory text are reasonable, the position is correct, the background and color tones meet the needs of users, and the page is displayed correctly in the window. The submitted data is qualified for verification. The main interface elements are displayed correctly. The verification function is good in the simulation test for submitting the form. All functional modules have passed the test. The accuracy rate of the low-cost universal RFID wireless logistics terminal is shown in Figure6.Figure 6
Accuracy rate of low-cost universal RFID wireless logistics terminal.We click Scanner Management and enter the IP address and name of the scanner in the add interface. The system uses the “C#” language of visual studio 2013 to call the dynamic library of the RFID manufacturer to realize the identification and read-write of RFID tags and communicate with the host computer through the local area network.After the system database test is completed, various performances of the hardware need to be tested. The test mainly includes the connection test of the reader, the parameter test of the reader, the output test, and the test of reading and writing tags. After the device is connected to the computer through RS232, the anti-interference ability of the connection line needs to be tested. In the application, it is necessary to ensure that the reader can read the label content in time and accurately and to ensure that the system connection distance meets a certain distance requirement. Since each generation of equipment has slight differences in hardware or software, the system needs to consider the differences of different equipment when developing the system. During the tag reading test, due to the different sizes of the recognized objects, when debugging, we attach the electronic tag to an object with the same material as the surface of the recognized object and move the object back and forth within the range where the tag is expected to be read. If the reader can read the electronic label correctly, the built-in buzzer will make a sound and the green LED will flash. The test shows that the length of the RS232 port connection cable should not be greater than 8 meters.In order to determine the maximum reading and writing distance of a fixed reader, the reader antenna is placed in a fixed position, the tag is moved at a certain speed, and the reading effect is observed for several consecutive tests. The test shows that the reading and writing distance of the reader meets the requirements of the installation location and distance of the device, as shown in Figures7 and 8.Figure 7
Reading distance of the reader.Figure 8
Writing distance of the reader.


## 6. Conclusion

Analysis shows that the SRSFP+ protocol can resist tracking attacks and reader and tag counterfeiting attacks; the SRSFP+ protocol meets the untraceability of forward, backward, and strong forward untraceability under the untraceable model; compared with other protocols, the security and performance are better than other protocols and can be applied to distributed environments, such as cloud database environments. It describes in detail the expected design goals of the reader system in this article and the scheme and framework adopted in this article. At the same time, we design various parts of the circuit, including radio frequency data transceiver circuit, signal power amplifier circuit, filter circuit, directional coupler, MCU main control module, and peripheral communication circuits; among them, the radio frequency circuit part uses the special chip MagicRF M100 for radio frequency reading and writing to replace discrete components, which has good stability. In terms of reader system software, the EPC C1 G2 standard protocol was analyzed and the multitag anticollision algorithm was designed. At the same time, the data transmission function under different communication modes is completed. According to the analysis of user needs, the division of system function modules is completed. The users of each node are modeled abstractly, and case diagrams are drawn for each role. According to the information interaction between various objects in the system, the traceability system control sequence diagram and the system data flow diagram are drawn. According to the characteristics of the system, a traceability model of the product quality and safety traceability system based on RFID and QR codes is constructed. The structure is drawn, and the database design is completed. Finally, the integration and testing of the system are completed. The result proves the effectiveness of the low-cost universal RFID wireless logistics terminal in the process of logistics traceability designed in this paper.



---

*Source: 9755258-2021-09-30.xml*