144:8·Wan et al. If the environment is homogeneous in temperature,using the sum of rAB and TBA increases the temperature sensitivity of the system,because the same temperature changes will cause larger ToF changes in longer distance If the environment is not homogeneous in temperature,paths passing along different temperature regions can help us to reconstruct the temperature distribution discussed in Section 5. Since we only use half of the baseband frequency bins for each transmitter,the final CIR will have two repeated peaks,as shown in Fig.2(c).For the device using the even subcarriers,the DC component is not zero and the two peaks are completely the same in both phase and amplitude so that we can use either part for position and phase measurement.For the device using odd subcarriers,the DC component is zero,so the phase for the first peak and the second peak has a phase difference of To find the right peak,the device using odd subcarriers first transmits several OFDM frames with full bandwidth to estimate the right delay which,according to our observation,only incurs hundreds of millisecond delay before returning the right temperature result.And the detailed demodulation process is shown in Algorithm 2 and the essential steps of whole signal process is shown in Fig.2. Algorithm 2:Received signal demodulation Result:The interpolated time-domain cir[n]. 1 Perform FFT on zcR[n]to get ZCR[n]. 2 CIRoasebend(n ZCNx ZCbasebanaln]. 3 Generate an all-zero sequence CIR[n]with length Nx L. 4CIR[Y-Ns二:y+Ng]=CIRpaseband[m. s CIR[n]fft_shift (CIR[n]) 6 Perform IFFT on CIR[n]to the time domain cir[n] 3.5 Engineering Details and Discussions For implementation in real acoustic devices,there are some details and discussions need mentioning: Streaming mode.We use the streaming control mode for audio playback and recording.The data is periodically put into/get from the playing/recording buffers,which means the recording and playback delays stay the same after the stream starts.Switching from full sequence to odd sequence will not change these delays during one measurement session.For each temperature measurement session,we restart the playback/recording,which introduces unknown delays.However,such delays can be canceled using Eq.(6) so that our ToF results are consistent across different sessions. Influence of multipath.Due to the limited bandwidth of commercial acoustic devices,the correlation peaks corresponding to paths with close ToF(less than 30 cm in distance)will merge together to form a new peak.In this condition,we cannot distinguish neither peaks'index and phase.Wider bandwidth and longer frame length can reach a higher path resolution and further mitigate this impact.There are also solutions to separate the merged paths with deep learning methods,e.g,using Neural Network to get the right peak location and distance measurement [40,41].However,both attempts still cannot separate all the echoes.As we utilize multiple paths to perform measurement,we choose to ignore paths that are interfered by nearby multipath and only use those clean paths to reduce the complexity of our system. Clock drifts.Different devices with separate clocks will experience clock drifts between each others.The offset will be added in the unknown transmitting and receiving delays which can be canceled along with the delays.Our experiment in Section 6.2 shows that our system can stably measure ToF with drifts less than 0.5 us for 8 hours. Proc.ACM Interact.Mob.Wearable Ubiquitous Technol.,Vol.6,No.3,Article 144.Publication date:September 2022.144:8 • Wan et al. If the environment is homogeneous in temperature, using the sum of 𝜏𝐴𝐵 and 𝜏𝐵𝐴 increases the temperature sensitivity of the system, because the same temperature changes will cause larger ToF changes in longer distance. If the environment is not homogeneous in temperature, paths passing along different temperature regions can help us to reconstruct the temperature distribution discussed in Section 5. Since we only use half of the baseband frequency bins for each transmitter, the final CIR will have two repeated peaks, as shown in Fig. 2(c). For the device using the even subcarriers, the DC component is not zero and the two peaks are completely the same in both phase and amplitude so that we can use either part for position and phase measurement. For the device using odd subcarriers, the DC component is zero, so the phase for the first peak and the second peak has a phase difference of 𝜋. To find the right peak, the device using odd subcarriers first transmits several OFDM frames with full bandwidth to estimate the right delay which, according to our observation, only incurs hundreds of millisecond delay before returning the right temperature result. And the detailed demodulation process is shown in Algorithm 2 and the essential steps of whole signal process is shown in Fig. 2. Algorithm 2: Received signal demodulation Result: The interpolated time-domain 𝑐𝑖𝑟[𝑛]. 1 Perform FFT on 𝑧𝑐𝑅 [𝑛] to get 𝑍𝐶𝑅 [𝑛]. 2 𝐶𝐼𝑅𝑏𝑎𝑠𝑒𝑏𝑎𝑛𝑑 [𝑛] ⇐ 𝑍𝐶𝑅 [ 𝑓𝑐𝐿 𝑓𝑠 − (𝑁𝑧𝑐−1) 2 : 𝑓𝑐𝐿 𝑓𝑠 + (𝑁𝑧𝑐−1) 2 ] × 𝑍𝐶∗ 𝑏𝑎𝑠𝑒𝑏𝑎𝑛𝑑 [𝑛]. 3 Generate an all-zero sequence 𝐶𝐼𝑅[𝑛] with length 𝑁 × 𝐿. 4 𝐶𝐼𝑅[ 𝑁 𝐿 2 − 𝑁𝑧𝑐−1 2 : 𝑁 𝐿 2 + 𝑁𝑧𝑐−1 2 ] ⇐ 𝐶𝐼𝑅𝑏𝑎𝑠𝑒𝑏𝑎𝑛𝑑 [𝑛]. 5 𝐶𝐼𝑅[𝑛] ⇐ 𝑓 𝑓 𝑡_𝑠ℎ𝑖 𝑓 𝑡 (𝐶𝐼𝑅[𝑛]) 6 Perform IFFT on 𝐶𝐼𝑅[𝑛] to the time domain 𝑐𝑖𝑟[𝑛]. 3.5 Engineering Details and Discussions For implementation in real acoustic devices, there are some details and discussions need mentioning: • Streaming mode. We use the streaming control mode for audio playback and recording. The data is periodically put into/get from the playing/recording buffers, which means the recording and playback delays stay the same after the stream starts. Switching from full sequence to odd sequence will not change these delays during one measurement session. For each temperature measurement session, we restart the playback/recording, which introduces unknown delays. However, such delays can be canceled using Eq. (6) so that our ToF results are consistent across different sessions. • Influence of multipath. Due to the limited bandwidth of commercial acoustic devices, the correlation peaks corresponding to paths with close ToF (less than 30 𝑐𝑚 in distance) will merge together to form a new peak. In this condition, we cannot distinguish neither peaks’ index and phase. Wider bandwidth and longer frame length can reach a higher path resolution and further mitigate this impact. There are also solutions to separate the merged paths with deep learning methods, e.g., using Neural Network to get the right peak location and distance measurement [40, 41]. However, both attempts still cannot separate all the echoes. As we utilize multiple paths to perform measurement, we choose to ignore paths that are interfered by nearby multipath and only use those clean paths to reduce the complexity of our system. • Clock drifts. Different devices with separate clocks will experience clock drifts between each others. The offset will be added in the unknown transmitting and receiving delays which can be canceled along with the delays. Our experiment in Section 6.2 shows that our system can stably measure ToF with drifts less than 0.5 𝜇𝑠 for 8 hours. Proc. ACM Interact. Mob. Wearable Ubiquitous Technol., Vol. 6, No. 3, Article 144. Publication date: September 2022