Otwarty dostęp

Design and Development of an Intelligent Laboratory Management System Based on STM Processors

, ,  oraz   
30 wrz 2024

Zacytuj
Pobierz okładkę

research background

Currently, university research laboratories are grappling with equipment management challenges, such as equipment idleness, damage, and disarray, which hinder the smooth progress of experimental teaching and scientific research. Due to the limited number of faculty and management staff, traditional management methods are inefficient and struggle to keep up with timely updates and maintenance. Therefore, there is an urgent need for an intelligent laboratory equipment management system to enhance efficiency and ensure the effective utilization of resources.

System Overview

This article mainly introduces a system for managing laboratory equipment based on the STM32 and GM65 barcode scanner [1]. The system is composed of three main parts: the barcode scanning module, the core board module, and the wireless communication module. The GM65 barcode scanning module is primarily responsible for scanning and recognizing QR code information, decoding the scanned information, and then sending the decoded text data to the core board to interact with the laboratory equipment [23]. The core board module is responsible for receiving information from the GM65 barcode scanning module and responding differently to different information, displaying the equipment borrowing and returning status on the TFT-LCD screen [3]. The communication module is divided into two parts: the WIFI module and the serial communication module [4]. It can achieve wireless communication with the mobile terminal, sending data from the core board to the mobile terminal. The serial communication module can communicate with the PC terminal through CH340, achieving communication between the core board and the PC terminal [6-7]. The system is shown in Figure 1.

Figure 1.

System Display Diagram

Microcontroller (SCM) is a form of implementation for embedded systems, integrating multiple functions such as CPU, memory, input/output interfaces, and clock circuits on a single chip to form a complete microcomputer system [8-9]. The GM65 barcode scanner is a high-performance, high-precision QR code scanning device that uses advanced image intelligent recognition technology and decoding algorithms to quickly and accurately identify barcodes [10]. The ESP8266 is a low-cost, high-performance WIFI module launched by Espresso Systems, widely used in embedded system design and IoT development [11]. It can be used as a standalone microcontroller or simply as a WIFI module to simplify the design. The CH340 is a widely used USB to serial chip, mainly used for data communication between computers and serial devices, and this module is also used in this design.

By providing a detailed introduction to the system's hardware design and software development plan, as well as an analysis of the implementation principles of each module, readers can gain a comprehensive understanding of the overall architecture of the system and the way each module functions [12-13]. This lays an important theoretical foundation and guidance for subsequent system development and application.

System Hardware Introduction
System Design Plan

The hardware part of the system is designed using a modular expansion approach from the inside out. Initially, the core module of the minimum system design was completed using the STM32F407 development board [13]. Subsequently, the design of the peripheral expansion modules around the minimum system was gradually completed in separate modules [14]. Finally, all modules were combined into one system to achieve the corresponding functions.

In Figure 2, the overall workflow of the system is as follows: The QR code containing information about the laboratory equipment is read by the GM65 barcode scanner [15-16]. The information characteristics of the experimental instruments contained in the QR code are then read. The control program written under the Keil5 software controls the serial port of the microcontroller, enabling serial communication between the GM65 barcode scanner and the microcontroller. After scanning the GM65 barcode, the information of the QR code is transmitted to the microcontroller through serial communication, realizing the reading of the laboratory experimental instrument information by the STM32, and displaying the information of the experimental instruments on the display screen. At the same time, information synchronization with the PC end is achieved through serial communication. In addition, wireless connection with the mobile terminal can be achieved through the ESP8266 wireless module, further realizing the management function of laboratory equipment.

Figure 2.

System Flowchart

Serial Communication

In Figure 3, there are a total of three related registers for STM32 serial communication: the USART_SR Status Register, the USART_DR Data Register, and the USART_BRR Baud Rate Register.

Figure 3.

Serial Port Register Diagram

Figure 4.

Software Design Flowchart

The process of serial port data transmission involves several key steps. First, when data needs to be sent, it is written into the Transmit Data Register (TDR). Before data transmission, the system checks whether the shift register is processing other data. If not, the newly written data is immediately transferred to the shift register for transmission. Once the data is moved to the shift register, the TXE (Transmit Data Register Empty) flag is set to 1, indicating that the data in the TDR register has been cleared and new data can be written for transmission. If the TXEIE bit in the USART_CR1 register is set to 1, an interrupt is triggered whenever the TXE flag is set. Data is shifted bit by bit to the right in the shift register and sent out through the TX pin. After the transmission is completed, this process is repeated, and the TXE flag is checked to determine if new data can be sent.

The process of serial port data reception also has several key steps. Data is first received from the RX pin and then read and shifted bit by bit into the shift register under the control of the receiver. When enough bits are received to form a complete byte, this byte is moved as a whole to the Receive Data Register (RDR). During this process, the RXNE (Receive Data Register Not Empty) flag is set to 1, indicating that there is data in the RDR that can be read. Once the RXNE flag is set, it means the data is ready to be read out from the RDR register.

