A TSN-based automobile digital key WiFi ranging method
By employing gPTP peer-to-peer delay measurement using the TSN protocol in the digital key system and recording four timestamps to calculate the signal propagation path delay time, the problem of low ranging accuracy between digital key Fob devices and vehicle-mounted anchor point devices in the prior art is solved, achieving high-precision and reliable ranging results.
Patent Information
- Application Number
- CN202611072388.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-20
- Publication Date
- 2026-08-25
AI Technical Summary
Existing technologies suffer from low accuracy and instability when measuring distance between digital key Fob devices and vehicle-mounted anchor point devices. In particular, distance measurement schemes based on signal strength are inaccurate, while distance measurement schemes based on signal time of flight are susceptible to signal attenuation.
The method of WiFi ranging for car digital keys based on TSN is adopted. Through WiFi communication between the Fob device and the anchor point device, the TSN universal precise time protocol gPTP is used to perform peer delay measurement, record four timestamps and calculate the signal propagation path delay time, and then calculate the distance, thus avoiding reliance on the physical characteristics of wireless signals.
It achieves high-precision and reliable ranging results, reduces the impact of signal attenuation and environmental interference, lowers system complexity and cost, and ensures the consistency and reliability of ranging results.
Smart Images

Figure CN122632238A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent vehicle technology, and more specifically, to a WiFi ranging method for automotive digital keys based on TSN. Background Technology
[0002] With the rapid development of automotive intelligence and connectivity technologies, digital key systems have become a core feature of modern smart cars. This technology allows users to use portable terminals such as smartphones as virtual keys to achieve functions such as contactless entry, automatic locking upon leaving the vehicle, and one-button start, greatly improving the convenience of car use. To achieve these functions, the system needs to accurately measure the distance between the digital key and the anchor point device on the vehicle, thereby achieving high-precision key positioning. Currently, mainstream automotive digital key ranging solutions mainly rely on measuring the physical characteristics of wireless signals; for example, solutions based on ultra-wideband (UWB) technology calculate distance by measuring the signal's flight time in the air; solutions based on Bluetooth (BLE) technology often estimate distance by receiving signal strength indicators. However, existing signal strength-based ranging solutions have low accuracy and are unstable, while time-of-flight-based ranging solutions are susceptible to signal attenuation.
[0003] The problem is: how to achieve high-precision ranging between the digital key Fob device and the vehicle-mounted anchor point device without relying on the physical characteristics of wireless signals. Summary of the Invention
[0004] This invention solves the technical problem of how to achieve high-precision ranging between a digital key Fob device and a vehicle-mounted anchor point device without relying on the physical characteristics of wireless signals.
[0005] To address the aforementioned problems, this invention provides a TSN-based WiFi ranging method for automotive digital keys, executed by the Fob device on the digital key. The method includes: establishing a WiFi communication connection with an onboard anchor device; initiating a peer-to-peer delay measurement process based on the TSN Universal Precision Time Protocol (gPTP) to the anchor device, and performing the following steps: sending a first ranging message to the anchor device and recording a first transmission timestamp at the completion of WiFi physical layer transmission of the first ranging message; receiving a second ranging message returned by the anchor device, recording a first reception timestamp at the completion of WiFi physical layer reception of the second ranging message, and extracting a second reception timestamp recorded by the anchor device at the completion of receiving the first ranging message from the second ranging message; receiving a third ranging message sent by the anchor device and obtaining a second transmission timestamp recorded by the anchor device at the completion of sending the second ranging message from the third ranging message; calculating the signal propagation path delay time between the Fob device and the anchor device based on the first transmission timestamp, the second reception timestamp, and the second transmission timestamp, and calculating the distance between the two devices based at least on the path delay time and the electromagnetic wave propagation speed.
[0006] Compared to existing technologies, this technical solution achieves the following advantages: By fully applying the gPTP peer-to-peer delay measurement mechanism from the TSN protocol to the WiFi communication interaction between the Fob device and the anchor device, ranging no longer relies on the detection of wireless signal strength or waveform quality. Specifically, it calculates the signal propagation path delay time using only the timestamp automatically captured by the hardware when the last bit of data is sent and received at the WiFi physical layer, effectively avoiding measurement errors introduced by interference such as signal attenuation, environmental obstruction, and multipath effects. Furthermore, after acquiring all four timestamps, the pure unidirectional signal propagation time is separated by deducting the processing time consumed by the anchor device, and the distance is obtained by multiplying this by the electromagnetic wave propagation speed. This mechanism ensures that the ranging result depends only on time data and the speed of light, significantly improving the consistency and reliability of the ranging results. Simultaneously, since the entire measurement process reuses existing WiFi physical modules supporting the TSN protocol, no additional dedicated ranging hardware or RF units are required, effectively controlling system complexity and implementation costs while maintaining high-precision ranging capabilities.
[0007] In one possible design, the first ranging message is a peer delay request message in the General Precision Time Protocol (gPTP), the second ranging message is a peer delay response message in the gPTP, and the third ranging message is a peer delay follow-up message in the gPTP.
[0008] Compared with existing technologies, the technical effects achieved by adopting this technical solution are as follows: by defining the three messages required for ranging interaction as standard message types already defined in the TSN General Precise Time Protocol, the ranging process is completely built on the original peer-to-peer delay measurement framework of the gPTP protocol; this allows the ranging function to complete data acquisition directly through standard time synchronization interaction without customizing private protocols or adding new message formats, ensuring that the message interaction between the Fob device and the anchor device has good standardization characteristics and interoperability.
[0009] In one possible design, the Fob device is a WiFi-enabled smartphone, and the anchor device is a WiFi anchor fixed in the vehicle; the WiFi communication connection is a peer-to-peer (P2P) connection; wherein, the Fob device acts as a WiFi access point (AP), and the anchor device acts as a station (STA) connected to the AP.
[0010] Compared to existing technologies, this technical solution achieves the following advantages: By defining the Fob device as a WiFi-enabled smartphone and the anchor device as a fixed WiFi anchor point installed in the vehicle, a communication connection is established via a point-to-point (P2P) method. The smartphone acts as the WiFi access point, while the vehicle-mounted anchor point serves as the access station. This allows the entire ranging system to directly utilize the user's smartphone as a digital key terminal, eliminating the need for additional dedicated key hardware. Since the smartphone's WiFi physical layer natively supports the TSN time synchronization protocol, the ranging function can be entirely carried out by the existing communication module, avoiding the need to add a separate ranging tag or RF unit to the vehicle key system. Furthermore, the P2P direct connection architecture with the smartphone as the access point minimizes the message exchange path between the Fob device and the anchor device, and the capture of timestamps is unaffected by additional latency jitter introduced by intermediate forwarding devices.
[0011] In one possible design, there are multiple anchor point devices, and the method further includes: the Fob device polls each anchor point device according to a preset period, and performs a peer delay measurement process for each anchor point device to calculate the distance between the Fob device and each anchor point device respectively.
[0012] Compared to existing technologies, the technical advantages of this solution are as follows: By deploying multiple anchor point devices in the vehicle, and having the Fob device sequentially poll each anchor point and independently execute a complete peer-to-peer delay measurement process according to a preset cycle, the system can simultaneously obtain multiple precise distance values between the Fob device and anchor points at different locations on the vehicle. The polling mechanism allows the entire multi-anchor point measurement process to reuse the same WiFi communication link and time synchronization protocol stack in an orderly and conflict-free manner, eliminating the need to configure independent communication channels or RF modules for each anchor point. This structured polling measurement method ensures the integrity and timing consistency of multi-anchor point distance data acquisition.
[0013] In one possible design, the Fob device acts as the slave clock for gPTP time synchronization, and the anchor device acts as the master clock for gPTP time synchronization.
[0014] Compared with existing technologies, the technical effects achieved by adopting this solution are as follows: By clearly defining the Fob device as the slave clock end of gPTP time synchronization and the anchor device as the master clock end, the synchronization roles and interactive responsibilities of both parties in the ranging process are clearly defined; the right to initiate the ranging session is completely given to the smartphone terminal, which acts as a digital key. The Fob device can actively initiate the delay measurement of each anchor point according to actual needs, while the anchor device only needs to passively respond and return a timestamp. This is more in line with the usage scenario of users actively detecting distance when they bring their mobile phones close to vehicles.
[0015] In one possible design, the first send timestamp and the first receive timestamp are both automatically captured and recorded by the WiFi physical layer hardware of the Fob device when the last bit of data in the message is sent and received; the second receive timestamp and the second send timestamp are both automatically captured and recorded by the WiFi physical layer hardware of the anchor device when the last bit of data in the message is sent and received.
[0016] Compared to existing technologies, this technical solution achieves the following advantages: By limiting the recording of the four timestamps to the moment when the WiFi physical layer hardware completes the transmission and reception of the last bit of data in the message, and by having the hardware automatically capture this data, the time corresponding to the timestamps closely matches the actual time when the signal is transmitted and received on the physical medium. Furthermore, since the generation of the timestamps is entirely performed by the physical layer hardware, eliminating reliance on upper-layer protocol stack software or application layer programs, it fundamentally eliminates the impact of operating system scheduling delays, protocol stack processing time, and software response uncertainties on the accuracy of time recording. Based on this, the four timestamps obtained by the Fob device have sub-microsecond or even nanosecond level accuracy and consistency, accurately reproducing the start and end moments of the ranging message's propagation in space. In particular, the path delay time calculated based on the hardware-level timestamps is extremely close to the actual flight time of the signal, effectively ensuring the high accuracy and repeatability of the final distance measurement value.
[0017] In one possible design, the signal propagation path delay time between the Fob device and the anchor device is calculated by subtracting the difference between the second transmission timestamp and the second reception timestamp from the difference between the first reception timestamp and the first transmission timestamp, and taking half of the result as the signal propagation path delay time.
[0018] Compared with existing technologies, the technical effect achieved by this solution is as follows: By considering the difference between the first received timestamp and the first sent timestamp as the total time of the entire round-trip interaction, and subtracting the internal processing time of the anchor device represented by the difference between the second sent timestamp and the second received timestamp, and then halving the result, the pure path delay of the signal's unidirectional propagation between the Fob device and the anchor device can be accurately separated. This calculation method completely eliminates the influence of dwell time introduced by message packet assembly, protocol stack scheduling, and hardware processing during the period from receiving a request to issuing a response at the anchor end on the measurement results, ensuring that the final time value used for distance calculation is only related to the actual flight time of the signal in space.
[0019] In one possible design, the distance between the two can be calculated based at least on the path delay time and the electromagnetic wave propagation speed. Specifically, the path delay time is multiplied by the speed of light to obtain the distance between the Fob device and the anchor device.
[0020] Compared with existing technologies, the technical advantages of this solution are as follows: by directly multiplying the signal propagation path delay time by the speed of light to obtain the distance value, the ranging calculation becomes more accurate. Furthermore, since the speed of light is relatively constant during propagation in air, the entire distance calculation process exhibits extremely high determinism and repeatability, ensuring consistent accuracy of the ranging results regardless of the vehicle's parking environment.
[0021] In one possible design, the second receive timestamp is encapsulated in the payload of the second ranging message, and the second send timestamp is encapsulated in the payload of the third ranging message.
[0022] Compared to existing technologies, the technical advantages of this solution are as follows: By encapsulating the second receiving timestamp recorded by the anchor device in the payload of the second ranging message, and encapsulating the second sending timestamp in the payload of the third ranging message, the two key time data captured by the anchor can be transmitted to the Fob device completely and unambiguously using a standard message format. Simultaneously, this mechanism of carrying back the timestamps with the message payload allows the Fob device to obtain all four timestamps simultaneously upon completing message reception, eliminating the need for additional queries or waiting for asynchronous reporting. This ensures the compactness and real-time performance of a single ranging process and makes the implementation of ranging logic on the smartphone more concise and efficient.
[0023] In one possible design, the method also includes: determining the position of the Fob device relative to the vehicle based on the distance between the Fob device and multiple anchor point devices, and performing door unlocking, locking, or vehicle start control accordingly.
[0024] Compared to existing technologies, the technical benefits of this solution are as follows: After obtaining the precise distance between the Fob device and multiple anchor point devices, the distance data is further converted into a position determination result of the Fob device relative to the vehicle, and this result is used to directly drive control actions such as unlocking or locking the doors or starting the vehicle. This allows the vehicle to more accurately determine whether the user is in the driver's area, passenger area, inside the vehicle, or away from the vehicle, thereby automatically performing the corresponding operation at the appropriate time, effectively avoiding accidental locking or unlocking due to position misjudgment. Attached Figure Description
[0025] Figure 1 A flowchart illustrating a TSN-based WiFi ranging method for automotive digital keys provided in an embodiment of the present invention; Figure 2 A schematic diagram of a TSN-based car digital key WiFi ranging method provided in an embodiment of the present invention; Figure 3 A schematic diagram of the TSN-based car digital key WiFi ranging method provided in an embodiment of the present invention; Figure 4 This is a diagram illustrating the operation of the TSN-based WiFi ranging method for automotive digital keys provided in this embodiment of the invention. Detailed Implementation
[0026] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0027] See Figures 1 to 4 This invention provides a TSN-based WiFi ranging method for automotive digital keys, executed by the digital key's Fob device. The method includes: Step S10: Establish a WiFi communication connection with the vehicle-mounted anchor point device; Step S20: Initiate a peer-to-peer delay measurement process based on the TSN Universal Precision Time Protocol gPTP to the anchor device, and perform the following steps: Step S21: Send the first ranging message to the anchor device and record the first transmission timestamp of the first ranging message at the moment of completion of transmission at the WiFi physical layer; Step S22: Receive the second ranging message returned by the anchor device, record the first receiving timestamp of the second ranging message at the moment when the WiFi physical layer reception is completed, and extract the second receiving timestamp recorded by the anchor device at the moment when the first ranging message is completed from the second ranging message; Step S23: Receive the third ranging message sent by the anchor point device, and obtain the second sending timestamp recorded by the anchor point device at the moment when the second ranging message was sent from the third ranging message; Step S30: Calculate the signal propagation path delay time between the Fob device and the anchor device based on the first transmission timestamp, the second reception timestamp, the first reception timestamp, and the second transmission timestamp, and calculate the distance between the two based at least on the path delay time and the electromagnetic wave propagation speed.
[0028] Specifically, in this embodiment, the vehicle digital key terminal Fob device and software are deployed on a smartphone. The smartphone's WiFi-PHY module physical link layer supports the IEEE 1588 and 802.1AS standard definitions and is equipped with an automotive Ethernet TSN time synchronization protocol stack (TSN-Stack) for running the complete gPTP protocol process. The vehicle anchor point device and software are deployed inside the vehicle anchor point box. The WiFi-PHY module and antenna of each anchor point device are assembled in a fixed position in the vehicle according to the structure; each anchor point device is equipped with an automotive Ethernet TSN time synchronization protocol stack (TSN-Stack). Within the car key system, each anchor point device runs a gPTP time synchronization master service wait program, and the Fob device runs a gPTP time synchronization slave client wait program. The Fob device initiates gPTP time synchronization operations on each anchor point sequentially according to a pre-set program cycle, using a P2P mode for TSN time synchronization. The Fob device's slave client wait program initiates a gPTP time synchronization operation on a specific anchor point device, specifically including: Step 1: The Fob device sends a Peer Delay Req Message for the TSN. The Fob device records the sending time immediately after the WiFi-PHY completes sending the last bit of the Peer Delay Req Message for the TSN. ; Step 2: The WiFi-PHY module of the anchor device begins receiving the Peer Delay ReqMessage message from the Fob device's TSN. When the anchor device receives the last bit of the Peer Delay ReqMessage message, its WiFi-PHY module records the time of receipt. ; Step 3: The anchor device requests the WiFi-PHY module to send a TSN Peer Delay Resp Message and includes the steps from Step 2. Packaged in the Peer Delay Resp Message payload, the anchor device records the sending time immediately after the WiFi-PHY module completes the transmission of the last bit of the TSN Peer Delay Req Message. ; Step 4: The WiFi-PHY module of the Fob device begins receiving the Peer DelayResp Message (TSN) sent by the anchor device. When the Fob device receives the last bit of the Peer Delay Resp Message, its WiFi-PHY module records the time of receipt. Simultaneously, the Fob device parses the payload of the Peer Delay RespMessage message to obtain the information from step two. ; Step 5: The anchor device requests the WiFi-PHY module to send a TSN Peer Delay Follow Up Message and includes the steps from Step 3. Packaged in the payload of the Peer Delay Follow Up Message; Step Six: The WiFi-PHY module of the Fob device begins receiving the Peer Delay Follow Up Message (TSN) sent by the anchor device. After receiving the message, the Fob device parses the payload of the Peer Delay Follow Up Message and retrieves the information from Step Three. ; Step 7: After completing this full time synchronization operation, the Fob device will generate four TSN time synchronization data points recorded by the Wi-Fi-PHY module, namely: , , , ; Since WiFi is a physical peer-to-peer Ethernet transmission network, and the three messages generated during the time synchronization operation between the Fob device and the anchor device—Peer Delay Req Message, Peer Delay Resp Message, and Peer Delay Follow Up Message—are all 68 bytes long, this case uses TSN ranging data for ToF ranging between the Fob device and the anchor device.
[0029] In one embodiment of this application, the first ranging message is a peer delay request message in the General Precision Time Protocol (gPTP), the second ranging message is a peer delay response message in the General Precision Time Protocol (gPTP), and the third ranging message is a peer delay follow-up message in the General Precision Time Protocol (gPTP).
[0030] Specifically, in this embodiment, the first ranging message is a Peer Delay Req Message from the General Precision Time Protocol (gPTP), the second ranging message is a Peer Delay Resp Message from gPTP, and the third ranging message is a Peer Delay Follow Up Message from gPTP. These three messages are the standard message formats used by the gPTP protocol in IEEE 1588 and 802.1AS standards when performing peer-to-peer path delay measurements. Each message is 68 bytes long and is sent and received directly from the WiFi physical layer. This embodiment reuses these three standard messages to complete the timestamp exchange required for ranging, making the entire ranging process fully compatible with the existing TSN time synchronization protocol stack without defining proprietary message formats.
[0031] In one embodiment of this application, the Fob device is a smartphone with WiFi functionality, and the anchor device is a WiFi anchor fixedly installed in the vehicle; the WiFi communication connection is a point-to-point (P2P) connection; wherein, the Fob device acts as a WiFi access point (AP), and the anchor device acts as a station (STA) connected to the AP.
[0032] Specifically, in this embodiment, the Fob device is a smartphone with WiFi capability, and the anchor device is a WiFi anchor fixedly installed in the vehicle. The WiFi communication connection between the Fob device and the anchor device adopts a peer-to-peer (P2P) mode. P2P connection, often referred to as WiFi Direct in WiFi technology, allows two WiFi devices to directly establish a one-to-one wireless communication link without relying on traditional wireless routers or access points as intermediaries. In the P2P connection establishment process of this embodiment, the Fob device acts as an Access Point (AP). An AP is the central node of a wireless network, responsible for advertising network names, managing connections, and forwarding data; its function is similar to a miniature router. The anchor device, on the other hand, acts as a Station (STA). An STA is a terminal device in a wireless network, similar to a laptop or mobile phone connected to WiFi; it actively scans for and connects to the network advertised by the AP. Based on this direct-connection network topology, the propagation path of ranging messages between the Fob device and the anchor device is the shortest direct wireless path between them. Message interaction does not require forwarding through any intermediate devices, thus avoiding the additional latency and uncertainty introduced by multi-hop forwarding, and providing optimal physical link guarantees for subsequent timestamp-based accurate ranging. Specifically, in Figure 2 In this context, "Ranging TSN Data" refers to ranging TSN data. The Fob device and each anchor point device exchange peer-to-peer delay request messages, peer-to-peer delay response messages, and peer-to-peer delay follow-up messages, recording the transmission and reception times at the WiFi-PHY layer to obtain ranging TSN data (i.e., four timestamps). , , , ).
[0033] In one embodiment of this application, there are multiple anchor point devices, and the method further includes: the Fob device polls each anchor point device according to a preset period, and performs a peer delay measurement process for each anchor point device to calculate the distance between the Fob device and each anchor point device respectively.
[0034] Specifically, in this embodiment, multiple anchor point devices are deployed on the vehicle, such as multiple anchor points distributed at the four corners of the vehicle body or in the front and rear rows. The Fob device has a pre-set polling cycle. Following this cycle, it independently initiates a complete gPTP peer-to-peer delay measurement process for each anchor point. After completing the distance measurement of the first anchor point and obtaining its corresponding distance value, the Fob device immediately switches to the next anchor point and initiates a new round of distance measurement interaction until all anchor point devices have been traversed. Through this polling mechanism, the Fob device can obtain a set of distance data between itself and each anchor point in each cycle, providing a data foundation for subsequent spatial positioning based on multiple distance values.
[0035] In one embodiment of this application, the Fob device serves as the slave clock for gPTP time synchronization, and the anchor device serves as the master clock for gPTP time synchronization.
[0036] Specifically, in this embodiment, regarding the role allocation for gPTP time synchronization, the Fob device acts as the slave clock, while each anchor device acts as the master clock. This role division means that the Fob device has the authority to initiate the ranging process: as a slave clock, the Fob device actively sends a Peer Delay Req Message to the anchor device (master clock) to initiate a delay measurement. Upon receiving the request, the anchor device only needs to passively reply with a Peer Delay Resp Message and a Peer Delay FollowUp Message according to the protocol, and send its recorded timestamp back to the Fob device. Furthermore, since smartphones have relatively abundant computing power, centrally calculating the four timestamps on the slave clock side of the Fob device effectively simplifies the firmware complexity of the anchor devices.
[0037] In one embodiment of this application, the first sending timestamp and the first receiving timestamp are both automatically captured and recorded by the WiFi physical layer hardware of the Fob device when the last bit of data in the message is sent and received; the second receiving timestamp and the second sending timestamp are both automatically captured and recorded by the WiFi physical layer hardware of the anchor device when the last bit of data in the message is sent and received.
[0038] Specifically, in this embodiment, the recording of timestamps is entirely automated by the device's WiFi physical layer hardware. Specifically, when the Fob device sends the first ranging message, its WiFi physical layer hardware automatically captures and records the moment the last bit of data in the message is successfully transmitted as the first sending timestamp. Similarly, when the Fob device receives the second ranging message, its WiFi physical layer hardware automatically captures and records the moment the last bit of data in the message is fully received as the first receiving timestamp. The timestamp recording method at the anchor device is exactly the same. The anchor device's WiFi physical layer hardware records the second receiving timestamp when receiving the first ranging message and records the second sending timestamp when sending the second ranging message. This hardware-level timestamp capture mechanism avoids the uncertain delays caused by operating system scheduling and software protocol stack processing, enabling timestamp accuracy to reach the nanosecond level, laying the foundation for subsequent accurate distance calculation. It should be noted that the WiFi physical layer hardware's ability to capture timestamps is an inherent feature of WiFi chips supporting the TSN protocol; this embodiment directly utilizes this existing hardware capability.
[0039] In one embodiment of this application, the signal propagation path delay time between the Fob device and the anchor device is calculated by subtracting the difference between the first receiving timestamp and the first sending timestamp from the difference between the second sending timestamp and the second receiving timestamp, and taking half of the result as the signal propagation path delay time.
[0040] Specifically, in this embodiment, after the Fob device collects the four timestamps generated from a complete measurement interaction—namely, the first sending timestamp, the second receiving timestamp, the first receiving timestamp, and the second sending timestamp—it calculates the signal propagation path delay time as follows: First, it calculates the difference between the first receiving timestamp and the first sending timestamp, which represents the total round-trip time from when the Fob device sends a request to when it receives a response. Second, it calculates the difference between the second sending timestamp and the second receiving timestamp, which represents the internal processing time of the anchor device from receiving the request to sending a response. Then, it subtracts the anchor's internal processing time from the total round-trip time to obtain the pure time for the signal to travel back and forth between the Fob device and the vehicle-mounted anchor. Finally, it divides this round-trip time by two and subtracts the net network transmission time of all data bits after the WiFi-PHY physical module serializes the measurement data when transmitting the measurement data using Ethernet frames, thus obtaining the one-way signal propagation path delay time.
[0041] The formula for this calculation process is expressed as follows: in, This is the signal propagation path delay time; It is also the signal propagation path delay time; This is the first received timestamp; The first sending timestamp; This is the second sending timestamp; This is the second received timestamp; It is the network speed of the WiFi-PHY physical module (that is, the speed at which the WiFi-PHY physical module receives / sends and processes data, which is based on the actual hardware speed and substituted into the formula as parameters, usually in bps). This is the complete Ethernet frame data bits (7-byte preamble, 1-byte start-of-frame character, 68-byte TSN time synchronization frame payload, and 4-byte CRC code) after the measurement data is serialized by the WiFi physical module. Convert 1 second to nanoseconds.
[0042] In one embodiment of this application, the distance between the two is calculated based at least on the path delay time and the electromagnetic wave propagation speed. Specifically, the path delay time is multiplied by the speed of light to obtain the distance between the Fob device and the anchor point device.
[0043] Specifically, in this embodiment, the signal propagation path delay time is obtained. The Fob device then multiplies this path delay time by the speed of electromagnetic waves in air to calculate the physical distance between the two. Since WiFi signals are electromagnetic waves, their speed of propagation in air is approximately equal to the speed of light. .
[0044] Therefore, distance The calculation formula is: This calculation method traces distance measurement directly to time measurement and physical constants, without relying on any empirical mapping model between signal strength and distance, and without requiring any environmental parameter calibration. As long as the four timestamps are accurate, the calculated distance is an accurate value.
[0045] In one embodiment of this application, the second receiving timestamp is encapsulated in the payload of the second ranging message, and the second sending timestamp is encapsulated in the payload of the third ranging message.
[0046] Specifically, in one embodiment of this application, the anchor device sends back the two timestamps it records to the Fob device via the payload field of a standard message. Specifically, after receiving the Peer Delay Req Message and recording the second receive timestamp, the anchor device encapsulates the second receive timestamp in the payload field of the Peer Delay Resp Message to be sent. Subsequently, after sending the Peer Delay Resp Message and recording the second send timestamp, the anchor device encapsulates the second send timestamp in the payload field of the immediately following Peer Delay Follow Up Message. After receiving these two messages sequentially, the Fob device parses the second receive timestamp from the Peer Delay Resp Message and the second send timestamp from the Peer Delay Follow Up Message. This method of sending back timestamps in one step with the response message ensures the self-containment and real-time nature of all data required for a ranging session.
[0047] In one embodiment of this application, the method further includes: determining the position of the Fob device relative to the vehicle based on the distance between the Fob device and a plurality of anchor point devices, and performing door unlocking, locking, or vehicle start control accordingly.
[0048] Specifically, in this embodiment, after obtaining the distance values between itself and multiple anchor point devices on the vehicle, the Fob device uses this distance data to perform spatial positioning calculations to determine the precise position of the Fob device relative to the vehicle body. For example, using triangulation or area determination algorithms, the system can determine whether the user is carrying a smartphone and is located outside the driver's side door, outside the passenger side door, in the rear seat area of the vehicle, or has already entered the vehicle. Based on this position determination result, the vehicle control system automatically executes the corresponding door locking operation or start authorization. For example, when it is determined that the user is outside the driver's side door and has stayed there for more than a preset time, the door is automatically unlocked; when it is determined that the user has entered the vehicle and pressed the brake pedal, one-button start is allowed; when it is determined that the user has moved away from the vehicle, the door is automatically locked. This closed-loop link directly transforms WiFi ranging data into a seamless entry and vehicle control experience that the user can perceive.
[0049] Among them, such as Figure 4As shown, the ranging operation process of this application is as follows: First, in the initial preparation stage, the Fob device waits for the anchor device to connect to the WiFi AP to establish a wireless communication link between the two. After the connection is established, the system enters the ranging loop. The Fob device polls the anchor device and synchronizes its time, and then initiates a gPTP peer delay measurement process based on TSN. During this process, the Fob device first sends a Peer Delay Req Message and records the physical layer transmission time. Then it enters a receive waiting state, waiting to receive the Peer Delay Resp Message, and records the timestamp after receiving it. And parse the timestamps recorded by the anchor devices from them. Then continue waiting to receive the Peer Delay Follow UpMessage to obtain the timestamp sent by the anchor device. After collecting four timestamps, the Fob device calculates the signal propagation path delay time and then calculates the distance between the Fob device and the anchor device. After completing the ranging of the current anchor device, the process executes a step to determine whether to exit. If it is determined that the ranging task has not been completed or the exit condition has not been met, it returns to the "polling anchor devices and synchronizing time" step via the "No" path to continue ranging the next anchor point; if it is determined that the exit condition is met, it executes subsequent operations via the "Yes" path, that is, it closes the WiFi connection with the anchor device, and finally ends the current ranging process.
[0050] While the present invention has been disclosed above, it is not limited thereto. Any person skilled in the art can make various modifications and alterations without departing from the spirit and scope of the invention; therefore, the scope of protection of the present invention should be determined by the scope defined in the claims.
Claims
1. A WiFi ranging method for automotive digital keys based on TSN, characterized in that, Performed by the digital key terminal Fob device, the method includes: Establish WiFi communication connection with the vehicle-mounted anchor point equipment; Initiate a peer-to-peer delay measurement process based on the TSN Universal Precision Time Protocol (gPTP) to the anchor point device, and perform the following steps: Send a first ranging message to the anchor device and record the first sending timestamp of the first ranging message at the moment when the WiFi physical layer transmission is completed; Receive the second ranging message returned by the anchor device, record the first receiving timestamp of the second ranging message at the moment when the WiFi physical layer reception is completed, and extract the second receiving timestamp recorded by the anchor device at the moment when the first ranging message is completed from the second ranging message; Receive the third ranging message sent by the anchor point device, and obtain the second sending timestamp recorded by the anchor point device at the moment when the second ranging message was sent from the third ranging message; Based on the first transmission timestamp, the second reception timestamp, the first reception timestamp, and the second transmission timestamp, the signal propagation path delay time between the Fob device and the anchor device is calculated, and the distance between the two is calculated based at least on the path delay time and the electromagnetic wave propagation speed.
2. The TSN-based WiFi ranging method for automotive digital keys according to claim 1, characterized in that, The first ranging message is a peer delay request message in the General Precision Time Protocol (gPTP), the second ranging message is a peer delay response message in the General Precision Time Protocol (gPTP), and the third ranging message is a peer delay follow-up message in the General Precision Time Protocol (gPTP).
3. The TSN-based WiFi ranging method for automotive digital keys according to claim 1, characterized in that, The Fob device is a smartphone with WiFi functionality, and the anchor point device is a WiFi anchor point fixedly installed in the vehicle; the WiFi communication connection is a peer-to-peer (P2P) connection. The Fob device acts as a WiFi access point (AP), and the anchor device acts as a station (STA) connected to the AP.
4. The TSN-based WiFi ranging method for automotive digital keys according to claim 1, characterized in that, The anchor point devices are multiple, and the method further includes: the Fob device polls each anchor point device according to a preset period, and performs the peer delay measurement process for each anchor point device to calculate the distance between the Fob device and each anchor point device respectively.
5. The TSN-based WiFi ranging method for automotive digital keys according to claim 4, characterized in that, The Fob device serves as the slave clock for gPTP time synchronization, and the anchor device serves as the master clock for gPTP time synchronization.
6. The TSN-based WiFi ranging method for automotive digital keys according to claim 1, characterized in that, The first sending timestamp and the first receiving timestamp are both automatically captured and recorded by the WiFi physical layer hardware of the Fob device when the last bit of data in the message is sent and received; the second receiving timestamp and the second sending timestamp are both automatically captured and recorded by the WiFi physical layer hardware of the anchor device when the last bit of data in the message is sent and received.
7. The TSN-based WiFi ranging method for automotive digital keys according to claim 1, characterized in that, The calculation of the signal propagation path delay time between the Fob device and the anchor point device specifically includes: The difference between the first received timestamp and the first sent timestamp is subtracted from the difference between the second sent timestamp and the second received timestamp, and half of the result is taken as the signal propagation path delay time.
8. The TSN-based WiFi ranging method for automotive digital keys according to claim 1, characterized in that, The calculation of the distance between the two, based at least on the path delay time and the electromagnetic wave propagation speed, specifically involves: Multiplying the path delay time by the speed of light yields the distance between the Fob device and the anchor point device.
9. The TSN-based WiFi ranging method for automotive digital keys according to claim 1, characterized in that, The second receiving timestamp is encapsulated in the payload of the second ranging message, and the second sending timestamp is encapsulated in the payload of the third ranging message.
10. The TSN-based WiFi ranging method for automotive digital keys according to any one of claims 1-9, characterized in that, The method also includes: The position of the Fob device relative to the vehicle is determined based on the distance between the Fob device and multiple anchor point devices, and the door unlocking, locking or vehicle start control is performed accordingly.