LoRaWAN-based experimental equipment management system
By designing an experimental equipment management system based on LoRaWAN and adopting dynamic differential upgrade strategy and frame insertion strategy, the problems of resource allocation conflicts and low data transmission efficiency in laboratory equipment management are solved, and efficient and reliable equipment management and data transmission are achieved.
Patent Information
- Application Number
- CN202411307209.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-19
- Publication Date
- 2025-01-17
- Estimated Expiration
- 2044-09-19
AI Technical Summary
There are problems in laboratory equipment management with resource allocation conflicts, low data transmission efficiency and inconvenient equipment update methods. Especially in environments where equipment is widely distributed and large in number, traditional methods are difficult to meet the needs of efficient management.
An experimental equipment management system based on LoRaWAN is designed, including equipment control unit, LoRaWAN communication unit, power monitoring unit, user interactive display unit, remote reservation management platform, gateway and server unit, firmware management and upgrade unit. The system adopts a dynamic differential upgrade strategy to perform remote firmware upgrades through the LoRaWAN network. When the device is in normal use, the upgrade data is embedded through a frame insertion strategy to ensure priority transmission of business data.
It significantly improves the efficiency of laboratory equipment management and the reliability of data transmission, solves the problems of resource allocation conflicts and inefficient data transmission, reduces equipment usage conflicts and experimental delays, and improves equipment utilization and laboratory management efficiency.
Smart Images

