# Design of temperature sensor based on ultrasonic technology

With the application of ultrasonic detection technology, temperature measurement has the advantages of fast speed, high precision and large measuring range. Based on the characteristics that ultrasonic propagation speed changes with temperature in the medium, FPGA with NIOS soft core is used as the hardware circuit control core to realize high-speed real-time data acquisition, and the software subdivision interpolation algorithm is used to realize the accurate measurement of ultrasonic propagation time. Through theoretical derivation and experiment, the designed ultrasonic temperature sensor can achieve high precision and high resolution temperature measurement, the propagation time reaches ns level, and the resolution is better than 0.001℃.

**0 Introduction**

Temperature is a basic physical phenomenon and is the most common and important process parameter in the production process. Temperature sensors are one of the most commonly used sensors in modern test and industrial process control. At present, major temperature sensors, such as thermocouples, thermal resistance and radiation thermometers and other technologies are mature, and each has its own advantages. For example, thermocouples have the widest measurable temperature range, thermal resistors have the best measurement linearity, and thermistors have the highest measurement accuracy. But they do not meet the requirements of many fields, especially high-tech ones. Therefore, experts from various countries are developing various new temperature sensors and special practical measurement techniques.

Ultrasonic wave has the characteristics of high and low temperature propagation above 3 000℃, and theoretically ultrasonic temperature measurement is not limited by temperature. In many solids and liquids, sound velocity changes with temperature. The rate of sound velocity change in solids is the largest at high temperature, and the rate of sound velocity change in gases is the largest at low temperature. The ultrasonic frequency is very high, which can effectively avoid the mixing noise in the measurement, so that the measurement accuracy is significantly improved, and the directional property of the ultrasonic wave is good, which can minimize the interference and reflection of the sound wave, and meet the requirements of accurate measurement. Therefore, it is necessary to use ultrasonic technology to study high-precision ultrasonic temperature sensor.

**1 Principle of ultrasonic temperature sensor**

Ultrasonic temperature sensor is a kind of sensor developed by using the characteristics of ultrasonic wave. Ultrasonic wave refers to the mechanical wave with a frequency higher than 20kkh z generated by the vibration of the energy exchange chip under voltage excitation. It has the characteristics of high frequency, short wavelength, small diffraction phenomenon, good directivity and so on, and can become a ray and directional propagation. It can minimize the interference and reflection of sound waves and meet the requirements of accurate measurement.

The ultrasonic temperature sensor takes the medium itself as the sensitive element. When measuring temperature, the temperature of the measured medium can be measured indirectly by measuring the propagation speed of the ultrasonic wave in the measured medium.

The propagation of ultrasonic waves in an ideal gas can be considered as an adiabatic process, and its propagation speed V is

From the relation between velocity and propagation time (= d/T) :

Where: R is the gas constant; r is the ratio of specific heat capacity at constant pressure to specific heat capacity at constant volume, r= cD/c; M is the molecular mass; d is the ultrasonic propagation distance; Is the ultrasonic propagation time; p is gas molecular density and gas pressure; Q is the absolute temperature.

For air, the most sensitive factor affecting the speed of sound is temperature, and the relationship between the two is as follows:

The wave signal is sent out by the fixed time excitation ultrasonic energy converter, and the received signal is collected in time, and then the ultrasonic propagation time is analyzed by the collected data, so as to obtain the ultrasonic propagation speed. By replacing the medium inside the ultrasonic temperature sensor, the measurement of different precision and range can be achieved.

**2.2 Hardware circuit design of ultrasonic temperature sensor**

The design of sensor hardware circuit plays an important role in the design of ultrasonic temperature sensor. The rationality of the design directly affects the reliability of the system operation, and the performance of the circuit is the most fundamental guarantee for the ultrasonic temperature sensor to achieve high resolution and high precision.

**2. 2. 1. Signal processing circuit design**

