Multi-channel surface myoelectricity time synchronization method based on Bluetooth communication
The host Bluetooth module sends fixed-length data packets to multiple slaves and records the time sequence, and sends synchronization packets to delay the initialization timer, which solves the problem of multi-slave time synchronization error in the Bluetooth protocol and achieves high-precision data collection and Reduces system complexity.
Patent Information
- Application Number
- CN202410740220.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-09-06
AI Technical Summary
The existing Bluetooth protocol has large errors in time synchronization of multiple slaves and cannot guarantee complete time synchronization between slaves, resulting in inaccuracies in data collection and system stability problems, and the hardware trigger signal method increases system costs. and complexity, and difficult to scale to multiple slave machines.
The host Bluetooth module sequentially sends fixed-length data packets to multiple slaves in a time-sharing and random manner, records the time sequence of the response packets returned by the slaves, and sends synchronization packets containing sequence numbers. Each slave delays the initialization timer according to the sequence number to achieve time synchronization. , ensure that the timer error is less than 200us.
It improves the accuracy and consistency of time synchronization, reduces system cost and complexity, enhances scalability, and ensures the accuracy and precision of data collection.
Smart Images

Figure CN118592984A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of surface electromyography signal synchronization, and in particular to a multi-channel surface electromyography time synchronization method based on Bluetooth communication. Background Art
[0002] Surface electromyography (EMG) signal acquisition is a technology used to measure human muscle activity and is often used in sports physiology, rehabilitation medicine and other fields. In the surface electromyography (EMG) signal acquisition system, multiple slaves simultaneously acquire electromyography signals and transmit the data to the host for processing and analysis. However, when multiple slaves work simultaneously, the clocks of the 32 slaves are different, resulting in the data acquisition time being out of sync, which affects the accuracy and reliability of the data.
[0003] At present, there are some solutions that try to solve the problem of Bluetooth multi-channel surface electromyography time synchronization. One solution is to send a data packet to the slave through the Bluetooth host, and the slave will feedback the host response packet after receiving the Bluetooth host data packet. The host records the time of sending the packet and receiving the response packet. After repeating this action many times, the average value is taken for calibration, so as to achieve time synchronization of multiple groups of slaves. Another solution is to use hardware trigger signals. Specifically, the host sends the same trigger signal to multiple slaves through hardware means. After the slave receives the trigger signal, it initializes the timer. In this way, the time synchronization of multiple slaves can be achieved to ensure the accuracy of data acquisition.
[0004] Due to the limitations of the existing Bluetooth protocol, after the data packet enters the protocol stack, it is randomly sent to each slave, and the transmission is time-sharing, which makes it impossible to achieve complete time synchronization. In addition, the error caused by the randomness of the entire process is large. This random and time-sharing transmission method causes the order of the time when the slave receives the data packet to be inconsistent, and thus it is impossible to ensure that the time between multiple slaves is completely synchronized.
[0005] This time asynchrony can cause some problems. For example, in a scenario where multiple slaves are required to perform an operation at the same time, due to time asynchrony, the operations between the slaves may be inconsistent, affecting the stability and reliability of the system. Therefore, the existing Bluetooth protocol has certain problems and limitations in multi-slave time synchronization. In order to solve this problem, the above-mentioned solution can effectively achieve time synchronization between multiple slaves.
[0006] The hardware trigger signal method requires additional hardware support, which increases the cost and complexity of the system. Secondly, due to the slight differences in the clocks of multiple slaves, even if the hardware trigger signal is used for synchronization, there will still be slight asynchrony of the data. This may lead to the accumulation of data errors and inaccurate results. In addition, the hardware trigger signal method also has a limit on the number of slaves. Once the number of slaves is too large, the transmission and synchronization of signals will become more complicated and difficult.
[0007] In summary, in the prior art, there are some problems and limitations in realizing the time synchronization of the surface electromyography slave by directly sending a synchronization signal to the slave module through the Bluetooth host module to initialize the timer, and further improvement and optimization are needed. Summary of the invention
[0008] The purpose of the present invention is to solve the technical problems existing in the background technology and to propose a multi-channel surface electromyography time synchronization method based on Bluetooth communication, comprising the following steps:
[0009] S1: The host sends fixed-length data packets to N slaves in random time-sharing through the Bluetooth module, and the time interval between two adjacent data packets is fixed at Tms;
[0010] S2: After receiving the data packet, the slave immediately returns a response packet containing its own sequence number to the host;
[0011] S3: The host determines the order in which N slaves receive data packets according to the time sequence of the response packets returned by the slaves;
[0012] S4: The host sends a set of synchronization packets to N slaves, and the synchronization packets contain the sequence numbers of the data packets received by the N slaves;
[0013] S5: N slaves obtain their own sequence number n according to the received synchronization packet, and initialize the timer after a delay of (Nn)*Tms.
[0014] Furthermore, step S1 further includes:
[0015] S11: The host Bluetooth module sends a data packet to the protocol stack;
[0016] S12: The protocol stack automatically and randomly sends data packets to each slave, with a fixed interval of Tms.
[0017] Furthermore, step S3 further includes:
[0018] S31: Set the synchronization coefficient i and the synchronization threshold X, and initialize i=1;
[0019] S32: looping steps S1 and S2, each time the loop is repeated, comparing the order of the N slaves receiving the data packets determined in this loop with the order of the N slaves receiving the data packets last time to see if they are consistent, if they are consistent, i=i+1, otherwise i is initialized;
[0020] If i=X, go to step S4, otherwise go to step S32.
[0021] Furthermore, N=32, T=10, and X=5.
[0022] Compared with the prior art, the present invention has the following beneficial technical effects: the present invention sends fixed-length data packets to multiple slaves through a host Bluetooth module, and records the self-sequence numbers returned by the receiving slaves according to the time, thereby determining the time sequence of the data received by the slaves. According to the determined time sequence, the host sends a group of synchronization signal data packets containing sequence numbers to the slaves, and each slave delays and starts the initialization timer according to the sequence number in the synchronization signal data packet, thereby realizing time synchronization of multiple groups of slaves, and the time error of the timers between the multiple groups of slaves is less than 200us.
[0023] In summary, the present invention solves the problem that the calibration method using the average value leads to poor accuracy and consistency of time synchronization. Furthermore, the time accuracy of the present invention is higher, and the time error of the timers of multiple channels is less than 200us, thereby ensuring the accuracy and precision of data acquisition. Furthermore, compared with hardware synchronization, the scheme of the present invention optimizes the use of operation methods and scalability, and reduces the cost and complexity of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 is a flow chart of the present invention;
[0025] Figure 2 It is a detailed step diagram of the present invention. DETAILED DESCRIPTION
[0026] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0027] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside" and the like indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or component referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and the like are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", and the like may explicitly or implicitly include one or more features. In the description of the present invention, unless otherwise specified, "multiple" means two or more.
[0028] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installation", "connection" and "connection" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or a specific connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood by specific circumstances.
[0029] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0030] like Figure 1-Figure 2 As shown, the present invention proposes a multi-channel surface electromyography time synchronization method based on Bluetooth communication to solve the problem of asynchronous data collection from the surface electromyography slave. The technical solution mainly adopts the following technical means (taking 32 channels as an example):
[0031] 1. Send fixed-length data packets to 32 slaves through the host Bluetooth module. The data packets enter the Bluetooth protocol stack at the same time, but the protocol stack sends them to the slaves randomly in time division, and the time interval between two adjacent data packets is fixed at 10ms.
[0032] 2. After receiving the data packet, the slave immediately returns a response packet to the host Bluetooth module. The response packet contains the serial number of the slave. After receiving the response packet returned by the slave, the host records the serial number returned by the slave in the response packet, thereby determining the time sequence of the slave receiving the data.
[0033] 3. After the host Bluetooth module receives the slave data packet, ensure that the serial numbers of the slaves received for 5 consecutive times are consistent. At this time, confirm the time sequence of the slave receiving the data packet.
[0034] The host sends a set of synchronization packets to each slave, which contains the sequence number of the slave receiving time. Each slave automatically delays and initializes the timer according to the sequence number in the synchronization packet.
[0035] 5. Through the above steps, time synchronization of multiple slaves is achieved. The time error of 32 timers is less than 200us.
[0036] Specific steps are as follows Figure 2 As shown:
[0037] Step 1: The host sends fixed-length data packets to 32 slaves through the Bluetooth module.
[0038] Step 2: After receiving the data packet, the slave returns a response packet containing its own sequence number to the host.
[0039] Step 3: The host determines the time sequence in which the 32 slaves receive the host data packet based on the time when the slave returns the response packet.
[0040] Step 4: The host sends a set of synchronization signal data packets containing the sequence numbers of the received slave data to the 32 slaves.
[0041] Step 5: The 32 slaves obtain their own sequence number n according to the received synchronization signal data packet, and initialize the timer after delaying for (32-n)*10ms.
[0042] Through the above steps, time synchronization of multiple groups of slaves can be achieved. The time error of 32 timers is made less than 200us to solve the problem of asynchronous data collection of surface electromyography slaves and achieve time synchronization of multiple groups of slaves.
[0043] Furthermore, this embodiment also provides a specific implementation method of applying the technical solution of the present invention, as follows:
[0044] Taking 32 channels as an example, the host sends a fixed-length data packet to slaves 1-32 through the Bluetooth module. The data packets are sent to slaves 1-32 in a time-sharing and random manner, but the time interval between two adjacent packets is 10ms. After receiving the data packet, slaves 1-32 will return a response packet to the host Bluetooth module. The response packet contains the slave's own sequence number. The host Bluetooth module records the time sequence of receiving the response packet. Repeat this action 5 times in a row. After the comparison sequence is consistent, the host confirms the time sequence of the slave receiving the host's fixed-length data packet.
[0045] According to the determined time sequence, the host will send a group of synchronization data packets containing the sequence number and time interval of each slave response packet to 32 slaves. The slave delays (32-n)*10ms according to the sequence number n in the received synchronization signal data packet, and starts the timer after the delay is completed. For example, the host sends a data packet containing sequence number 5 to slave 1. After receiving the data packet, slave 1 performs time delay processing according to sequence number 5, and the delay time is (32-5)*10ms=270ms. After a delay of 270ms, slave 1 delays the initialization timer by itself, so that the timer of slave 1 can be synchronized with the timers of other slaves. In the same operation, the host will also send synchronization signal data packets containing sequence numbers to other slaves such as slave 2 and slave 3 to achieve time synchronization of multiple groups of slaves.
[0046] It can be understood that the method of the present invention to solve the problem of asynchronous data collection of surface electromyography slaves is to send fixed-length data packets to multiple slaves through the host Bluetooth module, and record the self-sequence numbers returned by the slaves according to the time, so as to determine the time sequence of the data received by the slaves. According to the determined time sequence, the host sends a group of synchronization signal data packets containing sequence numbers to the slaves, and each slave delays and starts the initialization timer according to the sequence number in the synchronization signal data packet, thereby realizing time synchronization of multiple groups of slaves, and the time error of the timers between multiple groups of slaves is less than 200us.
[0047] In summary, the present invention has the following beneficial effects:
[0048] 1. The present invention solves the problem that the accuracy and consistency of time synchronization are poor due to the calibration method using an average value.
[0049] 2. The time accuracy of the present invention is higher, and the time error of the timers of multiple channels is less than 200us, which ensures the accuracy and precision of data collection.
[0050] 3. Compared with hardware synchronization, the solution of the present invention optimizes the operation method and scalability, and reduces the cost and complexity of the system.
[0051] The above is one or more implementation methods provided in combination with specific contents, and it is not intended that the specific implementation of the present invention is limited to these descriptions. Any similarity or similarity with the method, structure, etc. of the present invention, or any technical deduction or replacement made on the premise of the concept of the present invention, shall be regarded as the protection scope of the present invention.
Claims
1. A multi-channel surface electromyography time synchronization method based on Bluetooth communication, It is characterized in that The steps include: S1: The host sends fixed-length data packets to N slaves in random time-sharing through the Bluetooth module, and the time interval between two adjacent data packets is fixed at Tms; S2: After receiving the data packet, the slave immediately returns a response packet containing its own sequence number to the host; S3: The host determines the order in which N slaves receive data packets according to the time sequence of the response packets returned by the slaves; S4: The host sends a set of synchronization packets to N slaves, and the synchronization packets contain the sequence numbers of the data packets received by the N slaves; S5: N slaves obtain their own sequence number n according to the received synchronization packet, and initialize the timer after a delay of (Nn)*Tms.
2. A multi-channel surface electromyography time synchronization method based on Bluetooth communication according to claim 1, It is characterized in that The step S1 further comprises: S11: The host Bluetooth module sends a data packet to the protocol stack; S12: The protocol stack automatically and randomly sends data packets to each slave, with a fixed interval of Tms.
3. According to the multi-channel surface electromyography time synchronization method based on Bluetooth communication in claim 1, It is characterized in that The step S3 further comprises: S31: Set the synchronization coefficient i and the synchronization threshold X, and initialize i=1; S32: looping steps S1 and S2, each time the loop is repeated, comparing the order in which the N slaves receive data packets determined in this loop with the order in which the N slaves receive data packets last time to see if they are consistent, if they are consistent, i=i+1, otherwise i is initialized; If i=X, go to step S4, otherwise go to step S32.
4. According to the multi-channel surface electromyography time synchronization method based on Bluetooth communication according to claim 3, It is characterized in that Said N=32, T=10, X=5.
Citation Information
Patent Citations
Wireless multi-node physiological signal monitoring system based on low-power-consumption Bluetooth
CN110072278A
Bluetooth networking system with time synchronization function
CN111542038A
Multi-source signal synchronization system and method thereof
CN112804022A
Processing method of Bluetooth device, mobile terminal and storage medium
CN113329347A
Quick connection method for low-power-consumption Bluetooth and low-power-consumption Bluetooth communication system
CN113518314A
