A multi-scene correction method for measuring room temperature based on a dual-channel microphone intelligent device
By using signal preprocessing and Kalman filtering algorithms in a dual-channel microphone smart device, the problems of poor temperature measurement accuracy and robustness in noisy environments are solved, enabling efficient room temperature measurement in multiple scenarios.
Patent Information
- Application Number
- CN202411429455.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2044-10-14
AI Technical Summary
Existing methods for measuring room temperature based on devices require additional hardware, have unsatisfactory accuracy, and are not robust in noisy environments. Common time delay estimation algorithms are computationally intensive, which affects the efficiency of temperature measurement.
A smart device based on a dual-channel microphone is used to emit sound waves through a speaker. The time delay is calculated by cross-correlation, combined with the sound speed-temperature mapping relationship, signal preprocessing and Kalman filtering algorithm, to reduce the amount of computation and improve the accuracy and robustness of temperature measurement results.
It significantly improves the accuracy and stability of temperature measurement results in multiple scenarios, reduces the amount of computation, is applicable to various equipment models, and adapts to complex environmental interference.
Smart Images

Figure CN119290202B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a multi-scenario correction method for measuring room temperature using a dual-channel microphone smart device, belonging to the field of signal processing technology. Background Technology
[0002] The measurement of room temperature has important application value in fields such as spatial comfort assessment and clinical monitoring analysis. If some portable smart devices can be used for real-time on-site temperature measurement, it will not only bring great convenience to room temperature measurement, but also reduce measurement costs. However, the current methods of measuring room temperature based on devices are mainly based on infrared thermometry, which requires the installation of additional hardware and is not ideal in terms of accuracy.
[0003] From an acoustic perspective, sound waves can be emitted using a device's speaker, and the speed of sound can be calculated by measuring the delay of the signals received by dual-channel microphones and combining this with the length of each sound propagation path. This speed of sound can then be used to estimate room temperature based on the sound speed-temperature mapping. However, temperature measurement scenarios often involve background noise (human voices, wind, etc.), and the multipath propagation of sound waves can interfere with the time delay estimation of dual-channel signals. Common time delay estimation algorithms are computationally intensive and require large amounts of data, which may result in low temperature measurement efficiency when deployed on actual devices. Furthermore, the effects of noise and multipath propagation pose significant challenges to the robustness of these algorithms. Therefore, designing a lightweight and robust data processing method is of great importance for the application of ultrasonic room temperature measurement in intelligent devices. Summary of the Invention
[0004] The purpose of this invention is to propose a multi-scenario correction method for measuring room temperature using a dual-channel microphone smart device. This method can effectively reduce the computational and data volume of general time-delay estimation-based sound velocity-room temperature measurement algorithms, and improve the accuracy and robustness of temperature measurement results in noisy environments.
[0005] To achieve the above objectives, the technical solution adopted by the present invention is: a multi-scene correction method for measuring room temperature based on a dual-channel microphone smart device, which includes the following steps:
[0006] S1: Invokes the device's speaker to emit a sound signal;
[0007] S2: Call the device's dual-channel microphone to collect sound signals and preprocess the raw dual-channel sound signals;
[0008] S3: Use the excitation signal and the dual-channel acoustic signal to perform cross-correlation calculations to determine the arrival sound along different paths and filter out interference signals;
[0009] S4: The delay of the dual-channel microphone received signal is calculated by calculating the delay between the excitation signal and the shortest direct sound of the selected dual-channel acoustic signal;
[0010] S5: Estimate the sound speed based on the shortest sound path difference and time delay difference of sound waves, and obtain the average temperature of the sound path according to the sound speed;
[0011] S6: For different usage environments and device models, perform a temperature measurement before the first use to complete initialization. Specifically, first perform a temperature measurement through steps S1 - S5, then reverse - infer the size parameters of the device and update the algorithm parameters based on the temperature reference values measured by other existing temperature measurement methods, and then use the updated parameters for subsequent temperature measurements.
[0012] Furthermore, in step S1, the transmitted signal can adopt a linear frequency - modulated signal, which can reduce the propagation sound attenuation without increasing the signal length and ensure the spatial resolution. The center frequency of the signal is preferably above 18 kHz or in a higher ultrasonic frequency band to avoid environmental noise interference, and at the same time, set a certain bandwidth to compensate for the frequency response differences of the device. Considering the possible system delays in starting the transmission and reception threads of the device and the device晃动 (device shaking) caused by the user during operation, set a certain blank paragraph at the beginning of the excitation signal, set the acquisition length to be the same as the length of the excitation signal, and ensure that the acquired signal includes the complete excited part and is relatively stable. When acquiring, to avoid audio distortion and ensure calculation accuracy, the audio format is 16 - bit depth, and set the buffer size:
[0013]
[0014] In the above formula, f s is the sampling frequency of the device microphone. Setting the buffer size through the above formula can ensure calculation while sampling and control the amount of calculated data, so as to simultaneously perform signal transmission, reception, and calculation threads, and maximize the calculation efficiency through parallel calculation.
[0015] Furthermore, considering the influence of the multi - path propagation effect of sound waves on the delay calculation, it is necessary to strictly limit the synchronous end of the transmission thread and the reception thread. Missing a small part of the end signal has no significant impact on the delay estimation. Therefore, step S2 pre - processes the dual - channel signal according to the following steps:
[0016] S2.1: Let the length of the reserved blank paragraph in S1 be t0, and the total length of the signal be t a , perform peak search on the first t0 segments of the received signal, and use the peak s m0 to normalize the signal;
[0017] S2.2: Calculate the ratio h of the maximum peak s m0 to the sub - peak s m1 . According to the experiment, set a threshold h0. If h < h0, it is considered that the background noise is relatively stable, and from the received signal The signal is intercepted from time t; if h ≥ h0, then strong interference is considered to exist in the environment, starting from the occurrence of the maximum peak value s. m0 The signal is intercepted after the specified time.
[0018] S2.3: The truncated signal is denoised by using an FIR bandpass filter. The passband of the filter is determined by the frequency band of the excitation signal.
[0019] S2.4: Let t be the starting point of the cutoff in S2.2. c , with [t c Using the signal [t0, t0] as a reference, spectral subtraction is used to subtract the signal from [t0, t0]. a Noise reduction for [segment] signals;
[0020] S2.5: Because the truncation operations of the dual-channel signals in S2.2 may differ, the corresponding signal lengths may also differ, and the timing of the excitation response may also differ. This will cause a time delay deviation between the received signal and the excitation signal, so signal compensation is necessary. Based on the previously truncated length, zeros of a corresponding length are added to the beginning of the signal to ensure that the length of both dual-channel signals remains t. a ;
[0021] S2.6: Based on the length l of the signal sequence in S2.5, calculate the smallest positive integer n such that 2 n ≥l, padding the signal with zeros from the end to make the signal length 2. n Then, upsampling is performed, and after upsampling, the signal is passed through a bandpass filter to improve computational efficiency and avoid spectral leakage.
[0022] Furthermore, in step S2.1, the length t0 of the blank segment depends on the performance of the device and the temperature measurement environment. Generally, to ensure the universality of the algorithm, the following can be adopted:
[0023] Furthermore, in steps S3-S5, assuming the sound path length difference is d, and the time delays of the dual-channel signal and the excitation signal are τ1 and τ2 respectively, then the ambient sound velocity is:
[0024]
[0025] Furthermore, the average ambient temperature along the sound path can be obtained from the following formula:
[0026]
[0027] Where T0 = 273.15K and c0 = 331.5m / s are the sound speeds corresponding to T0. Substituting the sound speeds in equation (1) into equation (2) will give the ambient temperature.
[0028] Furthermore, in step S3, the time delay of the sound arriving at different paths is determined by calculating the cross-correlation peak of the excitation signal and the dual-channel signal, and the sound with the shortest time delay is selected as the known path d-sound signal (it is assumed that the shortest propagation path length is the distance between the two microphones of the device, and this hypothesis can be verified through experiments).
[0029] Furthermore, in step S5, due to limitations of the sound velocity-room temperature measurement algorithm based on time delay estimation, the algorithm's room temperature estimation results will obviously differ for different usage scenarios and device models. For example, if the device is in a state of violent motion during signal transmission and reception, the sound velocity near the device will fluctuate significantly due to changes in air density. The resulting signal distortion and environmental changes will directly lead to abnormal temperature measurement results. Therefore, when performing room temperature measurements, it is necessary to ensure that the device is in a relatively standardized environment, such as being placed horizontally on a table. In addition, the estimation of sound velocity is related to the difference in the sound path length from the speaker to the two microphones, and this parameter needs to be determined before measurement for different device models.
[0030] In summary, initialization is necessary for room temperature measurement algorithms deployed on devices, stemming from both the algorithm's theoretical foundation and practical application considerations. Furthermore, signal filtering or smoothing techniques can be employed to improve measurement accuracy and algorithm robustness during the temperature measurement process. The initialization in S6 essentially involves first performing temperature measurement using the algorithm proposed in this invention, and then using the algorithm results and external temperature reference values to infer the environmental parameters used in the algorithm. The specific methods and processing strategies are as follows:
[0031] Consider temperature measurement in three scenarios: horizontal desktop position, single-handed vertical holding, and double-handed horizontal holding.
[0032] A1: For a horizontally positioned desktop, the temperature measurement scenario is relatively simple and stable, and the sound propagation path is relatively clear. Only one temperature measurement is needed, and then the temperature reference value (which can be determined by other temperature measurement methods) is used. R And the reference sound speed c derived from equation (2) R Then, based on the delay τ2-τ1 calculated during the temperature measurement process, the corrected phone size parameters are calculated. Subsequent temperature measurement processes all use d. ′ Simply replace d;
[0033] A2: For single-handed vertical holding, initialize using the same method as in A1. Additionally, the user's arm movement needs to be considered. A Kalman filter algorithm can be used to smooth the data and improve the accuracy of temperature estimation. Let the temperature estimate Z(k) at time k be:
[0034] Z(k) = T(k) + v(k)
[0035] The equation for the evolution of the true temperature T(k) over time is:
[0036] T(k)=T(k-1)+w(k-1)
[0037] Where v and w are measurement noise and system noise, respectively, set to Gaussian white noise with a mean of 0 and variances Q and R. Let the measurement error covariance be P. Then, considering that the room temperature remains nearly constant during continuous temperature measurements (measurement interval less than 3 seconds), we have:
[0038] T(k|k-1)=T(k-1|k-1)
[0039] P(k|k-1)=P(k-1|k-1)+Q
[0040] Where T(k|k-1) is the predicted temperature at time k-1, and P(k|k-1) is the prediction error covariance.
[0041] Calculate the Kalman gain K(k):
[0042]
[0043] The updated temperature estimate is then obtained:
[0044] T(k|k)=T(k|k-1)+K(k)[Z(k)-T(k|k-1)]
[0045] To update the error covariance for subsequent measurements:
[0046] P(k|k)=[1-K(k)]P(k|k-1)
[0047] Kalman filtering can effectively reduce temperature measurement uncertainty caused by noise, and can handle random external factors to a certain extent. It does not require tracing historical data and can effectively reduce the dependence on computing power.
[0048] A3: For holding the instrument horizontally with both hands, initialize using the same method as in A1. Since the hands significantly block the shortest sound path in this horizontal holding position, and the heat radiation from the hands increases the temperature in the local area near the sound path (experiments show this effect increases the measured value by approximately 0.5–1℃, which is quite considerable), a slight adjustment can be made to the measurement results in addition to using the Kalman filter algorithm described in A2:
[0049]
[0050] in For the corrected temperature, The measurement results are before correction.
[0051] The beneficial effects of this invention are: This invention proposes a signal preprocessing method and a processing strategy for real-time correction of the algorithm in multiple scenarios and multiple device models, which can significantly improve the computational efficiency of the algorithm when deployed and running on smart devices, and can improve the accuracy and stability of temperature measurement results for complex temperature measurement scenarios and external interference, so that the algorithm can obtain good temperature measurement results on multiple models of devices in multiple scenarios. Attached Figure Description
[0052] Figure 1 This is a schematic diagram of the ultrasonic propagation path of the device;
[0053] Figure 2 Here is a flowchart of the temperature measurement algorithm;
[0054] Figure 3 A flowchart illustrating the deployment of temperature measurement and initialization (calibration) on the device;
[0055] Figure 4 Here is a flowchart of the Kalman filter algorithm;
[0056] Figure 5 Temperature estimation results after Kalman filtering Detailed Implementation
[0057] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments.
[0058] Example 1
[0059] This embodiment proposes a multi-scenario correction method for measuring room temperature using a dual-channel microphone smartphone, including the following steps:
[0060] S1: Invokes the device's speaker to emit a sound signal;
[0061] S2: Call the device's dual-channel microphone to collect sound signals, and perform preprocessing such as cropping and noise reduction on the original dual-channel sound signals;
[0062] S3: Use the excitation signal and the dual-channel signal to perform cross-correlation calculations to determine the arrival sound along different paths and filter out interference signals;
[0063] S4: The delay of the dual-channel microphone received signal is calculated by calculating the delay between the excitation signal and the shortest direct sound of the selected dual-channel signal;
[0064] S5: Estimate the speed of sound based on the linear acoustic assumption by utilizing the shortest path difference and time delay difference of sound waves;
[0065] S6: For different usage environments and device models, in order to ensure algorithm performance, a temperature measurement needs to be performed once after the algorithm is deployed (i.e., steps S1-S5) and before the first use. Then, the phone size parameters are deduced and the algorithm parameters are updated based on the temperature reference value obtained by other methods (such as thermocouple thermometers). In addition, corresponding processing strategies are adopted for different scenarios.
[0066] by Figure 1 , Figure 2 , Figure 3 and Figure 4 Taking the ultrasonic temperature measurement task of the device shown as an example, the key technical points of the method of the present invention will be explained in detail below:
[0067] 1. Sound speed measurement based on time delay estimation method:
[0068] like Figure 1 As shown, for a typical smartphone with dual-channel microphones, the excitation signal is emitted from the speaker at the lower right of the device and has multiple propagation paths to the lower left and upper right of the device. Two shortest sound paths with clearly defined lengths are used. 20 and d 10 To calculate the time delay, the difference in sound path length is:
[0069] d = d 20 -d 10
[0070] The speed of sound can then be calculated based on the time delay difference τ2-τ1:
[0071]
[0072] The average temperature along the sound path is then obtained from the following formula:
[0073]
[0074] Where T0 = 273.15K and c0 = 331.5m / s are the speeds of sound corresponding to T0.
[0075] 2. Use a smartphone for measurement and initialization:
[0076] like Figure 2 As shown in -a, the signal transmission and reception threads are started simultaneously after the measurement process begins. If it is desired to further improve the calculation accuracy, the processing thread can be started some time before the reception ends. Some calculations in S2 can be performed synchronously with the reception. The initialization steps are as follows: Figure 2 As shown in -b, the basic idea is to update the relevant parameters in the algorithm (mainly the phone size parameter d) based on the delay estimate under the current scenario after a temperature measurement.
[0077] Initialization essentially involves first measuring the temperature using the algorithm proposed in this invention, and then using the algorithm results and external temperature reference values to infer the environmental parameters used in the algorithm. The specific methods and processing strategies are as follows:
[0078] Consider temperature measurement in three scenarios: horizontal desktop position, single-handed vertical holding, and double-handed horizontal holding.
[0079] A1: For a horizontally positioned desktop, the temperature measurement scenario is relatively simple and stable, and the sound propagation path is relatively clear. Only one temperature measurement is needed, and then the temperature reference value (which can be determined by other temperature measurement methods) is used. R And the reference sound speed c derived from equation (2) R Then, based on the delay τ2-τ1 calculated during the temperature measurement process, the corrected phone size parameters are calculated:
[0080] d ′ =c R (τ2-τ1)
[0081] Subsequent temperature measurements all used d ′ Simply replace d.
[0082] A2: For single-handed vertical holding, initialize using the same method as in A1. Additionally, consider the user's arm movement; a Kalman filter can be used to smooth the data and improve the accuracy of temperature estimation. For continuous temperature measurement, let the temperature estimate Z(k) at time k be:
[0083] Z(k) = T(k) + v(k)
[0084] The equation for the evolution of the true temperature T(k) over time is:
[0085] T(k)=T(k-1)+w(k-1)
[0086] Where v and w are measurement noise and system noise, respectively, set to Gaussian white noise with a mean of 0 and variances Q and R. Let the measurement error covariance be P. Then, considering that the room temperature remains nearly constant during continuous temperature measurements (measurement interval less than 3 seconds), we have:
[0087] T(k|k-1)=T(k-1|k-1)
[0088] P(k|k-1)=P(k-1|k-1)+Q
[0089] Where T(k|k-1) is the predicted temperature at time k-1, and P(k|k-1) is the prediction error covariance.
[0090] Calculate the Kalman gain K(k):
[0091]
[0092] The updated temperature estimate is then obtained:
[0093] T(k|k)=T(k|k-1)+K(k)[Z(k)-T(k|k-1)]
[0094] To update the error covariance for subsequent measurements:
[0095] P(k|k)=[1-K(k)]P(k|k-1).
[0096] A3: For holding the instrument horizontally with both hands, initialize using the same method as in A1. Since the hands significantly block the shortest sound path in this horizontal holding position, and the heat radiation from the hands increases the temperature in the local area near the sound path (experiments show this effect increases the measured value by approximately 0.5–1℃, which is quite considerable), a slight adjustment can be made to the measurement results in addition to using the Kalman filter algorithm described in A2:
[0097]
[0098] in For the corrected temperature, The measurement results are before correction.
[0099] 3. Temperature estimation based on Kalman filter algorithm:
[0100] like Figure 4 As shown, Kalman filtering is an algorithm that optimizes the state of a system based on a prior model and observational data. Its core idea is to predict the system's state at the next moment using observational data and the model, given a certain understanding of the system (i.e., a grasp of the system's dynamic model). Then, at the next moment, the new observational data is corrected by the difference between the new observational data and the predicted value from the previous moment, thus obtaining the optimal estimate of the system's state at that moment.
[0101] For temperature prediction, continuous measurements can be performed while the room temperature remains approximately constant for a short period. Based on the corresponding state equation, the current measurement result is selectively absorbed using a Kalman gain K(k). If the current result differs significantly from the previous one, a weighted average of the observation and prediction is applied based on environmental and measurement noise. A larger K(k) indicates greater confidence in the new observation. The impact of occasional interference on temperature measurements should be minimized. The initial state estimate and error can be obtained experimentally.
[0102] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the above embodiments do not limit the scope of protection of the present invention in any way, and all technical solutions obtained by equivalent substitution or other means fall within the scope of protection of the present invention. Parts not covered in this invention are the same as or can be implemented using existing technology.
Claims
1. A multi-scenario correction method for measuring room temperature using a dual-channel microphone smart device, characterized in that, Includes the following steps: S1: Invokes the device's speaker to emit a sound signal; S2: Activate the device's dual-channel microphone to acquire sound signals and preprocess the raw dual-channel sound signals; specifically, follow these steps to preprocess the dual-channel signals: S2.1: Assume the length of the reserved blank paragraph in S1 is... Total signal length For the front of the received signal Peak search is performed on the segment, using peak values. Normalize the signal; blank paragraph length The length of the blank paragraph depends on the performance of the equipment and the temperature measurement environment. ; S2.2: Calculate the maximum peak value and second peak ratio A threshold was set based on the experiment. ,like If the background noise is relatively stable, then the received signal is considered to be... The signal is intercepted from the moment; if If the maximum peak value is found, it is considered that there is strong interference in the environment. The signal is intercepted after the specified time. S2.3: Noise reduction is performed on the truncated signal using an FIR bandpass filter. The passband of the filter is determined by the frequency band of the excitation signal. S2.4: Let the starting point of the cutoff in S2.2 be... ,by Using a portion of the signal as a reference, spectral subtraction is used to... Segment signal noise reduction; S2.5: Based on the previously truncated length, pad the signal with zeros of the corresponding length at the beginning, so that the length of the dual-channel signal remains the same. ; S2.6: Based on the length of the signal sequence in S2.5 Calculate the smallest positive integer. Make Pad the signal with zeros starting from the end to make the signal length . Then, upsampling is performed, and after upsampling, the signal is passed through a bandpass filter to improve computational efficiency and avoid spectral leakage. S3: Use the excitation signal and the dual-channel acoustic signal to perform cross-correlation calculations to determine the arrival sound along different paths and filter out interference signals; S4: The delay of the dual-channel microphone received signal is calculated by calculating the delay between the excitation signal and the shortest direct sound of the selected dual-channel acoustic signal; S5: Using the shortest path difference and time delay difference of sound waves, estimate the speed of sound based on the linear acoustic assumption, and derive the average temperature of the sound path based on the speed of sound. S6: For different usage environments and equipment models, a temperature measurement is performed before the first use to complete the initialization. Specifically, a temperature measurement is performed first through steps S1-S5, and then the size parameters of the equipment are deduced and the algorithm parameters are updated based on the temperature reference values obtained by other existing temperature measurement methods. Then, the updated parameters are used for subsequent temperature measurements.
2. The multi-scenario correction method for measuring room temperature based on a dual-channel microphone intelligent device according to claim 1, characterized in that, In step S1, the transmitted acoustic signal is a linear frequency modulated signal with a center frequency in the ultrasonic band above 18kHz. At the same time, a certain bandwidth is set to compensate for the frequency response difference of the equipment, and a blank segment of a certain length is designed in the beginning part.
3. The multi-scenario correction method for measuring room temperature based on a dual-channel microphone intelligent device according to claim 1, characterized in that, In steps S3-S5, let the difference in sound path length be... The time delays of the dual-channel signal and the excitation signal are respectively and Then the speed of sound in the environment is: (1)。 4. The multi-scenario correction method for measuring room temperature based on a dual-channel microphone intelligent device according to claim 3, characterized in that, The average ambient temperature along the sound path is obtained from the following formula: (2) in, , for The corresponding sound speed can be obtained by substituting the sound speed in equation (1) into equation (2).
5. The multi-scenario correction method for measuring room temperature based on a dual-channel microphone intelligent device according to claim 1, characterized in that, In the initialization of step S6, three temperature measurement scenarios are considered: the device is placed horizontally on the desktop, held vertically with one hand, and held horizontally with both hands. Different processing strategies are adopted for different scenarios.
6. The multi-scenario correction method for measuring room temperature based on a dual-channel microphone intelligent device according to claim 5, characterized in that, For a desktop in landscape orientation, after taking a temperature measurement, the external temperature reference value is used. To deduce the reference speed of sound Then, based on the delay calculated during the temperature measurement process To calculate the corrected parameters The subsequent temperature measurement process all used That's all.
7. The multi-scenario correction method for measuring room temperature based on a dual-channel microphone intelligent device according to claim 6, characterized in that, For scenarios where the device is held vertically with one hand, the same initialization method as in scenarios where the device is held horizontally on a desktop should be used. Additionally, the user's arm movement should be considered, and the data should be smoothed by using a Kalman filter algorithm to improve the accuracy of temperature estimation.
8. A multi-scenario correction method for measuring room temperature using a dual-channel microphone intelligent device according to claim 7, characterized in that, For scenarios where the device is held horizontally with both hands, the same initialization method as in scenarios where the device is held horizontally on a desktop is first used. Then, the Kalman filter algorithm is used to improve the accuracy of temperature estimation. Finally, the following fine-tuning is made based on the measurement results: ;in For the corrected temperature, The measurement results are before correction.
Citation Information
Patent Citations
Sound velocity temperature measurement method and system based on MLS signal correlation method
CN118583319A