The signal processing circuit of the high-precision ultrasonic temperature sensor is based on the hardware design of FPGA, as shown in Figure 2, including the drive circuit of the energy converter, the amplifier circuit, the filter circuit, the A/D conversion circuit, the D/A conversion circuit and the FPGA control circuit. There are also high-speed data acquisition control, sine signal generator, channel switching control logic, IO processor and human-computer interaction circuit.

**2.2.2 Drive power supply design**

The ultrasonic signal must reach a certain amplitude and frequency to produce the required ultrasonic signal, the ultrasonic transducer will effectively convert the collected signal into an electrical signal, because the signal will attenuate during the propagation process, it needs to be further filtered and amplified to make the signal meet the needs of measurement. At the same time, in order to develop a wider measuring range and higher precision ultrasonic temperature sensor, the transducer can be changed at any time, and the ultrasonic propagation frequency can be adjusted, so an adjustable ultrasonic drive circuit is designed to meet the measurement needs. Figure 3 is a picture of the drive power frame.

**2.2.3 FPG A and A/D conversion circuit selection**

Because the propagation speed of ultrasonic wave in the medium is fast and the propagation time is very short, this puts forward high requirements for data acquisition in the ultrasonic signal processing circuit, and to ensure that the accuracy of time measurement reaches ns level, or even higher than ns level. The design of ultrasonic data acquisition system is the core part of the design of ultrasonic temperature sensor, so it is necessary to choose the required FPGA chip and A/D conversion circuit to build the data acquisition system, in order to achieve the purpose of high-speed, high-resolution real-time data acquisition.

The FPGA adopts cyclone series EP2C5T 14418 devices. Its interior includes 2 phase-locked loops, 8 global clock networks, 4 608 programmable logic units, the highest output rate of up to 622 M bit/s, I/O ports are rich, which is very convenient for the future expansion of ultrasonic temperature sensor functions. And do not need to change the hardware circuit to achieve some of the system needs to work.

In the design, special attention should be paid to the digital output of the A/D conversion circuit to be well isolated from the analog input, and the pin spacing between the amplifier circuit and the A/D conversion circuit should be within 2m m. A/D adopts 12-bit dual channel, pipeline connection, low power consumption, ADC12DL080 device, sampling frequency 80 m Ps_oJ. The schematic diagram of the circuit is shown in Figure 4.

**3 Software algorithm design of ultrasonic temperature sensor**

Software design will program the system to complete the analysis and processing of the collected data. The core part is the accurate measurement algorithm of ultrasonic propagation time.

**3.1. Accurate measurement algorithm of propagation time**

The measurement accuracy of ultrasonic propagation time directly affects the measurement accuracy of temperature, so the accurate measurement algorithm of ultrasonic propagation time is the core part of software design of ultrasonic temperature measurement system. The accurate measurement of ultrasonic propagation time is to measure the time used by the ultrasonic transducer from transmission to reception. Since the signal is generated by a sine wave signal generator based on the dds principle, the phase accumulator of the dds is 22 bits, and the signal resolution is as high as 23 for the 1m hz.84 ps ultrasonic signal, so the starting time point can be clearly determined. However, the waveform of the echo signal is collected by A/D converter of 40 M hz, and there is a large time interval between the collected data, so the measurement of the collection point cannot reach high precision. Therefore, it is necessary to subdivide the waveform to achieve a high precision propagation time measurement.

Figure 4 Circuit schematic diagram of adc12dl080

**3.2 Software subdivision interpolation algorithm**

The accurate measurement of the propagation time depends on the accuracy of the propagation end point. Using soft subdivision interpolation technique to realize time subdivision, the measured propagation time resolution can reach ns level. Figure 5 shows a schematic of the software segmentation.

Figure 5. Principle diagram of soft and fine division

Firstly, by comparing A/D sampling points point by point, the maximum value of sampling points is found out, and the characteristic value waveform with the largest amplitude is determined. Secondly, through the search and comparison algorithm, it is determined that the sampling point P before and the sampling point P + 1 after the zero crossing corresponding to the end point of ultrasonic transmission time. Obviously, the sampling value of the sampling point P in the characteristic wave is greater than zero, and the sampling point P + 1 is less than zero. Finally, taking the time corresponding to the sampling point P and P + 1 as the reference, the subdivision interpolation algorithm is used to accurately calculate the time corresponding to the zero point P n.