Barcode Scanner Principle Introduction

Barcode scanners recognize QR codes by scanning the black and white modules on the QR code with optical sensors, converting them into digital signals, and then using decoding algorithms to transform the digital signals into recognizable information.

The specific steps include: the optical sensor inside the barcode scanner emits light, scans the black and white modules on the QR code, and converts them into electrical signals, including one-dimensional codes (such as EAN-13, CODE-39, ITF-14, etc.) and two-dimensional codes (such as QR codes, Data Matrix codes, etc.). The barcode scanner converts the scanned black and white modules into digital signals for subsequent processing. The built-in decoding algorithms of the barcode scanner decode the digital signals, transforming them into recognizable information, such as website addresses, text, links, etc. The GM65 module outputs the decoded numbers or text to external devices, such as computers, cash registers, etc., in the set output format (such as USB, serial port, Bluetooth, etc.).

Wireless Module Design

The wireless module used in this design is the ESP8266, which is a very powerful WIFI module capable of communicating with a microcontroller via a serial port, thus enabling programming to control the ESP8266. With the ESP8266, you can access some APIs to obtain weather information or complete network time synchronization, and also connect to the cloud platform for development. The ESP8266 comes in various specifications such as ESP-01/01S/07/07S/12E/12F/12S, and there is also the self-developed ATK-ESP8266 by Zhengdian Atom (with modified firmware and module pins). The one used in this project is the ESP-01S, but because it uses serial port transmission, the speed is relatively slow and it is not suitable for transferring large capacity data such as images or videos. The ESP8266 supports three working modes: STA, AP, and AP+STA. The AP mode is used in this project, where the ESP8266 acts as a hotspot, providing wireless access services and data access, enabling communication with the mobile end. The ESP8266 operates based on several principles. Initially, it undergoes power-on initialization, during which it loads its firmware and sets up WIFI connections. Following this, the module can link to a WIFI network using AT commands or through programming, enabling communication with other devices or the internet. Once connected, the ESP8266 is able to transmit data with other devices through the TCP/IP protocol stack, including both sending and receiving data. As a potent WIFI module, the ESP8266 is adept at communicating with and controlling other devices, making it suitable for diverse IoT applications.

Brief Description of AT Command Functions

AT Command Function
AT Testing for normal startup
AT+CWMODE=2 Setting AP Mode
AT+RST Restart
AT+CWSAP="esp","12345678",1,4 Setting AP parameters with the account name "ESP8266" and password "123456"
AT+CIPMUX=1 Setting multiple connection mode
AT+CIPSERVER=1,333 Starting SERVER mode, setting port to 333
AT+CIPSEND=0,7 Sending data with a length of 7 characters

In embedded development, AT commands are not only a set of instructions used for communication with the ESP8266 module, but they are also commonly used to control various communication modules, such as ESP8266 WIFI modules,4G modules, and so on. Typically, the main chip sends AT commands to the communication module through a hardware interface (such as a serial port), and the module responds with data after receiving it. By sending different AT commands, users can configure the ESP8266 module, connect to WIFI networks, establish data connections, and thus achieve communication and control with other devices. AT commands provide a simple and effective way to interact with the ESP8266 module, facilitating user development and debugging.

The following may be the AT commands used in this experiment. By setting it to AP mode, the mobile end can access network communication through relevant applications.

Introduction to System Software
Software Design Summary

In this application software design, an object-oriented design approach is used. The software design concept diagram is shown below.

Wireless Module Software Design

The system collects information through the GM65 barcode scanner and utilizes the core board for preliminary verification. If the information fails the verification, the system will display an error on the monitor and trigger an alarm mechanism. Once the information is verified successfully, it will be transmitted to the PC end via the serial port for recording, while the ESP8266 module is used to wirelessly transmit the information to the mobile end, completing remote data monitoring. The entire process emphasizes the collaborative work between hardware modules and the logical control at the software level, ensuring the accuracy of data transmission and the stability of the system. The design of the wireless module code is as follows. ESP8266("AT\r\n"); delay(50000); ESP8266("AT+CWMODE=2\rn"); delay(50000); ESP8266("AT+RST\r\n"); delay(50000); ESP8266("AT+CWSAP=\"esp\",\"12345678\", 1,4\r\n");delay(50000); ESP8266("AT+CIPMUX=1\r\n"); delay(50000); ESP8266("AT+CIPSERVER=1,333\r\n"); delay(50000);

ESP8266 Module