Figure CN119324939A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet of Things and embedded systems, and in particular to a LoRaWAN-based experimental equipment management system, which aims to solve the problems of resource allocation conflicts, low data transmission efficiency, etc. in laboratory equipment management. Background Art
[0002] With the advancement of modern scientific research, the scale of laboratories continues to expand and the number of equipment increases. The management and use efficiency of laboratory equipment has become one of the key issues in laboratory operations. Traditional equipment management methods mainly rely on manual operations, which are not only inefficient but also prone to uneven resource allocation. In the current laboratory environment, it is often the case that multiple students or researchers need to use the same equipment at the same time, resulting in equipment conflicts and unnecessary waiting. This situation not only affects the progress of the experiment, but may also cause confusion in the experimental data, further reducing the overall operational efficiency of the laboratory.
[0003] In the management process of experimental equipment, updating the operating information of experimental equipment is an important link. These operating information usually include the instructions for use of the equipment, operating procedures, graphical interfaces, and equipment pictures, etc., which are usually presented in the form of pictures and texts. The amount of data is large, and the update involves a large file transfer requirement. In the prior art, the update of this information often needs to be completed through local operations, such as using an SD card or USB interface to directly update the display content of the device. This method increases the cost of additional technicians, and in a laboratory environment where the equipment is widely distributed and large in number, manual operation is difficult to meet the needs of efficient management.
[0004] To solve these problems, LoRaWAN technology, as a low-power, long-distance communication technology, has gradually been applied to remote monitoring and management of laboratory equipment. However, due to the low-speed characteristics of LoRaWAN, it faces significant efficiency bottlenecks when transmitting large amounts of data, including equipment operation information. Especially when updating this information remotely, the transmission time is long and is easily affected by network quality, resulting in an increased risk of transmission failure. In addition, existing transmission methods usually adopt fixed strategies, lack dynamic adjustment capabilities, and cannot optimize transmission efficiency under real-time network conditions. What's more serious is that this update method often requires the equipment to be suspended during the update, which affects the normal operation of the laboratory. Summary of the invention
[0005] In view of the shortcomings of the prior art, the present invention proposes an experimental equipment management system based on LoRaWAN, and the specific technical solution is as follows:
[0006] An experimental equipment management system based on LoRaWAN, comprising: an equipment control unit, a LoRaWAN communication unit, an electric energy monitoring unit, a user interaction display unit, a remote reservation management platform, a gateway and server unit, and a firmware management and upgrade unit;
[0007] The device control unit is used to control the power supply of the experimental equipment, and includes a relay module controlled by a single-chip microcomputer to realize the power switch control of the equipment; the LoRaWAN communication unit uses a wireless communication Soc chip to communicate with the remote server through the LoRaWAN network, and is responsible for receiving and transmitting device status information and firmware upgrade data packets; the power monitoring unit includes an power metering chip for real-time monitoring of the current, voltage, power and other parameters of the experimental equipment; the user interaction display unit includes a serial port screen connected through 485 communication, which is used to display the reservation information, operation process, equipment introduction pictures and precautions of the experimental equipment; the remote reservation management platform runs on the server side, which is used to manage the use reservation of the experimental equipment and monitor the operating status of the equipment; the gateway and the server are used to process the communication and data transmission of the system, wherein the server runs the remote reservation management platform and the firmware upgrade management system, and the gateway is responsible for the device communication and firmware update management through the LoRaWAN network;
[0008] The firmware management and upgrade unit adopts a dynamic differential upgrade strategy to remotely update the firmware of the display unit, specifically: first, the old version of the firmware of the target terminal device is obtained, and it is compared with the new firmware on the server side to generate a differential packet; then, the differential packet is divided into several small blocks, and the size and transmission frequency of the blocks are dynamically adjusted based on the current network status and the normal business data transmission of the device; when there is no normal business data transmission, the block transmission is performed according to the maximum transmission capacity; when there is normal business data transmission, the differential packet data is embedded into the transmission gap of the normal business data through the frame insertion strategy; at the terminal device, each block data is received and verified, and confirmation or request for retransmission is made based on the verification result; after all blocks are received and reassembled, a new firmware is generated based on the differential packet and the old firmware, and it is overwritten and written into the main storage area of the terminal device after verification; the single-chip microcomputer starts the firmware upgrade program, and the new firmware is used to update the content of the display unit to ensure the normal operation of the display unit function.
[0009] Furthermore, in the experimental equipment management system, the experimenter reserves the use time of the equipment through the remote reservation management platform. The equipment control unit performs the power-on operation when the reservation time arrives, connects the power of the equipment for the experimenter to use, and after the reservation time ends, the experimenter turns off the power of the equipment by himself.
[0010] Furthermore, the device control unit works in conjunction with the power monitoring unit to control and monitor the operating status of the experimental equipment in real time. After the scheduled use of the experimental equipment ends, the power monitoring unit determines whether the equipment is still in use by monitoring the equipment current. If the equipment is still in use, a notification is sent to the appointment personnel through the remote appointment management platform, prompting that the appointment time has expired and requiring the experimenter to manually turn off the power of the equipment. In order to protect the safety of the equipment, the device control unit can only perform the power-off operation after the power of the equipment is manually turned off.
[0011] Furthermore, the display content of the serial port screen can be remotely and dynamically differentially upgraded through the firmware management and upgrade unit to update the device introduction picture and operation process.
[0012] Furthermore, the firmware management and upgrade unit storage area includes a storage chip for storing the current firmware and the received differential upgrade package.
[0013] Furthermore, the dynamic differential upgrade strategy is specifically implemented through the following sub-steps:
[0014] S1: differential packet generation;
[0015] S1.1: The server receives the update request, obtains the device number and new update package to be updated, and then sends a request message for obtaining version information to the target terminal through the gateway;
[0016] S1.2: The server retrieves and obtains the corresponding old version update package stored in the server according to the received version number; the server compares the old and new version files using the BSDIFF algorithm to generate a differential package, and compresses the differential package using the LZ77 lossless compression algorithm. After the differential upgrade package is prepared, it is sent to the gateway storage;
[0017] S2: Network quality assessment;
[0018] S2.1: The gateway sends an upgrade request to the target terminal node that needs to be upgraded, including the basic information of the upgrade package (including file size and CRC16 checksum); after receiving the request, the target node records the upgrade package information and starts the upgrade program;
[0019] S2.2: After starting the upgrade program, the node sends an empty data packet (i.e., an empty uplink message) to the gateway. After receiving the data packet, the gateway measures the received signal strength indication (RSSI) and the signal-to-noise ratio (SNR), and calculates the link margin. The calculation formula for the link margin is:
[0020] Maxin=SNR measured -SNR required (1)
[0021] Among them, SNR measured is the signal-to-noise ratio of the empty data packet received by the gateway, SNR required The minimum signal-to-noise ratio required for the gateway to successfully demodulate the signal (usually based on the spreading factor (SF) used);
[0022] S3: differential packet transmission;
[0023] S3.1: The gateway divides the upgrade package file into several file blocks and dynamically adjusts the size of the file block according to the link margin (Margin) calculated in step S2.2 and the current spreading factor (SF). Suppose the file block size is B n ;
[0024] S3.2: First calculate the maximum load capacity P under the current spreading factor (SF) SF : Based on the current spreading factor (SF) and bandwidth, the maximum payload capacity P SF It can be calculated by the following formula:
[0025]
[0026] Among them, DR is the data rate, which is determined by SF and bandwidth, TOA is the air time, which means the time required for the data packet to propagate in the air, Header Size is the size of the physical layer header, and Payload Overhead is the overhead of LoRaWAN transmission. The calculated result P SF It represents the maximum load capacity that can be carried under the current SF;
[0027] S3.3: File block size B n According to the change of Margin and the maximum load capacity P SF Adjust according to the following formula:
[0028]
[0029] Among them, B n-1 The size of the file block previously transferred, Margin n-1 is the link margin measured last time, Margin baseline is a preset benchmark Margin value; through this adjustment method, when the link margin is high, the file block size increases to improve the transmission efficiency; when the link margin is low, the file block size decreases to improve the transmission success rate;
[0030] S3.4: When service data and upgrade package data need to be transmitted at the same time, the gateway can insert the upgrade package data into a single service transmission frame. If the service data does not occupy the maximum load capacity P SF, the remaining capacity is used to transmit the upgrade package data; specifically, if the business data size B data Less than the maximum load capacity P SF , the remaining capacity is used to insert the upgrade package data B upgrade ,The adjustment formula for interpolation transmission is as follows:
[0031] B upgrade =min(P SF -B data ,B n ) (4)
[0032] Among them, B upgrade is the size of the upgrade package data actually inserted into the transmission frame, B n The size of the upgrade package data block is dynamically adjusted according to Margin. Through this frame insertion method, the service data and the upgrade package data share the transmission frame, and the bandwidth resources are fully utilized for efficient upgrade package transmission while ensuring that the service data is transmitted first.
[0033] S3.5: After each file block is successfully transmitted and verified by the node, the node sends a short confirmation message (ACK) to the gateway to confirm that the file block is received and verified successfully. After receiving the confirmation message, the gateway measures the signal quality of the confirmation message (such as signal strength and signal-to-noise ratio) and calculates the link margin (Margin) accordingly; during the entire upgrade process, the gateway continuously dynamically adjusts the file block size and transmission frequency according to the network quality measured by the received empty data packets and the current spreading factor SF value to ensure the optimization of transmission efficiency and success rate under different network conditions;
[0034] S4: differential packet storage and processing;
[0035] S4.1: Each data block is added with an index number and an end flag when it is sent; when the end flag is 1, it means this is the last data block, and when it is 0, it means there are subsequent data blocks. The end of the data block is a CRC-16 checksum to verify the accuracy of the data packet;
[0036] S4.2: The terminal node first allocates a buffer for the received data block to temporarily store the content of each data block. After the data block is stored in the buffer, the node immediately calculates the CRC-16 checksum of the data block and compares it with the checksum carried in the data block. If the check succeeds, the data block will be marked as writable and an ACK signal will be sent to the gateway. If the check fails, the data block in the buffer will be discarded and a NACK signal will be immediately sent to the gateway to request retransmission.
[0037] S4.3: At the gateway end, after each data block is sent, it waits for the ACK signal from the terminal node. If the ACK is not received within the set timeout period, the gateway will retransmit the data block. The number of retransmissions is set to 3 times. If it is still unsuccessful after 3 retransmissions, the gateway will trigger the error handling mechanism, suspend the upgrade and report to the server;
[0038] S4.4: In the terminal node, the storage space is divided into three independent storage partitions: Slot A, Slot B and Slot C, which are used to store old firmware, new firmware and differential packages respectively; Slot A is used to store the old firmware version currently running. Before the new firmware is fully verified, the firmware in this partition will not be erased to ensure that the system always has a stable running version; Slot B is used to store the generated new firmware version. When the new firmware is generated, the system will temporarily store it in this partition, and after verification, it will be overwritten and written to Slot B; Slot C is used to store the received differential package. This partition is used to temporarily store and process differential data until the new firmware is generated and passed the verification;
[0039] S4.5: If the received data block passes the verification, the terminal node writes its content into the Slot C area of the storage chip according to the index number of the data block. Each time it writes, it ensures that the size of a single data block does not exceed 256 bytes; if the data block is less than 256 bytes, the remaining part is filled with a specific padding byte 0xFF to ensure the consistency of page writing. After writing each data block, the terminal node immediately reads the written data from the storage chip and performs CRC verification again to ensure that no error occurs in the data writing process;
[0040] S5: differential packet reassembly and verification;
[0041] S5.1: After all data blocks are received and successfully written into Slot C, the terminal node starts to reassemble the differential packet; the terminal node arranges the received data blocks in index order, first creates an array of sufficient size to save the pointers of all data blocks, and then inserts the data blocks one by one according to the index number to ensure that they are arranged in the correct order. After the sorting is completed, these ordered data blocks are merged into a continuous differential packet. After the reassembly is completed, the terminal node performs a full packet CRC check on the entire differential packet to ensure data integrity;
[0042] S6: Generate new firmware and replace old firmware;
[0043] S6.1: The terminal node uses the BSDIFF algorithm to generate new firmware based on the old firmware in Slot A and the differential packet in Slot C. The new firmware is temporarily stored in Slot B.
[0044] S6.2: After the new firmware is generated, the terminal node triggers the upgrade system and the screen enters the upgrade program;
[0045] S6.3: After the screen upgrade is successful, the terminal node erases the old firmware in Slot A; after the erasure is completed, the terminal node writes the new firmware in Slot B into Slot A, overwriting the original old firmware; after the new firmware is written into Slot A, the terminal node erases Slot B and Slot C to release storage space.
[0046] Furthermore, the present invention adopts a dynamic differential upgrade strategy, in which the frame insertion strategy embeds the upgrade package data into the normal business data transmission gap, ensuring that business data is transmitted first even during the firmware upgrade process, thereby not affecting the normal scheduled use of the experimental equipment.
[0047] Furthermore, all terminal nodes of the experimental equipment management system adopt CLASS C type LoRaWAN devices to ensure the real-time data transmission and the stability of the system.
[0048] The beneficial effects of the present invention are:
[0049] The LoRaWAN-based experimental equipment management system and software upgrade method provided by the present invention significantly improve the efficiency of laboratory equipment management and the reliability of data transmission through innovative design and multiple technical improvements. Specifically, the following innovative and practical features are outstanding:
[0050] 1. Aiming at the management needs of experimental equipment, the present invention designs a set of experimental equipment management system, which covers functions such as remote control of equipment, reservation management and equipment power monitoring. Through the remote reservation management platform, experimenters can efficiently reserve the equipment usage time, and the system automatically manages the power on and off of the equipment according to the reservation situation, avoiding equipment usage conflicts. The system can also intelligently remind users to turn off the equipment after the reservation ends, further improving equipment utilization and laboratory management efficiency, and reducing resource waste and experimental delays caused by human operational errors.
[0051] 2. Compared with the traditional full firmware update method, this invention introduces a dynamic differential upgrade strategy based on the BSDIFF algorithm in experimental equipment management. This strategy only transmits the difference between the new and old firmware, greatly reducing the amount of data transmission, especially suitable for low-rate network environments such as LoRaWAN. This not only shortens the firmware update time, but also reduces the network load and improves the overall efficiency of the system.
[0052] 3. The present invention cleverly applies the frame insertion strategy between the business data transmission and the firmware update data transmission, realizing the dynamic coordination between the two. During the normal use of the experimental equipment, the system prioritizes the transmission of business data and flexibly inserts the firmware update data in the transmission gap. This innovative technology effectively avoids the interference of firmware updates on the normal use of the equipment, ensuring the continuity of the experimental progress and the efficient use of the equipment.
[0053] 4. The present invention evaluates the signal quality of the LoRaWAN network in real time and dynamically adjusts the data block size and transmission frequency based on this information. This intelligent adjustment mechanism ensures the maximization of data transmission efficiency and success rate under different network conditions, reduces transmission failures and retransmission times, and improves the stability and reliability of the system.
[0054] 5. The present invention introduces a partition storage and differential package reorganization mechanism, which divides the firmware storage space into multiple independent partitions for storing old firmware, new firmware and differential packages. Through a strict verification and validation process, the data integrity and security during the generation and deployment of the new firmware are ensured. This partition storage and management method provides higher system redundancy and fault tolerance. Even if an abnormality occurs during the update process, it can quickly recover to a stable state, avoiding the risk of long-term unavailability of the device.
[0055] Through these innovative designs, the present invention significantly improves the automation and intelligence level of laboratory equipment management, greatly optimizes equipment utilization efficiency and data transmission performance, and effectively solves problems such as resource allocation conflicts and low data transmission efficiency in the prior art. This system has broad application prospects and promotion value in equipment management in modern scientific research laboratories. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 is a schematic diagram of the system architecture of the present invention;
[0057] Figure 2 It is a flow chart of remote reservation and management of experimental equipment of the present invention;
[0058] Figure 3 It is a flow chart of the dynamic differential upgrade strategy of the present invention. DETAILED DESCRIPTION
[0059] The present invention will be described in detail below according to the accompanying drawings and preferred embodiments, and the purpose and effect of the present invention will become more clear. The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0060] like Figure 1As shown, a LoRaWAN-based experimental equipment management system and software upgrade method include: an equipment control unit, a LoRaWAN communication unit, an electric energy monitoring unit, a user interactive display unit, a remote reservation management platform, a gateway and server unit, and a firmware management and upgrade unit;
[0061] The equipment control unit is used to control the power supply of the experimental equipment. It contains a relay module controlled by an STM32F103VET6 microcontroller to realize the power switch control of the equipment. The LoRaWAN communication unit uses the ASR6601CB chip to communicate with the remote server through the LoRaWAN network, and is responsible for receiving and transmitting equipment status information and firmware upgrade data packets. The power monitoring unit contains the BL0942 power metering chip, which is used to monitor the current, voltage, power and other parameters of the experimental equipment in real time. The user interaction display unit contains a serial port screen connected through 485 communication, which is used to display the reservation information, operation process, equipment introduction pictures and precautions of the experimental equipment. The remote reservation management platform runs on the server side, which is used to manage the use reservation of the experimental equipment and monitor the operating status of the equipment. The gateway and the server are used to handle the communication and data transmission of the system. Among them, the server runs the remote reservation management platform and the firmware upgrade management system, and the gateway is responsible for the equipment communication and firmware update management through the LoRaWAN network.
[0062] The firmware management and upgrade unit adopts a dynamic differential upgrade strategy to remotely update the firmware of the display unit, specifically: first, obtain the old version of the firmware of the target terminal device, and compare it with the new firmware on the server to generate a differential packet; then, divide the differential packet into several small blocks, and dynamically adjust the size and transmission frequency of the blocks based on the current network conditions and the normal business data transmission of the device; when there is no normal business data transmission, block transmission is performed according to the maximum transmission capacity; when there is normal business data transmission, the differential packet data is embedded in the transmission gap of the normal business data through the frame insertion strategy; at the terminal device, each block data is received and verified, and confirmation or retransmission is requested based on the verification result; after all blocks are received and reassembled, new firmware is generated based on the differential packet and the old firmware, and it is overwritten and written to the main storage area of the terminal device after verification; the microcontroller starts the firmware upgrade program, and the new firmware is used to update the content of the display unit to ensure the normal operation of the display unit function.
[0063] like Figure 2 As shown, in the experimental equipment management system, the experimenter reserves the use time of the equipment through the remote reservation management platform. The equipment control unit performs the power-on operation when the reservation time arrives, connects the power of the equipment for the experimenter to use, and after the reservation time ends, the experimenter turns off the power of the equipment by himself.
[0064] The equipment control unit works with the power monitoring unit to control and monitor the operating status of the experimental equipment in real time. After the scheduled use of the experimental equipment ends, the power monitoring unit determines whether the equipment is still in use by monitoring the equipment current. If the equipment is still in use, a notification is sent to the appointment personnel through the remote appointment management platform, prompting that the appointment time has expired and requiring the experimenter to manually turn off the power of the equipment. In order to protect the safety of the equipment, the equipment control unit can only perform the power-off operation after the power of the equipment is manually turned off.
[0065] The display content of the serial port screen can be remotely and dynamically upgraded through the firmware management and upgrade unit to update the device introduction pictures and operation procedures.
[0066] The firmware management and upgrade unit storage area includes a W25Q64 storage chip for storing the current firmware and the received differential upgrade package.
[0067] like Figure 3 As shown in the figure, the dynamic differential upgrade strategy is implemented through the following sub-steps:
[0068] S1: differential packet generation;
[0069] S1.1: The server receives the update request, obtains the device number and new update package to be updated, and then sends a request message for obtaining version information to the target terminal through the gateway;
[0070] S1.2: The server retrieves and obtains the corresponding old version update package stored in the server according to the received version number; the server compares the old and new version files using the BSDIFF algorithm to generate a differential package, and compresses the differential package using the LZ77 lossless compression algorithm. After the differential upgrade package is prepared, it is sent to the gateway storage;
[0071] S2: Network quality assessment;
[0072] S2.1: The gateway sends an upgrade request to the target terminal node that needs to be upgraded, including the basic information of the upgrade package (including file size and CRC16 checksum); after receiving the request, the target node records the upgrade package information and starts the upgrade program;
[0073] S2.2: After starting the upgrade program, the node sends an empty data packet (i.e., an empty uplink message) to the gateway. After receiving the data packet, the gateway measures the received signal strength indication (RSSI) and the signal-to-noise ratio (SNR), and calculates the link margin. The calculation formula for the link margin is:
[0074] Margin=SNR measured -SNR required (1)
[0075] Among them, SNR measured is the signal-to-noise ratio of the empty data packet received by the gateway, SNR required The minimum signal-to-noise ratio required for the gateway to successfully demodulate the signal (usually based on the spreading factor (SF) used);
[0076] S3: differential packet transmission;
[0077] S3.1: The gateway divides the upgrade package file into several file blocks and dynamically adjusts the size of the file block according to the link margin (Margin) calculated in step S2.2 and the current spreading factor (SF). Suppose the file block size is B n ;
[0078] S3.2: First calculate the maximum load capacity P under the current spreading factor (SF) SF : Based on the current spreading factor (SF) and bandwidth, the maximum payload capacity P SF It can be calculated by the following formula:
[0079]
[0080] Among them, DR is the data rate, which is determined by SF and bandwidth, TOA is the air time, which means the time required for the data packet to propagate in the air, Header Size is the size of the physical layer header, and Payload Overhead is the overhead of LoRaWAN transmission. The calculated result P SF It represents the maximum load capacity that can be carried under the current SF;
[0081] S3.3: File block size B n According to the change of Margin and the maximum load capacity P SF Adjust according to the following formula:
[0082]
[0083] Among them, B n-1 The size of the file block previously transferred, Margin n-1 is the link margin measured last time, Margin baseline is a preset benchmark Margin value; through this adjustment method, when the link margin is high, the file block size increases to improve the transmission efficiency; when the link margin is low, the file block size decreases to improve the transmission success rate;
[0084] S3.4: When service data and upgrade package data need to be transmitted at the same time, the gateway can insert the upgrade package data into a single service transmission frame. If the service data does not occupy the maximum load capacity P SF, the remaining capacity is used to transmit the upgrade package data; specifically, if the business data size B data Less than the maximum load capacity P SF , the remaining capacity is used to insert the upgrade package data B upgrade ,The adjustment formula for interpolation transmission is as follows:
[0085] B upgrade =min(P SF -B data ,B n ) (4)
[0086] Among them, B upgrade is the size of the upgrade package data actually inserted into the transmission frame, B n The size of the upgrade package data block is dynamically adjusted according to Margin. Through this frame insertion method, the service data and the upgrade package data share the transmission frame, and the bandwidth resources are fully utilized for efficient upgrade package transmission while ensuring that the service data is transmitted first.
[0087] S3.5: After each file block is successfully transmitted and verified by the node, the node sends a short confirmation message (ACK) to the gateway to confirm that the file block is received and verified successfully. After receiving the confirmation message, the gateway measures the signal quality of the confirmation message (such as signal strength and signal-to-noise ratio) and calculates the link margin (Margin) accordingly; during the entire upgrade process, the gateway continuously dynamically adjusts the file block size and transmission frequency according to the network quality measured by the received empty data packets and the current spreading factor SF value to ensure the optimization of transmission efficiency and success rate under different network conditions;
[0088] S4: differential packet storage and processing;
[0089] S4.1: Each data block is added with an index number and an end flag when it is sent; when the end flag is 1, it means this is the last data block, and when it is 0, it means there are subsequent data blocks. The end of the data block is a CRC-16 checksum to verify the accuracy of the data packet;
[0090] S4.2: The terminal node first allocates a buffer for the received data block to temporarily store the content of each data block. After the data block is stored in the buffer, the node immediately calculates the CRC-16 checksum of the data block and compares it with the checksum carried in the data block. If the check succeeds, the data block will be marked as writable and an ACK signal will be sent to the gateway. If the check fails, the data block in the buffer will be discarded and a NACK signal will be immediately sent to the gateway to request retransmission.
[0091] S4.3: At the gateway end, after each data block is sent, it waits for the ACK signal from the terminal node. If the ACK is not received within the set timeout period, the gateway will retransmit the data block. The number of retransmissions is set to 3 times. If it is still unsuccessful after 3 retransmissions, the gateway will trigger the error handling mechanism, suspend the upgrade and report to the server;
[0092] S4.4: In the terminal node, the storage space is divided into three independent storage partitions: Slot A, Slot B and Slot C, which are used to store old firmware, new firmware and differential packages respectively; Slot A is used to store the old firmware version currently running. Before the new firmware is fully verified, the firmware in this partition will not be erased to ensure that the system always has a stable running version; Slot B is used to store the generated new firmware version. When the new firmware is generated, the system will temporarily store it in this partition, and after verification, it will be overwritten and written to Slot B; Slot C is used to store the received differential package. This partition is used to temporarily store and process differential data until the new firmware is generated and passed the verification;
[0093] S4.5: If the received data block passes the verification, the terminal node writes its content into the Slot C area of the storage chip according to the index number of the data block. Each time it writes, it ensures that the size of a single data block does not exceed 256 bytes; if the data block is less than 256 bytes, the remaining part is filled with a specific padding byte 0xFF to ensure the consistency of page writing. After writing each data block, the terminal node immediately reads the written data from the storage chip and performs CRC verification again to ensure that no error occurs in the data writing process;
[0094] S5: differential packet reassembly and verification;
[0095] S5.1: After all data blocks are received and successfully written into Slot C, the terminal node starts to reassemble the differential packet; the terminal node arranges the received data blocks in index order, first creates an array of sufficient size to save the pointers of all data blocks, and then inserts the data blocks one by one according to the index number to ensure that they are arranged in the correct order. After the sorting is completed, these ordered data blocks are merged into a continuous differential packet. After the reassembly is completed, the terminal node performs a full packet CRC check on the entire differential packet to ensure data integrity;
[0096] S6: Generate new firmware and replace old firmware;
[0097] S6.1: The terminal node uses the BSDIFF algorithm to generate new firmware based on the old firmware in Slot A and the differential packet in Slot C. The new firmware is temporarily stored in Slot B.
[0098] S6.2: After the new firmware is generated, the terminal node triggers the upgrade system and the screen enters the upgrade program;
[0099] S6.3: After the screen upgrade is successful, the terminal node erases the old firmware in Slot A; after the erasure is completed, the terminal node writes the new firmware in Slot B into Slot A, overwriting the original old firmware; after the new firmware is written into Slot A, the terminal node erases Slot B and Slot C to release storage space.
[0100] The present invention adopts a dynamic differential upgrade strategy, in which the frame insertion strategy embeds the upgrade package data into the normal business data transmission gap, ensuring that the business data is transmitted first even during the firmware upgrade process, thereby not affecting the normal scheduled use of the experimental equipment.
[0101] All terminal nodes of the experimental equipment management system use CLASS C type LoRaWAN devices to ensure the real-time data transmission and system stability.
[0102] Through the above technical scheme, the present invention provides an innovative system that effectively solves the problems of experimental equipment management and remote upgrading, and has high application value and broad promotion prospects.
[0103] Those skilled in the art can understand that the above are only preferred examples of the invention and are not intended to limit the invention. Although the invention is described in detail with reference to the above examples, those skilled in the art can still modify the technical solutions recorded in the above examples or replace some of the technical features with equivalents. Any modification, equivalent replacement, etc. made within the spirit and principle of the invention shall be included in the protection scope of the invention.
Claims
1. An experimental equipment management system based on LoRaWAN, characterized in that: include: Equipment control unit, LoRaWAN communication unit, power monitoring unit, user interaction display unit, remote reservation management platform, gateway and server unit, firmware management and upgrade unit; The device control unit is used to control the power supply of the experimental equipment, and includes a relay module controlled by a single-chip microcomputer to realize the power switch control of the equipment; the LoRaWAN communication unit uses a wireless communication Soc chip to communicate with the remote server through the LoRaWAN network, and is responsible for receiving and transmitting device status information and firmware upgrade data packets; the power monitoring unit includes a power metering chip for real-time monitoring of the current, voltage, power and other parameters of the experimental equipment; the user interaction display unit includes a serial port screen connected through 485 communication, which is used to display the reservation information, operation process, equipment introduction pictures and precautions of the experimental equipment; the remote reservation management platform runs on the server side, which is used to manage the use reservation of the experimental equipment and monitor the operation status of the equipment; The gateway and server are used to handle the communication and data transmission of the system, wherein the server runs the remote reservation management platform and the firmware upgrade management system, and the gateway is responsible for device communication and firmware update management through the LoRaWAN network; The firmware management and upgrade unit adopts a dynamic differential upgrade strategy to remotely update the firmware of the display unit, specifically: first, obtain the old version of the firmware of the target terminal device, and compare it with the new firmware of the server to generate a differential packet; then, divide the differential packet into several small blocks, and dynamically adjust the size and transmission frequency of the blocks based on the current network status and the normal business data transmission of the device; when there is no normal business data transmission, block transmission is performed according to the maximum transmission capacity; when there is normal business data transmission, the differential packet data is embedded into the transmission gap of the normal business data through the frame insertion strategy; at the terminal device, each block data is received and verified, and retransmission is confirmed or requested according to the verification result; after all blocks are received and reassembled, new firmware is generated based on the differential packet and the old firmware, and after verification, it is overwritten and written into the main storage area of the terminal device; The single chip microcomputer starts the firmware upgrade program and uses the new firmware to update the content of the display unit to ensure the normal operation of the display unit function.
2. The LoRaWAN-based experimental equipment management system according to claim 1, characterized in that: In the experimental equipment management system, the experimenter reserves the use time of the equipment through the remote reservation management platform. The equipment control unit performs the power-on operation when the reservation time arrives, connects the power of the equipment for the experimenter to use, and after the reservation time ends, the experimenter turns off the power of the equipment by himself.
3. The LoRaWAN-based experimental equipment management system according to claim 1, characterized in that: The equipment control unit works in conjunction with the power monitoring unit to control and monitor the operating status of the experimental equipment in real time. After the scheduled use of the experimental equipment ends, the power monitoring unit determines whether the equipment is still in use by monitoring the equipment current. If the equipment is still in use, a notification is sent to the appointment personnel through the remote appointment management platform, prompting that the appointment time has expired and requiring the experimenter to manually turn off the power of the equipment. In order to protect the safety of the equipment, the equipment control unit can only perform the power-off operation after the power of the equipment is manually turned off.
4. The LoRaWAN-based experimental equipment management system according to claim 1, characterized in that: The display content of the serial port screen is remotely and dynamically differentially upgraded through the firmware management and upgrade unit to update the device introduction picture and operation process.
5. The LoRaWAN-based experimental equipment management system according to claim 1, characterized in that: The firmware management and upgrade unit storage area includes a storage chip for storing the current firmware and the received differential upgrade package.
6. The LoRaWAN-based experimental equipment management system according to claim 1, characterized in that: The dynamic differential upgrade strategy is specifically implemented through the following sub-steps: S1: differential packet generation; S1.1: The server receives the update request, obtains the device number and new update package to be updated, and then sends a request message for obtaining version information to the target terminal through the gateway; S1.2: The server retrieves and obtains the corresponding old version update package stored in the server according to the received version number; the server compares the old and new version files using the BSDIFF algorithm to generate a differential package, and compresses the differential package using the LZ77 lossless compression algorithm. After the differential upgrade package is prepared, it is sent to the gateway storage; S2: Network quality assessment; S2.1: The gateway sends an upgrade request to the target terminal node that needs to be upgraded, including the basic information of the upgrade package (including file size and CRC16 checksum); after receiving the request, the target node records the upgrade package information and starts the upgrade program; S2.2: After starting the upgrade program, the node sends an empty data packet (i.e., an empty uplink message) to the gateway. After receiving the data packet, the gateway measures the received signal strength indication (RSSI) and the signal-to-noise ratio (SNR), and calculates the link margin. The calculation formula for the link margin is: Margin=SNR measured -SNR required (1) Among them, SNR measured is the signal-to-noise ratio of the empty data packet received by the gateway, SNR required The minimum signal-to-noise ratio required for the gateway to successfully demodulate the signal (usually based on the spreading factor (SF) used); S3: differential packet transmission; S3.1: The gateway divides the upgrade package file into several file blocks and dynamically adjusts the size of the file block according to the link margin (Margin) calculated in step S2.2 and the current spreading factor (SF). Suppose the file block size is B n ; S3.2: First calculate the maximum load capacity P under the current spreading factor (SF) SF : Based on the current spreading factor (SF) and bandwidth, the maximum payload capacity P SF It can be calculated by the following formula: Among them, DR is the data rate, which is determined by SF and bandwidth, TOA is the air time, which means the time required for the data packet to propagate in the air, Header Size is the size of the physical layer header, and Payload Overhead is the overhead of LoRaWAN transmission. The calculated result P SF It represents the maximum load capacity that can be carried under the current SF; S3.3: File block size B n According to the change of Margin and the maximum load capacity P SF Adjust according to the following formula: Among them, B n-1 The size of the file block previously transferred, Margin n-1 is the link margin measured last time, Margin baseline is a preset benchmark Margin value; through this adjustment method, when the link margin is high, the file block size increases to improve the transmission efficiency; when the link margin is low, the file block size decreases to improve the transmission success rate; S3.4: When service data and upgrade package data need to be transmitted at the same time, the gateway can insert the upgrade package data into a single service transmission frame. If the service data does not occupy the maximum load capacity P SF , the remaining capacity is used to transmit the upgrade package data; specifically, if the business data size B data Less than the maximum load capacity P SF , the remaining capacity is used to insert the upgrade package data B upgrade ,The adjustment formula for interpolation transmission is as follows: B upgrade =min(P SF -B data ,B n )(4) Among them, B upgrade is the size of the upgrade package data actually inserted into the transmission frame, B n The size of the upgrade package data block is dynamically adjusted according to Margin. Through this frame insertion method, the service data and the upgrade package data share the transmission frame, and the bandwidth resources are fully utilized for efficient upgrade package transmission while ensuring that the service data is transmitted first. S3.5: After each file block is successfully transmitted and verified by the node, the node sends a short confirmation message (ACK) to the gateway to confirm that the file block is received and verified successfully. After receiving the confirmation message, the gateway measures the signal quality of the confirmation message (such as signal strength and signal-to-noise ratio) and calculates the link margin (Margin) accordingly; during the entire upgrade process, the gateway continuously dynamically adjusts the file block size and transmission frequency according to the network quality measured by the received empty data packets and the current spreading factor SF value to ensure the optimization of transmission efficiency and success rate under different network conditions; S4: differential packet storage and processing; S4.1: Each data block is added with an index number and an end flag when it is sent; when the end flag is 1, it means this is the last data block, and when it is 0, it means there are subsequent data blocks. The end of the data block is a CRC-16 checksum to verify the accuracy of the data packet; S4.2: The terminal node first allocates a buffer for the received data block to temporarily store the content of each data block. After the data block is stored in the buffer, the node immediately calculates the CRC-16 checksum of the data block and compares it with the checksum carried in the data block. If the check succeeds, the data block will be marked as writable and an ACK signal will be sent to the gateway. If the check fails, the data block in the buffer will be discarded and a NACK signal will be immediately sent to the gateway to request retransmission. S4.3: At the gateway end, after each data block is sent, it waits for the ACK signal from the terminal node. If the ACK is not received within the set timeout period, the gateway will retransmit the data block. The number of retransmissions is set to 3 times. If it is still unsuccessful after 3 retransmissions, the gateway will trigger the error handling mechanism, suspend the upgrade and report to the server; S4.4: In the terminal node, the storage space is divided into three independent storage partitions: Slot A, Slot B and Slot C, which are used to store old firmware, new firmware and differential packets respectively; Slot A is used to store the old firmware version currently running. Before the new firmware is fully verified, the firmware in this partition will not be erased to ensure that the system always has a stable running version; Slot B is used to store the generated new firmware version. When the new firmware is generated, the system will temporarily store it in this partition, and after verification, it will be overwritten and written to Slot B; Slot C is used to store the received differential packets. This partition is used to temporarily store and process differential data until the new firmware is generated and passed the verification; S4.5: If the received data block passes the verification, the terminal node writes its content into the Slot C area of the storage chip according to the index number of the data block. Each time it writes, it ensures that the size of a single data block does not exceed 256 bytes; if the data block is less than 256 bytes, the remaining part is filled with a specific padding byte 0xFF to ensure the consistency of page writing. After writing each data block, the terminal node immediately reads the written data from the storage chip and performs CRC verification again to ensure that no error occurs in the data writing process; S5: differential packet reassembly and verification; S5.1: After all data blocks are received and successfully written into Slot C, the terminal node starts to reassemble the differential packet; the terminal node arranges the received data blocks in index order, first creates an array of sufficient size to save the pointers of all data blocks, and then inserts the data blocks one by one according to the index number to ensure that they are arranged in the correct order. After the sorting is completed, these ordered data blocks are merged into a continuous differential packet. After the reassembly is completed, the terminal node performs a full packet CRC check on the entire differential packet to ensure data integrity; S6: Generate new firmware and replace old firmware; S6.1: The terminal node uses the BSDIFF algorithm to generate new firmware based on the old firmware in Slot A and the differential packet in Slot C. The new firmware is temporarily stored in Slot B. S6.2: After the new firmware is generated, the terminal node triggers the upgrade system and the screen enters the upgrade program; S6.3: After the screen upgrade is successful, the terminal node erases the old firmware in Slot A; after the erasure is completed, the terminal node writes the new firmware in Slot B into Slot A, overwriting the original old firmware; after the new firmware is written into Slot A, the terminal node erases Slot B and Slot C to release storage space.
Citation Information
Patent Citations
Over-the-air firmware upgrading method and system for Internet of Things equipment
CN111212121A
Remote firmware upgrading device based on LORA communication and upgrading method thereof
CN118473928A
Low-rate data transmission in LTE based satellite ratio interface
US20160127032A1
Cited By
Smart Facility Integrated Control System
KR103008828B1