Logistics plays a very important role in the whole enterprise supply chain. Through the batch identification of RFID, realize the delivery, warehousing and sorting process of logistics. Through the GPS positioning system, real-time access to vehicle information. Through the real-time data analysis and report functions of server and data center, it is possible to grasp the dynamic changes of enterprise resources. Intelligent logistics system greatly improves the efficiency of the whole supply chain.
1 system scheme
In this design, the fixed RFID card reader is used to collect information, which is sent to the data processing terminal with ARM11 as the core by serial port for processing. Therefore, the system is divided into two parts.
The first part: the collection of RFID tag information, mainly select the fixed reader to identify the RFID tag information and send it to the terminal;
The second part: data acquisition, which is a data processing terminal with ARM11 as the core processor. The terminal is equipped with Linux operating system, and installed with SQLite and QT / E database for data acquisition and storage.
2 implementation module
The implementation of the system depends on the following four functional modules: 1) RFID information collection; 2) Real time reading of serial data; 3) SQLite data operation; 4) QT / e user interface design.
2.1 collection of RFID electronic information
2.1.1 RFID tags
RFID tags are divided into passive tags and active tags. Active tag has battery power supply, long read / write distance, large volume and higher cost compared with passive tag. It is also called active tag. Passive tag obtains the energy required by the reader in the magnetic field, which has low cost and long service life. It is smaller and lighter than the active tag, and the reading and writing distance is shorter, which is also called passive tag. Generally speaking, passive label is the main development direction to replace bar code label. Active label, because of its advantages of long-distance recognition, is mainly applied to the identification of large high-speed moving objects. Such as vehicle tracking and identification, animal or human identity tracking and identification.
The following is a passive tag as an example to introduce its principle and performance.
The RFID tag consists of an antenna and a special chip. The antenna is a copper film coil plated on the plastic substrate. A very small integrated circuit chip is embedded on the plastic substrate. In this integrated circuit chip, there are three modules: high-speed RF interface, control unit and EEPROM. As shown in Figure 1.
2.1.2 electronic label identification system
A real RFID electronic tag identification system should at least include the electronic tag, reader, data processing and storage equipment and system software. Usually, the reader is connected with the computer, and the tag information read is transmitted to the computer for further processing. The reader sends a certain frequency of RF signal through the antenna. When the tag enters the magnetic field of the RF signal of a certain frequency, it generates induced current to obtain electric energy, and generates voltage to supply the integrated circuit in the tag to work, and sends its own coding information through its own RFID tag antenna, It is received by the reader receiving antenna, read and decoded, and then sent to the computer host for relevant processing.
2.1.3 RF card reading module
The reader used in this design is tx125 Series RF card reader module. Tx125 series contactless IC card RF reading module adopts 125k RF base station. When there is a card close to the module, the module will output ID card number in Wigan or UART mode, and the user only needs to read it. The card reading module fully supports the operation of EM, temic, TK and their compatible cards.
Data format: 6-byte data, high bit first, format is 5-byte data + 1-byte check sum (XOR sum). For example, if the card number data is 0b00d5foc7, the output is 0x0b 0x00 0xd5 0xf0 0xc7 0xe9 (check sum calculation: 0x0b ^ 0x00 ^ 0xd5 ^ 0xf0 ^ 0xc7 = 0xe9). The first byte 0x0b is usually the manufacturer code. The middle four bytes of the card are the serial number of the card. Generally, the cards are printed with decimal code. For example: 001402807213 61639. The above data can be obtained by conversion. The conversion method is as follows: convert the middle four byte card number 0x00d5f0c7 to decimal, that is, 001402807; Convert the second byte of the card number, 0xd5, to decimal, to get 213, and the last two bytes of the card number, 0xf0c7, to decimal, to get 61639.
In the serial port mode, it can work in active and passive mode. Active mode: when a card enters the RF area, the card number data in the above format will be sent out actively. Passive mode: the falling edge of CLK triggers the output of card number in the above data format. The operation method is as follows: before preparing to read the card number, open the serial port interrupt and start the timeout timer (80 ms), set the CLK which has been kept at high level to low level, generate a falling edge and keep it at low level, wait for the card number data to be received, if the card number is received and stored for use, if there is no data received in the waiting process, and the timeout timer has overflowed, It means that the card number reading failed this time; Regardless of success or failure, the CLK will be reset to high level at last to enter standby so that the card number can be read next time.
Serial communication protocol is the format of the card reading module to send the read card number. Tx125 supports Wigan interface and serial port. The data format of UART interface frame is: 1 start bit, 8 data bits, no parity bit, 1 stop bit. The baud rate can be 9 600 BPS or 19 200 bps. In this design, we connect the / dev / TTY Sac1 serial port device of 6410 gateway device, and choose to set the baud rate to 9 600.
The main function is pthread_ create （&th_ kb，NULL，KeyBoardPthread，0）; pthread_ creat （&rf_ rev，NULL，RFIDRevPthread，0）。 Two threads are set up, the first is to read and write RFID information by keyboard input, and the second is to monitor the information in the serial port / dev / ttysac1, which has realized the real-time capture and writing of RFID tag information.
2.2 real time reading of serial data
In the Linux operating system, the access to peripherals is often to use the open() function to read data by opening files. In this design, the access to the serial data is just through the open() function to open the serial driver file / dev / ttysac1 to obtain the data sent by the reader to the ARM11 main core board. The implementation function is open (/ dev / ttysac1, O)_ RDWR | O_ Noctty), the flag bit is o_ RDWR | O_ Noctty means that the system opens the file in a read-write manner. If the file to be opened is a terminal device, the terminal will not be regarded as a process control terminal.
Before opening the serial port file, we need to set the serial port. The specific steps are as follows: setting the serial port properties, saving the original serial port configuration, activating options, setting baud rate, setting character size, setting verification, setting stop bit, setting minimum character and waiting time, clearing serial port buffer, activating configuration. The settings are implemented by the following structures:
After successfully opening the driver file, what we need to do is to use the read() function to read out the signal sent by the reader, so as to identify the type of goods and store the information accurately in the database. The prototype of read() function is read (int FD, void * HUF, size)_ The function of read() is to transfer count bytes from the file indicated by the parameter FD to the memory indicated by the buf pointer. The data read out will be stored in buf as the basis of RFID tag identification.
2.3 data management by SQLite
There are many databases used in embedded devices, such as mysql. This design chooses a more convenient database SQLite. This design is to establish a logistics commodity information database system, including information: the name of the commodity (char type), the ID number of the commodity (char type) and the price of the commodity (int type). All the information will be stored in the table merchant disk.
When the RFID tag on behalf of a commodity is written to the reader for the first time, the system will uniquely determine its commodity name, commodity ID number and price according to its tag number, and write these messages to the table merchant at one time. When the RFID tag of the goods stored in the warehouse is re written to the reader, it will be used as the outbound operation of the goods, and the system will automatically delete the information of the goods in the database.
In the part of data storage management, make full use of the convenient and effective API function provided by SQLite: SQLite3_ open（），sqlite3_ Exec () and SQLite3_ Open and operate the database file.
In the whole operation of goods in and out of the warehouse, the data entry and deletion will be automatically completed by the system, eliminating the manual operation, greatly improving the efficiency of warehouse management and reducing human resources.
2.4 design of QT / e user interface
QT / E (QT embedded) is a graphical interface development tool of Norway trollletch company. The embedded version of QT has a high efficiency, and the overall use of object-oriented programming, has a good architecture and programming mode. In the system design, in order to make managers better manage the information of warehouse items, a 4.2-inch touch screen is equipped on the development board to provide a good UI interface for observing the inventory information in the database.
In this design, QT is selected to develop UI. In the main interface, a table view control is added to bind the SQLite database file RFID_ sqlite.db。 In the development process, add the header file “QSqlDatabase”, which is necessary for QT to connect to the database. The header file contains many functions to operate the database and present the data information to users. The statement QSqlDatabase DB = QSqlDatabase:: adddatabase (“qsqlite”) indicates that the database type QT needs to connect to is SQLite, and then through dB. Setdatabasename (“RFID”)_ SQLite. DB “) to open the database needed by the linked system. The default path is the current folder, and the display result is shown in Figure 2.
3. Realize the function
The purpose of this design is to realize the delivery, storage and sorting process of logistics through RFID batch identification. Through the functions of the server and data center, we can master the dynamic changes of enterprise resources. In this system, the fixed low frequency card reader is selected to realize the entry and deletion of commodity information. Four different commodities are simulated: A, B, C, D, corresponding commodity ID. When the goods are stored in the warehouse, the RFID tag is put on the card reader for swiping. The terminal part monitors the serial port / dev / ttyrsac1 in real time. When the data is swiped, the function body sqlitedb defined in the database operation file SQLite. C is called in the RFID tag ID identification function body based on the ID number_ opt_ Add (char * NA me, char * id, int price) to enter the commodity information; When the goods are out of the warehouse, the RFID tags that need to be in and out of the warehouse are swiped again. The system will automatically identify the swipe times of the goods to identify whether the operation mode is out of the warehouse or in the warehouse. When it is determined that it is the second swipe, the function body sqlitedb will be called_ opt_ delete_ by_ ID (char * id), delete the information of the commodity from the database to achieve the operation of data delivery. The first swipe of the label is regarded as the stock in of the commodity, and the second swipe is regarded as the stock out operation. The user can observe the entry and deletion of this information in real time from the table view control in the UI interface.
This design takes ARM11 microprocessor as the core, combines Linux operating system and tx125 Series RF card reading module to realize the intelligent logistics goods management system. It focuses on the development and transplantation of database and UI in embedded device system. The experiment shows that the system realizes the management function of goods out of warehouse and in warehouse, which is convenient and practical. It fully highlights the strong practicability of RFID technology at present, and also reflects the great convenience of embedded system to daily life, which brings great effect to the logistics industry. There are still many areas that need to be improved in this design, such as adding GPS positioning to each item, so as to realize the monitoring of goods flow direction by customers and logistics companies.
Editor in charge: CT