When designing the software for a wireless module, ensuring effective communication with the ESP8266 module is crucial. By sending AT commands such as AT and AT+RST, and receiving the module's OK response, one can verify its normal working state. Additionally, sending the AT+GMR command can retrieve the module's version information, further confirming its usability. After completing these tests, one can proceed to configure network settings, such as setting the IP address, port number, and placing the module in AT mode to achieve wireless communication with the mobile end. The AT command sending function code is as follow. void ESP8266(const char* num) { u16 i,j; i = strlen(num); for (j = 0; j < i; j++) { while (USART_GetFlagStatus(USART3, USART_FLAG_TC) == RESET); USART_SendData(USART3, (uint8_t)num[j]); } } ESP8266("AT\r\n"); ESP8266("AT+CWMODE=2\r\n"); “AT+CWMODE=2”

The ESP8266(const char* num) function plays a key role in software design, enabling control and configuration of the module by sending AT commands. This design provides a foundation for the stability and reliability of the wireless communication system, ensuring the implementation of the expected functions.

Testing Results Summary

During the testing process, we mainly focused on the performance of the TFT-LCD display, the PC end serial port assistant, and the transmission of information on the mobile end. It is necessary to accurately see the borrowing and returning status of laboratory equipment on the LCD screen, and at the same time, the information should be transmitted to the computer end and mobile end in a timely and accurate manner through the communication module. Through these tests and an in-depth analysis of the experimental results, we can evaluate the system's performance in various aspects, discover potential problems, and make timely improvements, thereby enhancing the system's stability and reliability.

Scanning the Display of QR Code

Observing the prompt messages for borrowing and returning different laboratory equipment on the mobile end, TFT-LCD screen end, and computer end after the barcode scanner scans the corresponding laboratory equipment's QR code, conclusions can be drawn accordingly.

The user interface design is guided by principles of simplicity and intuitiveness, ensuring that users can navigate the system with ease. The LCD display serves as the primary point of interaction, providing a clear and concise visual representation of the oscilloscope's status. As shown in Figure 5, the display screen and mobile application synchronize to show the same information, ensuring consistency across platforms.

Figure 5.

Normal scanning display status

When the barcode scanner successfully scans the QR code of the experimental equipment, the LCD display transitions from a neutral state to indicate a borrowed state. This change is achieved with a single scan, setting the status to "borrowed." To revert the status back to "returned," users simply need to scan the QR code again. This toggle functionality is reflected in both the LCD display and the mobile application, as depicted in Figure 5.

The interface layout prioritizes user experience. Key information, such as the oscilloscope's status, is prominently displayed, while secondary details are accessible through a straightforward menu navigation system. Interactions are minimized, with most operations requiring no more than a few clicks or scans, streamlining the process for users.

Display Situation When Scanning an Incorrect QR Code

When the barcode scanner detects an irrelevant QR code, the system can trigger an alarm on the driver screen and display an error, as shown in Figure 6, the test generally meets the requirements.

Figure 6.

Display Error Message on the Screen

The following image is the error message displayed on the TFT-LCD screen when an incorrect QR code is scanned.

Testing Results Analysis

Through the experimental results, it can be observed that when equipment is borrowed or returned, the system correctly displays relevant information prompts on the display screen, PC end, and mobile end, ensuring the accurate conveyance and timely feedback of information. During the testing process, we paid special attention to the system's response speed and accuracy in actual operation scenarios. The results showed that the system could quickly respond to the borrowing or returning operations of the oscilloscope and display corresponding information on each port, ensuring that operators could clearly understand the status of the equipment, thereby improving operational efficiency and accuracy. In addition, when the barcode scanner scans information unrelated to laboratory equipment, the system can also provide error prompts, ensuring the accuracy of the system in identifying and handling exceptions. This error prompt function is particularly important in the laboratory management system, as it can help users quickly discover and correct erroneous operations, preventing damage or loss to laboratory equipment and data, and ensuring the normal and safe operation of the laboratory.

Through the above test results and in-depth analysis, it can be confirmed that the system performs well in various functional modules, with high stability and reliability. These test results not only verify the rationality and feasibility of the system design but also provide important references for further optimization and improvement of the system. In practical applications, these test results also provide strong support for the reliability and efficiency of the system, offering users a better user experience and service guarantee.

Conclusions

Developing the laboratory equipment management system with the STM32F407 as the central control unit, we have focused on serial port communication, a key method for interfacing with external modules such as the ESP8266 and for internal serial port interactions. This approach forms the backbone of our system's design.

The system's adaptability allows for its application in diverse settings, including libraries, supermarkets, and museums. A practical example is the implementation of a book borrowing system in libraries. By encoding book-specific information into QR codes, affixing them to the books, and integrating with our system, librarians can achieve a remarkable 90% return rate. This high efficiency is further enhanced by the system's ability to promptly detect and address any damages, ensuring the books remain in good condition for readers.

Similarly, the system can be tailored to create product information inquiry systems in supermarkets or cultural relic information systems in museums, significantly improving the management and user experience in these environments. The integration of this system not only streamlines processes but also enhances the reliability and durability of equipment, making it a valuable tool for modernizing management practices across various industries.

Język:
Angielski
Częstotliwość wydawania:
4 razy w roku
Dziedziny czasopisma:
Informatyka, Informatyka, inne