A ranging method, device, ultrasonic sensor and readable storage medium
By employing a frequency shift keying (FSK) coding method that modulates the frequency at the peak of the carrier amplitude, the problem of unsmooth mechanical vibration during frequency conversion in FFS systems is solved, thereby improving the smoothness of signal transmission and the durability of the equipment.
Patent Information
- Application Number
- CN202211597132.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-12
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2042-12-12
AI Technical Summary
Existing frequency shift keying systems cannot smoothly change mechanical vibrations during frequency conversion, resulting in signal distortion and severe wear and tear on related components.
The frequency shift keying (FSK) coding method is adopted to ensure that the slope of the wave remains unchanged before and after the frequency conversion by changing the frequency at the moment when the carrier amplitude is at its highest point. This optimizes the change of mechanical vibration, reduces signal distortion, and lowers component losses.
It improves the smoothness of signal changes, reduces signal distortion and wear of related components, and improves the accuracy of signal transmission and the service life of equipment.
Smart Images

Figure CN116094888B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of signal processing, in particular to a ranging method and device, an ultrasonic sensor and a readable storage medium. BACKGROUND
[0002] Frequency-shift Keying (FSK) is a digital modulation technique that allows data transmission according to the change of carrier frequency of digital modulation signal. It is also one of the earliest modulation methods used in information transmission. Its main advantages are relatively easy to implement, and good performance in anti-noise and anti-attenuation. Therefore, it has been widely used in low-speed data transmission.
[0003] The most common is a dual-frequency FSK system that uses two frequencies to carry binary 1 and 0. However, when transmitting 0, the frequency is low, and when transmitting 1, the frequency is high. At the frequency change moment from transmitting 0 to transmitting 1, although the electrical signal can be seamlessly changed, the mechanical vibration of the diaphragm driven by the coil is difficult to complete smooth change due to inertia, resulting in distortion. SUMMARY
[0004] In view of the above problems, the present application provides a ranging method and device, an ultrasonic sensor and a readable storage medium.
[0005] The embodiment of the present application provides a frequency-shift keying encoding method, comprising:
[0006] obtaining a sequence code group corresponding to a digital signal to be transmitted, wherein the sequence code group comprises a plurality of binary symbols arranged in sequence;
[0007] performing frequency-shift keying encoding on the sequence code group, wherein the frequency is changed at the moment when the carrier amplitude is the highest, so as to generate an analog signal formed by the frequencies corresponding to the binary symbols arranged in sequence, and the analog signal carries the content information of the digital signal.
[0008] Further, in the frequency-shift keying encoding method, the type of the binary symbol at the signal sampling point comprises a 0 symbol and a 1 symbol; and the frequency-shift keying encoding on the sequence code group comprises:
[0009] the carrier of a first frequency represents the 0 symbol, and the carrier of a second frequency represents the 1 symbol;
[0010] wherein the first frequency and the second frequency satisfy: the first frequency is not equal to the second frequency, and the first frequency and the second frequency have a multiple relationship.
[0011] Another embodiment of this application proposes a ranging method, wherein signal sampling points are applied to an ultrasonic sensor, the method comprising:
[0012] A detection signal is transmitted from the transmitting end to the target object, and the detection signal is generated by the frequency shift keying coding method described above.
[0013] The receiving end collects the signal returned via the target object at a preset sampling frequency to obtain multiple signal sampling points;
[0014] The multiple signal sampling points are processed based on the sliding matching algorithm to obtain the time interval between the detection signal being transmitted from the transmitting end to the target object and then returning to the receiving end;
[0015] The distance to the target object is calculated based on the time interval and the preset ultrasonic speed.
[0016] Furthermore, in the above ranging method, the step of processing multiple signal sampling points based on the sliding matching algorithm to obtain the time interval from when the detection signal is transmitted from the transmitting end to the target object and then returns to the receiving end includes:
[0017] Based on the sliding matching algorithm and cross-correlation function, multiple cross-correlation function values were obtained;
[0018] Based on multiple cross-correlation function values, the time interval from when the detection signal is transmitted from the transmitter to the target object and then returns to the receiver is obtained.
[0019] Furthermore, in the above ranging method, the multiple cross-correlation function values obtained based on the sliding matching algorithm and the cross-correlation function include:
[0020] Based on the preset orthogonal code, it is converted into a reference wave using the frequency shift keying coding method described above;
[0021] The reference wave is acquired to obtain a set of reference sampling points of a continuously preset number, which are used as the reference signal sampling point group;
[0022] The signal sampling points are divided into multiple signal sampling point groups, and each signal sampling point group consists of a continuous preset number of signal sampling points;
[0023] Based on the cross-correlation function, a sliding match is performed on the reference signal sampling point group and multiple signal sampling point groups to obtain the cross-correlation function value corresponding to each signal sampling point group.
[0024] Furthermore, in the above ranging method, the formula for calculating the cross-correlation function value corresponding to each signal sampling point group is as follows:
[0025] Zm=Y1*Xm+Y2*X(m+1)+…+Yn*X(m+n-1);
[0026] Where Zm is the cross-correlation function value, Y1, Y2, ..., Yn are the reference signal sampling point groups, Xm, X(m+1), ..., X(m+n-1) are the signal sampling point groups, n is the preset number, and m represents the m-th signal sampling point group.
[0027] Furthermore, in the above ranging method, obtaining the time interval from when the detection signal is transmitted from the transmitter to the target object and then returns to the receiver based on multiple cross-correlation function values includes:
[0028] The maximum cross-correlation function value is obtained from the plurality of cross-correlation function values;
[0029] Obtain the reception time of the initial signal sampling point in the signal sampling point group corresponding to the maximum cross-correlation function value;
[0030] The time interval between the transmitter and receiver is calculated based on the reception time and the initial transmission time of the detection signal.
[0031] Another embodiment of this application also proposes a frequency shift keying coding device, wherein the signal sampling points include:
[0032] A receiving unit is used to acquire a sequence code group corresponding to a digital signal to be transmitted, wherein the sequence code group includes multiple binary code elements arranged in sequence;
[0033] A generation unit is used to perform frequency shift keying encoding on the sequence code group, wherein the frequency is changed at the moment of the highest point of the carrier amplitude to generate an analog signal formed by the frequencies corresponding to each binary code element arranged in the order, the analog signal carrying the content information of the digital signal.
[0034] Another embodiment of this application proposes an ultrasonic sensor, wherein the signal sampling point includes a storage unit and a processing unit. The storage unit stores a computer program, and the processing unit executes the steps of the frequency shift keying encoding method described above by calling the computer program stored in the storage unit.
[0035] Another embodiment of this application provides a computer-readable storage medium storing a computer program at the signal sampling point, the computer program being adapted for loading by a processor to execute the steps of the frequency shift keying coding method described above.
[0036] The embodiments of this application have the following beneficial effects:
[0037] This application proposes a frequency shift keying (FSK) coding method that can change the timing of frequency conversion so that the slope of the wave remains constant before and after the frequency conversion. This allows mechanical vibration to provide time for the relevant components to vibrate during the frequency conversion, even if there is inertia. This improves the smoothness of the change, reduces signal distortion, and also reduces the wear and tear on the relevant components. Attached Figure Description
[0038] To more clearly illustrate the technical solutions of this application, the accompanying drawings used in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of this application and should not be considered as a limitation on the scope of protection of this application. In the various drawings, similar components are numbered similarly.
[0039] Figure 1 A first flowchart of a frequency shift keying coding method according to some embodiments of this application is shown;
[0040] Figure 2 A first analog signal schematic diagram of a frequency shift keying coding method according to some embodiments of this application is shown;
[0041] Figure 3 A second analog signal schematic diagram of a frequency shift keying coding method according to some embodiments of this application is shown;
[0042] Figure 4 A third analog signal schematic diagram of a frequency shift keying coding method according to some embodiments of this application is shown;
[0043] Figure 5 A first flowchart of a ranging method according to some embodiments of this application is shown;
[0044] Figure 6 A second flowchart of a ranging method according to some embodiments of this application is shown;
[0045] Figure 7 A third flowchart of a ranging method according to some embodiments of this application is shown;
[0046] Figure 8 A fourth flowchart of a ranging method according to some embodiments of this application is shown;
[0047] Figure 9 A schematic diagram of the structure of a frequency shift keying encoding apparatus according to some embodiments of this application is shown. Detailed Implementation
[0048] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0049] The components of the embodiments of this application described and illustrated in the accompanying drawings can be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of this application provided in the drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0050] In the following, the terms “comprising,” “having,” and their cognates, which may be used in various embodiments of this application, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as excluding, firstly, the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more features, numbers, steps, operations, elements, components, or combinations thereof.
[0051] Furthermore, the terms "first," "second," and "third" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.
[0052] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of this application pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be construed as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of this application.
[0053] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0054] Typically, the transmitter of an ultrasonic sensor is based on the property of electromagnetism. Alternating current is used to make the coil continuously change the direction of the magnetic field, thereby attracting or repelling a fixed permanent magnetic field, which drives the diaphragm to produce mechanical vibration, and finally generates a given ultrasonic wave.
[0055] To address the distortion caused by the inability of mechanical vibration to change smoothly during frequency conversion, this application proposes a frequency shift keying (FSK) coding method.
[0056] Please refer to Figure 1 This is a flowchart of a frequency shift keying (FSK) coding method proposed in an embodiment of this application. Exemplarily, this FSK coding method is applied to an ultrasonic sensor.
[0057] In some implementations, such asFigure 1 As shown, the frequency shift keying coding method includes:
[0058] S101, Obtain the sequence code group corresponding to the digital signal to be transmitted, wherein the sequence code group includes multiple binary code elements arranged in sequence.
[0059] S201, frequency shift keying encoding is performed on the sequence code group, wherein the frequency is changed at the moment of the highest point of the carrier amplitude to generate an analog signal formed by the frequencies corresponding to each sequentially arranged binary code element, and the analog signal carries the content information of the digital signal.
[0060] Specifically, binary symbols are of two types: 0 and 1. Each symbol corresponds to a specific frequency. Multiple different symbols arranged in a certain order can form a set, called a sequence code group. First, the frequency corresponding to each symbol, the transmission period for each symbol, and the frequency conversion time need to be set. When the digital signal to be transmitted is received, the corresponding sequence code group is generated based on the digital signal. Then, a carrier wave of the corresponding frequency is generated sequentially according to each symbol in the sequence code group, such as... Figure 2 As shown, the square wave represents 0 and 1 symbols, with 0 symbol corresponding to a low frequency and 1 symbol corresponding to a high frequency. The sine wave represents an analog signal formed by the frequencies corresponding to binary symbols. The preset frequency conversion time determines the phase of the wave, and the preset symbol transmission period determines the interval between each symbol transmission. The preset frequency corresponding to the symbol determines the number of cycles in one symbol transmission period. Optionally, the carrier wave can be a simple harmonic wave; this is not limited here.
[0061] For example, if the preset frequency conversion time is set to the time corresponding to the zero point and the maximum amplitude of the carrier wave, the phase of the carrier wave generated at the two frequency conversion times will be different. If it is a simple harmonic wave, the phase difference will be 90 degrees. Of course, this is just an example, and the preset frequency conversion time can be any other time.
[0062] like Figure 3 As shown, in order to make the changes in mechanical vibration smoother and reduce signal distortion, this embodiment uses the moment of the highest carrier amplitude for frequency variation. It is known that... If the selected frequency conversion time corresponds to the zero point of the carrier wave, then sinωx = 0 at the zero point, and the corresponding slope is ωcosωx = ±ω. That is, when the amplitude is 0, the slope is ±ω. Therefore, for two carrier waves of different frequencies, the slope at the zero point will definitely be different. Changing the frequency at the zero point (where the amplitude is 0) will result in an uneven change in mechanical vibration. When the amplitude is at its maximum (sinωx = ±1), the slope ωcosωx = 0, meaning the slope is constant when the amplitude is at its maximum. Therefore, for two carrier waves of different frequencies, the slope at the maximum amplitude will definitely be the same, i.e., 0.
[0063] Furthermore, the binary code types of the signal sampling points include 0 code and 1 code; frequency shift keying encoding of the sequence code group includes:
[0064] The carrier at the first frequency is represented as 0 symbol, and the carrier at the second frequency is represented as 1 symbol.
[0065] Among them, the first frequency and the second frequency satisfy the following conditions: the first frequency is not equal to the second frequency, and the first frequency and the second frequency are multiples of each other.
[0066] Exemplary, such as Figure 4 As shown, if the generated sequence code group is [0, 1, 1, 0, 0, 0, 0, 1, 0, 0], the preset frequency corresponding to the symbol is set as follows: 0 corresponds to 3KHz, 1 corresponds to 1KHz, and the preset symbol transmission period is 1ms. Therefore, it can be seen that within 1ms, if a 0 symbol is transmitted, there will be 3 cycles of carrier waves in one period; if a 1 symbol is transmitted, there will be 1 cycle of carrier waves in one period. The generation process is as follows: First, a carrier wave with a corresponding frequency of 3KHz is generated based on the first 0 symbol in the sequence code group; in the second 1ms period, the carrier frequency is changed from 3KHz to the frequency corresponding to the second 1 symbol, i.e., 1KHz; in the third 1ms period, since the corresponding third symbol is a 1 symbol and has the same frequency as the second period, the frequency remains unchanged; in the fourth 1ms period, the carrier frequency is changed from the original 1KHz to the frequency corresponding to the fourth 0 symbol, i.e., 3KHz, and so on. Finally, we will get a 3kHz carrier wave in the first 1ms, 4ms, 5ms, 6ms, 7ms, 9ms and 10ms, and a 1kHz carrier wave in the second 2ms, 3ms and 8ms.
[0067] Optionally, the first frequency corresponding to symbol 0 can be higher or lower than the second frequency corresponding to symbol 1; this is not limited and can be freely set according to specific circumstances. It is conceivable that the second frequency corresponding to symbol 1 can also be equal to the first frequency corresponding to symbol 0.
[0068] This application proposes a frequency shift keying (FSK) coding method that can change the timing of frequency conversion so that the slope of the wave remains constant before and after the frequency conversion. This allows mechanical vibration to provide time for the relevant components to vibrate during the frequency conversion, even if there is inertia. This improves the smoothness of the change, reduces signal distortion, and also reduces the wear and tear on the relevant components.
[0069] Another embodiment of this application also proposes a ranging method, such as... Figure 5 As shown, signal sampling points are applied to an ultrasonic sensor, and the method includes:
[0070] S301, a detection signal is transmitted from the transmitting end to the target object, and the detection signal is generated by the frequency shift keying coding method.
[0071] S401, the receiving end collects the signal returned by the target object at a preset sampling frequency to obtain multiple signal sampling points.
[0072] S501 processes multiple signal sampling points based on the sliding matching algorithm to obtain the time interval from when the detection signal is transmitted from the transmitter to the target object and then returns to the receiver.
[0073] Specifically, after receiving the returned signal, the receiver converts it into a transmitted analog signal. The receiver has preset storage settings for sampling frequency, preset orthogonal codes, and a sliding matching algorithm. The sampling frequency is freely set and is not limited here. Since the received signal is interfered with by other signals, the most relevant signal sampling point needs to be selected as the basis for distance calculation. Of course, the number of most relevant signal points is not unique; it can be one or multiple. For example, the signal sampling points collected according to the preset sampling frequency are X1, X2, X3, ..., Xm, ...
[0074] In another embodiment, such as Figure 6 As shown, the processing of multiple signal sampling points based on the sliding matching algorithm includes:
[0075] S502, based on the sliding matching algorithm and cross-correlation function, obtains multiple cross-correlation function values.
[0076] S503, based on multiple cross-correlation function values, obtains the time interval between the transmission of the detection signal from the transmitter to the target object and its return to the receiver.
[0077] Specifically, each group of signal sampling points corresponds to a cross-correlation function value.
[0078] In another embodiment, such as Figure 7 As shown, based on the sliding matching algorithm and the cross-correlation function, several cross-correlation function values are obtained, including:
[0079] S5021 converts a frequency shift keying (FSK) signal into a reference wave using a preset orthogonal code.
[0080] S5022 acquires the reference wave to obtain a set of reference sampling points with a continuously preset number, which serve as the reference signal sampling point group.
[0081] S5023 divides the signal sampling points into multiple signal sampling point groups, each of which consists of a preset number of consecutive signal sampling points.
[0082] S5024, based on the cross-correlation function, performs sliding matching on the reference signal sampling point group and multiple signal sampling point groups to obtain the cross-correlation function value corresponding to each signal sampling point group.
[0083] Specifically, a preset orthogonal code is converted into a set of wave signals using FSK. This set of wave signals is called the reference wave. A preset number of consecutive reference signal sampling points are collected according to a preset sampling frequency. These collected reference signal sampling points constitute the reference signal sampling point group. Of course, the start time for collecting this set of reference signal sampling points is not unique and is not restricted here; it can be set freely according to different situations. Then, the most relevant set of sampling signal points is calculated using the collected reference signal sampling group. For example, after the preset orthogonal code is converted into the reference wave, a preset number of reference signal sampling points are collected according to a preset sampling frequency. For example, the reference signal sampling points are Y1, Y2, Y3, ..., Yn, with a preset number of n.
[0084] In another embodiment, the formula for calculating the cross-correlation function value corresponding to each group of signal sampling points is as follows:
[0085] Zm=Y1*Xm+Y2*X(m+1)+…+Yn*X(m+n-1);
[0086] Where Zm is the cross-correlation function value, Y1, Y2, ..., Yn are the reference signal sampling point groups, Xm, X(m+1), ..., X(m+n-1) are the signal sampling point groups, n is the preset number, and m represents the m-th signal sampling point group.
[0087] Specifically, if the collected reference signal sampling points are Y1, Y2, Y3, ..., Yn, with a preset number of n, and the collected signal sampling points are X1, X2, X3, ..., Xm, ..., then X1, X2, ..., Xn constitute the first signal sampling point group, X2, X3, ..., Xn+1 constitute the second signal sampling point group, Xm, Xm+1, ..., Xm+n-1 constitute the m-th signal sampling point group, and so on, resulting in multiple signal sampling point groups. Then, the matched cross-correlation function values Z correspond to Z1 = Y1*X1 + Y2*X2 + ... + Yn*Xn, Z2 = Y1*X2 + Y2*X3 + ... + Yn*X(n+1), ..., Zm = Y1*Xm + Y2*X(m+1) + ... + Yn*X(m+n-1).
[0088] In another embodiment, such as Figure 8 As shown, based on multiple cross-correlation function values, the time interval from the transmitter to the receiver includes:
[0089] S5025, obtains the maximum cross-correlation function value from multiple cross-correlation function values;
[0090] S5026, Obtain the reception time of the initial signal sampling point in the signal sampling point group corresponding to the maximum cross-correlation function value;
[0091] S5027, calculate the time interval between the transmitter and receiver based on the reception time and the initial transmission time of the detection signal.
[0092] Specifically, the peak value of the cross-correlation function is found among multiple sets of cross-correlation function values, that is, the largest cross-correlation function value. The signal sampling point group corresponding to the largest cross-correlation function value is the most correlated signal sampling point group. In other words, the initial signal sampling point of the most correlated signal sampling point group is the signal sampling point at which the transmitter starts to transmit.
[0093] Optionally, the receiving end receives signals for a preset time, and stops receiving signals after the preset time. The signals received within the preset time are divided into multiple signal sampling point groups according to a defined matching algorithm. The cross-correlation function value corresponding to each signal sampling point group is calculated, and the peak value of the cross-correlation function value is obtained by comparison. The maximum cross-correlation function value is then used to measure the distance to the target object according to the above method steps. The preset time is not limited here and can be set arbitrarily according to the actual situation.
[0094] S601 calculates the distance to the target object based on the time interval and the preset ultrasonic speed.
[0095] Specifically, the reception time corresponding to the initial sampling point in the signal sampling point group corresponding to the largest cross-correlation function value is taken as the reception time of the receiving end. The difference between the reception time and the transmission time is used to obtain the time interval, and the measurement distance is calculated based on the preset ultrasonic speed and the obtained time interval.
[0096] The ranging method in this embodiment can measure distance by transmitting optimized waves, greatly reducing wave distortion and making the measured distance more accurate. Simultaneously, by using orthogonal codes and finding the maximum cross-correlation function value, the method finds the time interval corresponding to the group of wave signal points most similar to the original transmitted signal in the received, interfered wave, thus greatly improving the accuracy of the calculation.
[0097] Another embodiment of this application also proposes a frequency shift keying coding device 700, such as... Figure 9 As shown, the device 700 includes:
[0098] The receiving unit 701 is used to acquire the sequence code group corresponding to the digital signal to be transmitted, wherein the sequence code group includes multiple binary code elements arranged in sequence.
[0099] The generation unit 702 is used to perform frequency shift keying encoding on the sequence code group, wherein the frequency is changed at the moment of the highest point of the carrier amplitude to generate an analog signal formed by the frequencies corresponding to each sequentially arranged binary code element, and the analog signal carries digital signal information.
[0100] Another embodiment of this application proposes an ultrasonic sensor, including a storage unit and a processing unit. The storage unit stores a computer program, and the processing unit executes the steps of the frequency shift keying encoding method described above by calling the computer program stored in the storage unit.
[0101] Another embodiment of this application provides a computer-readable storage medium storing a computer program adapted for loading by a processor to perform the steps of the frequency shift keying coding method described above.
[0102] It is understood that the method steps in this embodiment correspond to the frequency shift keying coding method in the above embodiments. The options of the above frequency shift keying coding method are also applicable to this embodiment, and will not be described again here.
[0103] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that, in alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0104] In addition, the functional modules or units in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0105] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a smartphone, personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0106] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A distance measurement method, characterized in that, Applied to an ultrasonic sensor, the method includes: A detection signal is transmitted from a transmitting end to a target object. The detection signal is generated using a frequency shift keying (FSK) coding method. The FSK coding method includes: acquiring a sequence code group corresponding to a digital signal to be transmitted, wherein the sequence code group includes multiple sequentially arranged binary symbols; performing FSK coding on the sequence code group, wherein the frequency is varied at the moment of maximum carrier amplitude to generate an analog signal formed by the frequencies corresponding to the sequentially arranged binary symbols, the analog signal carrying the content information of the digital signal; wherein the analog signal is used to control a coil in the transmitting end to continuously change the direction of its magnetic field, attracting or repelling a fixed permanent magnetic field in the transmitting end, thereby causing the diaphragm in the transmitting end to mechanically vibrate and generate the detection signal. The receiving end collects the signal returned via the target object at a preset sampling frequency to obtain multiple signal sampling points; The multiple signal sampling points are processed based on the sliding matching algorithm to obtain the time interval between the detection signal being transmitted from the transmitting end to the target object and then returning to the receiving end; The distance to the target object is calculated based on the time interval and the preset ultrasonic speed.
2. The ranging method according to claim 1, characterized in that, The binary code elements include 0 code elements and 1 code elements; the frequency shift keying encoding of the sequence code group includes: The carrier at the first frequency represents the 0 symbol, and the carrier at the second frequency represents the 1 symbol; Wherein, the first frequency and the second frequency satisfy the following conditions: the first frequency is not equal to the second frequency, and the first frequency and the second frequency are multiples of each other.
3. The ranging method according to claim 1, characterized in that, The step of processing multiple signal sampling points based on the sliding matching algorithm to obtain the time interval from when the detection signal is transmitted from the transmitter to the target object and then returns to the receiver includes: Based on the sliding matching algorithm and cross-correlation function, multiple cross-correlation function values were obtained; Based on multiple cross-correlation function values, the time interval from when the detection signal is transmitted from the transmitter to the target object and then returns to the receiver is obtained.
4. The ranging method according to claim 3, characterized in that, The multiple cross-correlation function values obtained based on the sliding matching algorithm and cross-correlation function include: Based on the preset orthogonal code, it is converted into a reference wave using the frequency shift keying coding method described above; The reference wave is acquired to obtain a set of reference sampling points of a continuously preset number, which are used as the reference signal sampling point group; The signal sampling points are divided into multiple signal sampling point groups, and each signal sampling point group consists of a continuous preset number of signal sampling points; Based on the cross-correlation function, a sliding match is performed on the reference signal sampling point group and multiple signal sampling point groups to obtain the cross-correlation function value corresponding to each signal sampling point group.
5. The ranging method according to claim 4, characterized in that, The formula for calculating the cross-correlation function value corresponding to each group of signal sampling points is as follows: Zm=Y1*Xm+Y2*X(m+1)+…+Yn*X(m+n-1); Where Zm is the cross-correlation function value, Y1, Y2, ..., Yn are the reference signal sampling point groups, Xm, X(m+1), ..., X(m+n-1) are the signal sampling point groups, n is the preset number, and m represents the m-th signal sampling point group.
6. The ranging method according to claim 3, characterized in that, The step of obtaining the time interval between the transmission of the detection signal from the transmitter to the target object and back to the receiver, based on multiple cross-correlation function values, includes: The maximum cross-correlation function value is obtained from the multiple cross-correlation function values; Obtain the reception time of the initial signal sampling point in the signal sampling point group corresponding to the maximum cross-correlation function value; The time interval between the transmitter and receiver is calculated based on the reception time and the initial transmission time of the detection signal.
7. A ranging device, characterized in that, The ranging device, applied to an ultrasonic sensor, includes: A transmitting module is used to transmit a detection signal from a transmitting end to a target object. The detection signal is generated by a frequency shift keying (FSK) coding method. The FSK coding method includes: acquiring a sequence code group corresponding to a digital signal to be transmitted, wherein the sequence code group includes multiple sequentially arranged binary symbols; performing FSK coding on the sequence code group, wherein the frequency is varied at the moment of maximum carrier amplitude to generate an analog signal formed by the frequencies corresponding to the sequentially arranged binary symbols, the analog signal carrying the content information of the digital signal; wherein the analog signal is used to control a coil in the transmitting end to continuously change the direction of its magnetic field, continuously attracting or repelling a fixed permanent magnetic field in the transmitting end, thereby driving the diaphragm in the transmitting end to mechanically vibrate and generate the detection signal. The acquisition module is used by the receiving end to acquire the signal returned by the target object at a preset sampling frequency to obtain multiple signal sampling points; The processing module is used to process the multiple signal sampling points based on the sliding matching algorithm to obtain the time interval between the detection signal being transmitted from the transmitting end to the target object and then returning to the receiving end; The calculation module is used to calculate the distance to the target object based on the time interval and the preset ultrasonic speed.
8. An ultrasonic sensor, characterized in that, It includes a storage unit and a processing unit. The storage unit stores a computer program, and the processing unit executes the steps of the ranging method as described in any one of claims 1 to 6 by calling the computer program stored in the storage unit.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted for loading by a processor to perform the steps of the ranging method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Ultrasonic wave ranging method
CN107015230A
Digital remodulation and digital remodulating method for binary frequency shift keying signal
CN1976329A