In a small area near the zero crossing, the waveform of the sine wave is close to a straight line, and T2 can be determined according to the method of linear interpolation:

Then the time corresponding to the zero crossing can be calculated, so as to calculate the time corresponding to the end of the ultrasonic transmission time:

Through theoretical analysis and experimental proof, the resolution of ultrasonic transmission time measured by this method can reach 0. 122 ns, the repeatability of the measurement is within 1 nS.

**4 Experimental Research**

**4. Experimental research on resolution**

The accuracy of ultrasonic temperature sensor depends entirely on the measurement of ultrasonic propagation speed. In this paper, the measurement of speed is converted into the measurement of ultrasonic propagation time at a fixed distance. According to the analysis, theoretically the measured propagation time can reach as level. Experiments are carried out to verify whether the actual data can satisfy the measurement of ns ultrasonic propagation time.

Assuming that the temperature is stable at 25 ° C during this period, the standard propagation time of ultrasonic propagation can be its average 225 403. As can be seen from Figure 6, most of the difference between the propagation time and the standard value is within -t-O.5 ns, and only a few data errors are greater than this value, and the maximum error is about 1ns. Although it fails to reach the theoretical resolution of 0.122 ns, the error is still at the ns level. Meet the expected conditions of sensor design.

**4.2 Experimental analysis of the relationship between time and temperature**

The relation curve between ultrasonic propagation medium temperature and ultrasonic propagation time is shown in FIG. 7. The values of points on the curve are the average values of 6 propagation time data at the same temperature. As can be seen from FIG. 7, ultrasonic propagation time decreases with the increase of ambient temperature. It corresponds to one ambient temperature.

Figure 6. Plot of propagation time

FIG. 7 Relationship between temperature and transmission time

**5 Conclusions**

A supersonic sensor is designed based on the principle that the propagation velocity of ultrasonic wave changes with temperature in the medium. By measuring the propagation of supersonic wave at a fixed distance, the temperature of the medium is measured indirectly. FPGA is used as the core of the hardware circuit to control the signal, and the subdivision interpolation algorithm is used in NIO S to process the signal, which can accurately stimulate and collect the signal, so as to realize the automatic acquisition of effective echo signal, and greatly improve the range of ultrasonic temperature measurement. The theoretical resolution of ultrasonic transmission time is as high as 0. 122 ns, is conducive to the realization of high precision temperature measurement, through the experiment also verified that the ultrasonic propagation time reached the ns level, can achieve a resolution of better than 0.001 ℃.

**References:**

[1] Lv Fangyao, Zhang Chijun, Run Yong, et al. Research on a class of high precision temperature measurement techniques. Electronic Measurement Technology, 20, 11,34 (8) : 88-9O.

[2] Zhu Xiaoxu, Zhou Xiuwen. A temperature sensor. Electronic Measurement Technology, 2013, 3 (5) : 44-45.

[3] Zhang Xing-Hong, CAI Wei, Xiang Feng-yun, et al. Precision ultrasonic temperature measuring instrument design. Instrument Technology and Transducers, 20 11(6) : 31 -- 33.

[4] CAI Wei, Liu Shuxiang, Xiang Fengyun, et al. Design of high precision ultrasonic thermometer based on FPGA. Application of Electronic Technology, 20, 11,37 (8) : 10-12.

[5] Lin Lijun. Application of FPGA in ultrasonic gas body temperature measurement. Chinese Journal of Sensor Technology, 2005, 18 (2) : 347-34 9.

[6] Zhang Xinghong, Zhang Hui, Wang Xianquan, et al. Design of A/D conversion circuit of ultrasonic flowmeter based on A R M. Automation and Instrumentation, 20 10 (11) : 18-26.

[7] Ruan Jian Fu. A device for measuring the propagation time of ultrasonic waves. Automation Instrument, 200 6, 27(3) : 35-38. (in Chinese)