Working method of temperature sensor testing system based on Lstm neural network
By applying the Lstm neural network to calculate and fit the temperature calibration temperature of the temperature sensor in the temperature sensor testing system, the problems of long test time, low efficiency and large error in the existing technology are solved, and high-precision and high-efficiency temperature sensor testing are achieved.
Patent Information
- Application Number
- CN202210719171.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-23
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2042-06-23
AI Technical Summary
The existing temperature sensor testing methods rely on manual operation, resulting in long test time, low efficiency and prone to human errors.
The temperature sensor testing system based on the Lstm neural network is adopted, and the test result analysis and display page is built through Labview software. The voltage of the reference temperature sensor is trained using the Lstm neural network to obtain the calibration temperature of the temperature sensor to be measured, and data fit and display are performed.
It improves the accuracy and efficiency of temperature sensor testing, reduces measurement errors, is simple and convenient to operate, and can perform multi-point temperature measurement on multiple temperature sensors at the same time.
Smart Images

Figure CN115096476B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of temperature sensor testing, and in particular relates to a working method of a temperature sensor testing system based on an Lstm neural network. Background Art
[0002] Temperature sensors realize automatic measurement, information processing and automatic control of temperature by converting non-electrical physical quantities into electrical quantities. Temperature sensors are the core part of temperature measurement equipment. However, the characteristic curve of temperature sensors will be affected by some nonlinear effects. Before mass production, temperature sensors need to be calibrated with high-precision data in large quantities to detect whether the performance indicators of the products meet the standards.
[0003] At present, the testing of temperature sensors is still mainly based on traditional single-point manual testing, which involves manually setting environmental conditions and test parameters, performing multiple measurements and data recording, and then inputting the data into analysis software for analysis. This results in long test times, low work efficiency, and the possibility of human measurement errors.
[0004] The commonly used test scheme arranges the sensor chips into a square on the test board. The test board uses 9 reference temperature sensors (such as TMP117) and 16 temperature sensors to be tested, so the ratio of test chips to reference chips is 16:9. The patent "A high-precision test device for temperature sensors arranged in a new hexagon" with publication number CN202122299276.2 arranges the temperature sensors to be tested and the reference temperature sensors into a hexagon, with a total of 7 reference temperature sensors TMP117 and 24 temperature sensors to be tested. The 7 high-precision reference temperature sensors TMP117 are located at the six vertices and the center of the equilateral hexagon, and the 24 temperature sensors to be tested are placed at the centroid of each triangle or at one-third of the distance from the vertex on the three midlines;
[0005] During the test process, the time of each manual reading and recording of data will be highly random, thus affecting the accuracy of the data. The measurement results of traditional temperature sensor test systems are generally not intuitively displayed, and further calculations are required to complete the analysis of temperature sensor performance. Summary of the invention
[0006] The purpose of the present invention is to overcome the deficiencies in the prior art and provide a working method of a temperature sensor testing system based on an Lstm neural network;
[0007] The working method of the temperature sensor testing system based on the Lstm neural network includes the following steps:
[0008] Step 1: The host computer uses Labview software on the PC to build a test result analysis and display page; the host computer sends instructions to the slave computer, and the slave computer starts working;
[0009] Step 2: After receiving the instruction from the upper computer, the lower computer reads the voltage of the reference temperature sensor and trains the Lstm neural network; the trained Lstm neural network is used to obtain the calibration temperature of the temperature sensor to be tested, and the change curve of the calibration temperature is saved;
[0010] Step 3, the single-point or multi-point switching module of the host computer selects the single-point or multi-point mode test, and after clicking the send data button, the host computer sends data to the serial communication module of the slave computer, the serial communication module reads the calibration temperature data, the slave computer enters an interrupt, and puts the voltage of the reference temperature sensor and the calibration temperature data calculated by the trained Lstm neural network into the same array; until the voltage of the reference temperature sensor and the calibration temperature data calculated by the trained Lstm neural network are all put into the array, the data in the array is uploaded to the host computer, and the slave computer returns to normal;
[0011] Step 4, after the serial communication module of the host computer completes reading the temperature data, the data fitting module of the host computer selects the data file of the point to be fitted, reads the data, performs nonlinear fitting on the data measured by the temperature sensor to be measured using the least squares method, and performs linear or nonlinear fitting on the data measured by the reference temperature sensor using the least squares method; the data measured by the temperature sensor to be measured is directly read from the temperature sensor to be measured at a certain point; the data measured by the reference temperature sensor is output based on the data read by the reference temperature sensor; the output includes the temperature data of the observation point of the best fitting model, the weighted average error (i.e., residual), polynomial coefficient, slope and intercept of the best fitting model;
[0012] Step 5. The data display module of the host computer displays the temperature, voltage, fitted curve, polynomial coefficients, temperature data of the best fitting model observation point and the weighted average error of the best fitting model corresponding to the output items obtained in step 4; the data storage module saves the read data to the specified file.
[0013] Preferably, a high-precision and efficient temperature sensor testing system based on the Lstm neural network includes a host computer, a high and low temperature chamber, a constant temperature box, a test board and a slave computer; the test board is placed in the high and low temperature chamber, and the test board is connected to the host computer through a data cable, a power cable and a power supply; the host computer includes a serial communication module, a data display module, a single-point or multi-point switching module, a data storage module and a data fitting module; a refrigeration system and a heating system are installed in the high and low temperature chamber at the same time; the test board is a PCB board containing a reference temperature sensor TMP117.
[0014] Preferably, step 2 specifically comprises the following steps:
[0015] Step 2.1, arrange the 31 reference temperature sensors on the test board into a hexagon; the lower computer receives the instruction from the upper computer, changes the output of the analog switch according to the truth table of the analog switch in the lower computer, and reads the temperature measurement values of all reference temperature sensors; the temperature measurement values of all reference temperature sensors form an array [T 1,i , T 2,i , T 3,i , T 4,i , T 5,i , T 6,i , T 7,i , T 8,i , T 9,i , T 10,i , T 11,i , T 12,i , T 13,i , T 14,i , T 15,i , T 16,i , T 17,i , T 18,i , T 19,i , T 20,i , T 21,i , T 22,i , T 23,i , T 24,i , T 25,i , T 26,i , T 27,i , T 28,i , T 29,i , T 30,i , T 31,i ], where T 1,i represents the actual temperature value of the T1 sensor during the i-th round of testing, T 31,i Represents the time of the i-th round of testing T 31 The actual temperature value of the sensor;
[0016] Step 2.2: Set the array [T 1,i , T 2,i , T 3,i , T 4,i , T 5,i , T 6,i , T 7,i , T 8,i , T 9,i , T 10,i , T 11,i , T 12,i , T 13,i , T 14,i , T 15,i , T 16,i , T 17,i , T18,i , T 19,i , T 20,i , T 21,i , T 22,i , T 23,i , T 24,i , T 25,i , T 26,i , T 27,i , T 28,i , T 29,i , T 30,i , T 31,i ] Divide it into training set and test set according to the set ratio, substitute it into Lstm neural network for training, and get the trained Lstm neural network;
[0017] The specific Lstm neural network is:
[0018]
[0019] In the above formula, c t is the cell state at the current time t, h t is the final output at the current time t, x t Represents the input of the Lstm neural network, W i , W f , W c and W o are input gate i t 、Forget gate t , the cell state c at the current time t t and output gate o t The corresponding weight matrix; U i , U f , U c and U o They are also input gate i t 、Forget gate t , the cell state c at the current time t t and output gate o t The corresponding weight matrix; b i 、b f 、b c and b o are input gate i t 、Forget gate t , the cell state c at the current time t t and output gate o t The corresponding biased vector; σ() is the sigmoid activation function, tanh() is the tanh activation function; the ⊙ operator represents partial multiplication;
[0020] After the Lstm neural network is trained, the trained algorithm matrix, weight matrix and bias vector are obtained, where the trained algorithm matrix is W i , W f , W c and W o , the trained weight matrix is U i , U f , U c and U o , the trained bias vector is b i 、b f 、b c and b o ;
[0021] Step 2.3: The temperature measurements of the seven reference temperature sensors at the vertices and center of the hexagon [T 25,i , T 26,i , T 27,i , T 28,i , T 29,i , T 30,i , T 31,i ] as the input value Tin of the trained Lstm neural network, input Tin into the trained Lstm neural network, and the trained Lstm neural network processes the input data on the host computer using the trained algorithm matrix and bias vector to calculate the calibration temperature of the location of the temperature sensor to be measured;
[0022] Step 2.4: Replace the 24 reference temperature sensors inside the hexagon with the temperature sensors to be tested, and change the measured values of the 24 reference temperature sensors inside the hexagon [T 1,i , T 2,i , T 3,i , T 4,i , T 5,i , T 6,i , T 7,i , T 8,i , T 9,i , T 10,i , T 11,i , T 12,i , T 13,i , T 14,i , T 15,i , T 16,i , T 17,i , T 18,i , T 19,i , T 20,i , T 21,i , T 22,i , T 23,i , T 24,i] as the predicted output Tout of the trained Lstm neural network; compare the calibration temperatures of the 24 temperature sensors to be tested with the predicted output Tout of the Lstm neural network corresponding to the reference temperature sensors at the same position, calculate the root mean square error RMSE between the calibration temperature and the predicted output Tout, and use the root mean square error as the evaluation indicator of the trained Lstm neural network.
[0023] Preferably, in step 2.2, the array [T 1,i , T 2,i , T 3,i , T 4,i , T 5,i , T 6,i , T 7,i , T 8,i , T 9,i , T 10,i , T 11,i , T 12,i , T 13,i , T 14,i , T 15,i , T 16,i , T 17,i , T 18,i , T 19,i , T 20,i , T 21,i , T 22,i , T 23,i , T 24,i , T 25,i , T 26,i , T 27,i , T 28,i , T 29,i , T 30,i , T 31,i ] is divided into training set and test set in a ratio of 3:1.
[0024] Preferably, the root mean square error RMSE calculation formula in step 2.3 is:
[0025]
[0026] In the above formula, n is the total number of prediction results, T pre is the predicted value, T act is the true value.
[0027] Preferably, in step 4:
[0028] The formula for linear fitting is:
[0029] f=ax+b
[0030] In the above formula, f represents the output sequence of the best polynomial linear fit, x is the input voltage data, a is the slope, and b is the intercept;
[0031] The best fitting slope value a and the best fitting intercept value b of the observation point (X, Y) are obtained through linear fitting, where X represents the voltage data input at the observation point, and Y represents the temperature data read at the observation point;
[0032] The formula for nonlinear fitting is:
[0033]
[0034] In the above formula, f i is the output sequence of the best polynomial nonlinear fit, m is the polynomial order, a j is the coefficient of the j-th polynomial, x i is the voltage data corresponding to the input of the j-th polynomial.
[0035] Preferably, in step 5, the data storage module saves the read data in the form of a txt file to a designated file.
[0036] The beneficial effects of the present invention are:
[0037] The present invention develops a high-precision, efficient, stable and highly operable temperature sensor testing system based on an STC single-chip microcomputer and Labview software. The temperature sensor to be tested and the reference temperature sensor are arranged in a hexagon, and multi-point temperature measurement can be performed on multiple temperature sensors at the same time. Since the measurement environment of the reference temperature sensor and the temperature sensor to be tested is the same, the present invention also processes the actual measured value of the reference temperature sensor TMP117 on a host computer through a machine learning Lstm neural network algorithm, and the host computer calibrates the calibration temperature to obtain the calibration temperature of the temperature sensor to be tested, and displays it in real time. Experimental results show that the temperature of the temperature sensor to be tested predicted by the Lstm neural network is relatively accurate, which solves the problem of different actual temperatures at different chip positions due to uneven heating and other problems; the accuracy and efficiency of the test are greatly improved, the measurement error is reduced, and the operation is simple and convenient.
[0038] The LSTM neural network is a special type of recurrent neural network. Each LSTM unit consists of a storage unit, an input gate, an output gate, and a forget gate. Based on the standard recurrent neural network, it solves the problem that gradients are prone to vanishing or exploding under long-distance transmission, and the problem that the neural network cannot train weights during back propagation. The experimental data is transmitted to the host computer through the STC microcontroller for real-time collection, and the collected data is saved in the background text. At the same time, the collected data can be intuitively processed and analyzed on the host computer. According to the processed data and graphics, the performance indicators of the temperature sensor to be tested can be intuitively analyzed. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 It is the logic flow chart of Lstm neural network;
[0040] Figure 2 This is a comparison diagram of the calibration temperature and the temperature to be measured obtained in Example 2 of the present invention;
[0041] Figure 3 Schematic diagram of high-precision and efficient temperature sensor testing system based on Lstm neural network;
[0042] Figure 4 It is a flow chart of data collection;
[0043] Figure 5 It is the system diagram of the lower computer;
[0044] Figure 6 This is the upper computer system diagram;
[0045] Figure 7 It is the linear and nonlinear fitting diagram of some temperature sensors to be tested;
[0046] Figure 8 It is the calculation diagram of standard temperature;
[0047] Fig. 9 FIG. 4 is a diagram showing the arrangement of sensors on the test board 4. FIG.
[0048] Description of the accompanying drawings: upper computer 1, high and low temperature box 2, constant temperature box 3, test board 4, lower computer 5. DETAILED DESCRIPTION
[0049] The present invention is further described below in conjunction with embodiments. The description of the following embodiments is only used to help understand the present invention. It should be noted that for ordinary persons in the art, without departing from the principle of the present invention, the present invention can also be modified in some ways, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
[0050] Embodiment 1
[0051] Embodiment 1 of the present application provides a Figure 3 The high-precision and high-efficiency temperature sensor test system based on the Lstm neural network shown in the figure includes a host computer 1, a high-low temperature box 2, a constant temperature box 3, a test board 4 and a lower computer 5; the test board 4 is placed in the high-low temperature box 2, and the test board 4 is connected to the host computer 1 through a data line, a power line and a power supply; the lower computer 5 and the host computer 1 are used to perform the following Figure 4 Data collection shown.
[0052] 1. If Figure 6As shown, the host computer 1 is based on the Labview software environment, including a serial communication module, a data display module, a single-point / multi-point switching module, a data storage module and a data fitting module; wherein the data fitting module includes the nonlinear fitting of the temperature sensor to be measured, and the linear or nonlinear fitting combined with the reference temperature sensor TMP117;
[0053] Second, the high and low temperature box 2 is a closed cavity, in which a refrigeration system and a heating system are installed at the same time. The refrigeration system and the heating system are electrically connected to the control system. The temperature of the high and low temperature box 2 is adjusted by the control system to control the refrigeration system and the heating system to maintain a constant temperature;
[0054] 3. Fig. 9 As shown, the test board 4 uses the temperature sensor TMP117 as the core component, and is essentially a PCB board including the reference temperature sensor TMP117. The PCB board mainly includes an analog switch ADG732, an analog switch RS2251XTSS16, a reference temperature sensor and a temperature sensor to be tested; the voltage source located in the high and low temperature box 2 supplies power to the chip on the test board 4 through a power line; the test board 4 sends the measurement data of 31 temperature sensors TMP117 to the lower computer 5 (STC single-chip microcomputer) through a multi-way analog switch, and then the lower computer 5 (STC single-chip microcomputer) sends the data to the upper computer 1 through the serial port, and finally after the upper computer 1 processes the data, the processed data is displayed and saved; the test and analysis of 24 temperature sensors TMP117 to be tested are realized.
[0055] The reference temperature sensor is TMP117, which is a high-precision digital temperature sensor with a resolution of 0.0078°C, an I2C-compatible interface, and low power consumption, which can minimize the impact of self-heating on measurement accuracy. The key parameters of TMP117 are: operating voltage 1.8V-5.5V, current consumption 3.5μA, and an accuracy of ±0.25°C within the operating voltage range of -40°C to 125°C.
[0056] The temperature sensor to be tested has an accuracy of ±3°C at room temperature and ±5°C in the range of -25°C to +125°C. The quiescent current is less than 110μA.
[0057] Analog switch ADG732 and analog switch RS2251XTSS16 are used to control the signal output of different points of the reference temperature sensor and the temperature sensor to be measured. Analog switch ADG732 connects one of 32 inputs (S1-S32) to the common output D according to the address determined by the 5-bit binary address lines A0, A1, A2, A3 and A4; the key parameters of ADG732 are: operating voltage 1.8V-5.5V, switching time 30ns, normal operation in the range of -40℃ to 125℃. Analog switch RS2251XTSS16 connects one of 8 inputs (X0-X7) to the common output X according to the address determined by the 3-bit binary address line ABC; the key parameters of RS2251XTSS16 are: operating voltage 2.5V-5.5V, switching time 65ns, normal operation in the range of -40℃ to 125℃.
[0058] 4. Figure 5 As shown, the lower computer 5 based on the STC single chip microcomputer is composed of an acquisition module, a serial port communication module with a PC, an analog switch use module, and an IIC module (to read TMP117);
[0059] Since there is air flow in the high and low temperature box 2 in actual measurement, the test board 4 will be sealed in a sealed insulation box before measurement to reduce air convection and further improve measurement accuracy.
[0060] Embodiment 2
[0061] On the basis of Example 1, Example 2 of the present application provides a working method of a high-precision and efficient temperature sensor test system based on an Lstm neural network in Example 1, wherein the measured value of the reference temperature sensor TMP117 is processed by an Lstm neural network to obtain the calibration temperature of the temperature sensor to be measured; this embodiment specifically uses the temperature returned by 31 reference temperature sensors TMP117 to calculate the calibration temperature of the location of the temperature sensor to be measured; the number of neurons is set to 20, and the number of iterations is 80 times;
[0062] The upper computer 1 uses Labview software on the PC to build a test result analysis and display page; the upper computer 1 sends instructions to the lower computer 5, and the lower computer 5 starts working;
[0063] After receiving the instruction, the lower computer 5 will read the voltage of the temperature sensor and train the Lstm neural network. According to the trained Lstm neural network, it will be converted into temperature and output to the upper computer 1. The user can see the collected temperature data on the test result analysis and display page built by Labview, and display it in the form of curves and text. It can also realize the measurement of the temperature sensor at a certain point or the cyclic measurement of all points. Finally, the temperature change curve can be saved and output as a txt file;
[0064] The lower computer 5 receives the data instruction of SBUF, and changes the output of the analog switch according to the data instruction of SBUF shown in Table 1 and Table 2 below, so as to read the voltage of the temperature sensor corresponding to a certain point, and put the voltage of the temperature sensor and the temperature data converted by the Lstm neural network in the same array; when the upper computer 1 sends data via the serial port communication, the lower computer 5 enters an interrupt, and RI becomes a high level; until the voltage of the temperature sensor and the temperature data converted by the Lstm neural network are all put into the array, the data in the array is uploaded to the upper computer 1 through a for loop, and RI becomes a low level;
[0065] Table 1 Truth table of the 32-to-1 analog switch of the lower computer
[0066]
[0067]
[0068] Table 2 Truth table of the 8-to-1 analog switch of the lower computer
[0069] Point instruction A_address B_address C_address 25 0x61 0 0 0 26 0x62 1 0 0 27 0x63 0 1 0 28 0x64 1 1 0 29 0x65 0 0 1 30 0x66 1 0 1 31 0x67 0 1 1
[0070] In Table 1 and Table 2 above, A, B, C, D, and E are used as data selection bits for the 32-to-1 analog switch, and A_address, B_address, and C_address are used as data selection bits for the 8-to-1 analog switch. 0 represents a low level and 1 represents a high level.
[0071] Based on the prior art, the present invention arranges the temperature sensor to be tested and the reference temperature sensor into a hexagon, designs a PCB board including the reference temperature sensor TMP117, takes the temperature measurement values of the 7 reference temperature sensors at the vertices and center of the hexagon as input, and takes the measurement values of the 24 reference temperature sensors located inside the hexagon as output, and obtains the data required for training the Lstm neural network;
[0072] The data required for training the Lstm neural network is processed into an array [T 1,i , T 2,i , T 3,i , T 4,i , T 5,i , T 6,i , T 7,i , T 8,i , T 9,i , T 10,i , T 11,i , T 12,i , T 13,i , T 14,i , T 15,i , T 16,i, T 17,i , T 18,i , T 19,i , T 20,i , T 21,i , T 22,i , T 23,i , T 24,i , T 25,i , T 26,i , T 27,i , T 28,i , T 29,i , T 30,i , T 31,i ], where T 1,i represents the measured value of sensor T1 in the i-th round of testing, T 31,i Represents the time of the i-th round of testing T 31 The measured value of the sensor;
[0073] The array [T 1,i , T 2,i , T 3,i , T 4,i , T 5,i , T 6,i , T 7,i , T 8,i , T 9,i , T 10,i , T 11,i , T 12,i , T 13,i , T 14,i , T 15,i , T 16,i , T 17,i , T 18,i , T 19,i , T 20,i , T 21,i , T 22,i , T 23,i , T 24,i , T 25,i , T 26,i , T 27,i , T 28,i , T 29,i , T 30,i , T 31,i ] is divided into training set and test set according to 75%:25%, and substituted into Lstm neural network for training to obtain the trained Lstm neural network; Figure 1 As shown, in the Lstm neural network, the input gate i t Determine the information retention, output gate o t Determines the information output of the storage unit, the forget gate f tDelete unnecessary information; finally, use a fully connected neural network to calculate the algorithm matrix and bias vector of the calibration temperature of the temperature sensor to be tested, thereby improving the accuracy of the test system;
[0074] In the experiment, the root mean square error (RSE) is used as the evaluation index of the trained Lstm neural network. The smaller the RMSE value, the more accurate the prediction of the trained Lstm neural network. The RMSE calculation formula is as follows:
[0075]
[0076] In the above formula, n is the total number of prediction results, T pre is the predicted value, T act is the true value.
[0077] In the subsequent measurement process, the 24 reference temperature sensors located inside the hexagon are replaced with the temperature sensors to be tested, and the temperature values of the 7 reference temperature sensors located at the vertices and center of the hexagon are first obtained [T 25,i , T 26,i , T 27,i , T 28,i , T 29,i , T 30,i , T 31,i ], [T 25,i , T 26,i , T 27,i , T 28,i , T 29,i , T 30,i , T 31,i ] as the input value Tin of the trained Lstm neural network, and input the temperature value Tin of the reference temperature sensor into the trained Lstm neural network;
[0078] The upper computer uses the trained Lstm neural network to use the trained algorithm matrix (W i , W f , W c , W o and U i , U f , U c , U o weight matrix) and bias vector (b i , b f , b c , b o ) processes the input data and finally outputs it as h tThe calibration temperature of the location of the temperature sensor to be tested is calculated by outputting the calibration temperature in the way of output; the ratio of the chip to be tested and the reference temperature sensor chip in the test plan is 24:7. Finally, the calibration temperature data of 7 reference chips are used to calibrate the 24 temperature sensors to be tested, which greatly improves the efficiency and reduces the application cost in the practice process; the Lstm neural network is specifically:
[0079]
[0080] like Figure 1 As shown, c t is the cell state at the current time t, h t is the final output at the current time t, and is also the key to the Lstm neural network, used to transmit information between different cells; x t Represents the input of the Lstm neural network, W i , W f , W c and W o are input gate i t 、Forget gate t , the cell state c at the current time t t and output gate o t The corresponding weight matrix; U i , U f , U c and U o They are also input gate i t 、Forget gate t , the cell state c at the current time t t and output gate o t The corresponding weight matrix; b i , b f , b c and b o are input gate i t 、Forget gate t , the cell state c at the current time t t and output gate o t The corresponding biased vector; σ() is the sigmoid activation function, tanh() is the tanh activation function; the ⊙ operator represents partial multiplication.
[0081] After the trained Lstm neural network is used for machine learning, the algorithm matrix (trained W i , W f , W c , W o and U i , U f , U c , U o weight matrix) and bias vector (bi , b f , b c , b o ), obtain the calibration temperature of the temperature sensor to be measured;
[0082] [T 1,i , T 2,i , T 3,i , T 4,i , T 5,i , T 6,i , T 7,i , T 8,i , T 9,i , T 10,i , T 11,i , T 12,i , T 13,i , T 14,i , T 15,i , T 16,i , T 17,i , T 18,i , T 19,i , T 20,i , T 21,i , T 22,i , T 23,i , T 24,i ] as the predicted output Tout of the trained Lstm neural network;
[0083] Compare the calibration temperature of the temperature sensor to be measured with the predicted output Tout of the Lstm neural network corresponding to the temperature sensor to be measured at the same position, and obtain the following: Figure 2 The results shown in the figure show that the predicted value curve represents the temperature value calculated by the trained Lstm neural network, and the true value curve represents the temperature value output by the temperature sensor TMP117 at the same position; the calculated result RMSE is equal to 0.876. This shows that the temperature calibration method of the high-precision and efficient temperature sensor test system based on the Lstm neural network adopted by the present invention has a relatively small error.
[0084] The saved calibration temperature change curve will be directly used in the subsequent experimental result analysis, such as fitting curve, to obtain the performance index of the temperature sensor;
[0085] The single-point / multi-point switching module of the host computer 1 selects the single-point or multi-point mode test as needed. After clicking the send data button, wait for the serial communication module to automatically read the temperature data. The reading buffer of the data display module will continuously display data, waveform table and curve chart, and the data storage module will automatically save the read data to the specified file.
[0086] After the serial communication module finishes reading the temperature data, the data fitting module selects the data file of the point to be fitted, reads the data, performs nonlinear fitting on the data measured by the temperature sensor to be measured, and performs linear or nonlinear fitting on the data measured by the reference temperature sensor TMP117;
[0087] The data measured by the temperature sensor to be measured is directly read from the temperature sensor to be measured at a certain point;
[0088] The data measured by the reference temperature sensor TMP117 is based on the data read by the reference temperature sensor TMP117, and then the temperature data of a certain point is calculated, which is also called the standard temperature; Figure 8 As shown, for the reference temperature sensor S0, according to the central principle, the calibration temperature of this point is (T0+T1+T2) / 3, and for the reference temperature sensors S1, S2 and S3, because S1, S2 and S3 are all located at the 1 / 3 point of the center line, according to different weight ratios, the position of S3 is close to that of T0, so the weight of T0 is higher, and so on; it is deduced that S3=2 / 3*T0+1 / 6*T1+1 / 6*T2, similarly, S1=2 / 3*T1+1 / 6*T0+1 / 6*T2, S2=2 / 3*T2+1 / 6*T0+1 / 6*T1.
[0089] Both linear fitting and nonlinear fitting use the least squares method;
[0090] The formula for linear fitting is:
[0091] f=ax+b
[0092] In the above formula, f represents the output sequence of the best polynomial linear fit, x is the input voltage data, a is the slope, and b is the intercept; the best fitting a and b values of the observation point (X, Y) are obtained through the above linear fitting formula, where X represents the input voltage data of the observation point, and Y represents the read temperature data of the observation point. The value of a that can best fit the observation point (X, Y) is found through the above formula.
[0093] The formula for nonlinear fitting is:
[0094]
[0095] In the above formula, f i is the output sequence of the best polynomial nonlinear fit, m is the polynomial order, a j is the coefficient of the j-th polynomial, x i is the voltage data corresponding to the input of the j-th polynomial;
[0096] After the above linear fitting or nonlinear fitting, the output items include the Y value of the best fitting model, the residual (the weighted average error of the fitting model), the polynomial coefficient, the slope, and the intercept;
[0097] The data display module displays the temperature, voltage, and fitted curves (such as Figure 7 The corresponding polynomial coefficients, Y values of the best fitting model, and residuals are displayed. Figure 7 The nonlinear fitting curve is: y3 = 0.000028x 2 + 0.010422x + 0.264438, the linear fitting curve is y2 = 0.006024x + 0.426903, and the voltage-temperature theoretical curve is y1 = 0.00625x + 0.424;
[0098] The experimental results of this embodiment show that the test system can display the collected data in real time under the working conditions of -40℃~125℃. The accuracy of the temperature sensor to be tested is low, and the output temperature will fluctuate by 3℃. However, as a high-precision digital temperature sensor, TMP117 has an output temperature fluctuation of only 0.5℃. At the same time, the temperatures output by the 24 temperature sensors to be tested are not much different, and the same is true for the 7 reference temperature sensors TMP117. Through machine learning of the Lstm neural network, the accuracy of the temperature sensor to be tested is obtained to be ±5℃. And by fitting the linear and nonlinear graphs of the temperature sensor to be tested, it is obtained that the nonlinearity of the temperature sensor to be tested is ±0.8, and the gain is 6.06mV / ℃~6.44mV / ℃.
[0099] The above experimental results show that the temperature of the temperature sensor to be tested predicted by the Lstm neural network is relatively accurate, which solves the problem of different actual temperatures caused by uneven heating at different chip positions; the experimental data is transmitted to the host computer through the STC microcontroller for real-time collection, and the collected data is saved in the background text. At the same time, the collected data can be intuitively processed and analyzed on the host computer. According to the processed data and graphics, the performance indicators of the temperature sensor to be tested can be intuitively analyzed.
Claims
1. The working method of the temperature sensor test system based on the Lstm neural network is characterized in that: A high-precision and high-efficiency temperature sensor test system based on an LSTM neural network comprises a host computer (1), a high-low temperature box (2), a constant temperature box (3), a test board (4) and a slave computer (5); the test board (4) is placed in the high-low temperature box (2), and the test board (4) is connected to the host computer (1) via a data line, a power line and a power supply; the host computer (1) comprises a serial communication module, a data display module, a single-point or multi-point switching module, a data storage module and a data fitting module; a refrigeration system and a heating system are installed in the high-low temperature box (2); the test board (4) is a PCB board including a reference temperature sensor TMP117; and the following steps are included: Step 1, the host computer (1) uses Labview software on the PC to build a test result analysis and display page; the host computer (1) sends instructions to the slave computer (5), and the slave computer (5) starts working; Step 2, after receiving the instruction from the upper computer (1), the lower computer (5) reads the voltage of the reference temperature sensor and trains the Lstm neural network; uses the trained Lstm neural network to obtain the calibration temperature of the temperature sensor to be tested, and saves the change curve of the calibration temperature; Step 3, the single-point or multi-point switching module of the upper computer (1) selects the single-point or multi-point mode test, and after clicking the send data button, the upper computer (1) sends data to the serial communication module of the lower computer (5), the serial communication module reads the calibration temperature data, the lower computer (5) enters an interrupt, and puts the voltage of the reference temperature sensor and the calibration temperature data calculated by the trained Lstm neural network into the same array; until the voltage of the reference temperature sensor and the calibration temperature data calculated by the trained Lstm neural network are all put into the array, the data in the array is uploaded to the upper computer (1), and the lower computer (5) returns to normal; Step 4, after the serial communication module of the host computer (1) completes reading the temperature data, the data fitting module of the host computer (1) selects the data file of the point to be fitted, performs data reading, uses the least square method to perform nonlinear fitting on the data measured by the temperature sensor to be measured, and uses the least square method to perform linear or nonlinear fitting on the data measured by the reference temperature sensor; the data measured by the temperature sensor to be measured is directly read from the temperature sensor to be measured at a certain point; the data measured by the reference temperature sensor is output based on the data read from the reference temperature sensor; the output includes the temperature data of the observation point of the best fitting model, the weighted average error, polynomial coefficients, slope and intercept of the best fitting model; Step 5, the data display module of the host computer (1) displays the temperature, voltage, fitted curve, polynomial coefficients, temperature data of the best fitting model observation point and the weighted average error of the best fitting model corresponding to the output items obtained in step 4; the data storage module saves the read data to a specified file.
2. The working method of the temperature sensor testing system based on the Lstm neural network according to claim 1 is characterized in that: Step 2 specifically includes the following steps: Step 2.1, 31 reference temperature sensors on the test board (4) are arranged into a hexagon; the lower computer (5) receives the instruction sent by the upper computer (1), changes the output of the analog switch according to the truth table of the analog switch in the lower computer (5), and reads the temperature measurement values of all reference temperature sensors; The temperature measurements of all reference temperature sensors form an array [T 1,i , T 2,i , T 3,i , T 4,i , T 5,i , T 6,i , T 7,i , T 8,i , T 9,i , T 10,i , T 11,i , T 12,i , T 13,i , T 14,i , T 15,i , T 16,i , T 17,i , T 18,i , T 19,i , T 20,i , T 21,i , T 22,i , T 23,i , T 24,i , T 25,i , T 26,i , T 27,i , T 28,i , T 29,i , T 30,i , T 31,i ], where T 1,i represents the actual temperature value of the T1 sensor during the i-th round of testing, T 31,i Represents the time of the i-th round of testing T 31 The actual temperature value of the sensor; Step 2.2: Set the array [T 1,i , T 2,i , T 3,i , T 4,i , T 5,i , T 6,i , T 7,i , T 8,i , T 9,i , T 10,i , T 11,i , T 12,i , T 13,i , T 14,i , T 15,i , T 16,i , T 17,i , T 18,i , T 19,i , T 20,i , T 21,i , T 22,i , T 23,i , T 24,i , T 25,i , T 26,i , T 27,i , T 28,i , T 29,i , T 30,i , T 31,i ] Divide it into training set and test set according to the set ratio, substitute it into Lstm neural network for training, and get the trained Lstm neural network; The specific Lstm neural network is: In the above formula, c t is the cell state at the current time t, h t is the final output at the current time t, x t Represents the input of the Lstm neural network, W i , W f , W c and W o are input gate i t 、Forget gate t , the cell state c at the current time t t and output gate o t The corresponding weight matrix; U i , U f , U c and U o They are also input gate i t 、Forget gate t , the cell state c at the current time t t and output gate o t The corresponding weight matrix; b i , b f , b c and b o are input gate i t 、Forget gate t , the cell state c at the current time t t and output gate o t The corresponding biased vector; σ() is the sigmoid activation function, tanh() is the tanh activation function; the ⊙ operator represents partial multiplication; After the Lstm neural network is trained, the trained algorithm matrix, weight matrix and bias vector are obtained, where the trained algorithm matrix is W i , W f , W c and W o , the trained weight matrix is U i , U f , U c and U o , the trained bias vector is b i , b f , b c and b o ; Step 2.3: The temperature measurement values of the seven reference temperature sensors at the vertices and center of the hexagon [T 25,i , T 26,i , T 27,i , T 28,i , T 29,i , T 30,i , T 31,i ] as the input value Tin of the trained Lstm neural network, input Tin into the trained Lstm neural network, and the trained Lstm neural network processes the input data on the host computer using the trained algorithm matrix and bias vector to calculate the calibration temperature of the location of the temperature sensor to be measured; Step 2.4, replace the 24 reference temperature sensors inside the hexagon with the temperature sensors to be tested, and change the measured values of the 24 reference temperature sensors inside the hexagon [T 1,i , T 2,i , T 3,i , T 4,i , T 5,i , T 6,i , T 7,i , T 8,i , T 9,i , T 10,i , T 11,i , T 12,i , T 13,i , T 14,i , T 15,i , T 16,i , T 17,i , T 18,i , T 19,i , T 20,i , T 21,i , T 22,i , T 23,i , T 24,i ] as the predicted output Tout of the trained Lstm neural network; compare the calibration temperatures of the 24 temperature sensors to be tested with the predicted output Tout of the Lstm neural network corresponding to the reference temperature sensors at the same position, calculate the root mean square error RMSE between the calibration temperature and the predicted output Tout, and use the root mean square error as the evaluation indicator of the trained Lstm neural network.
3. The working method of the temperature sensor testing system based on the Lstm neural network according to claim 2 is characterized in that: In step 2.2, the array [T 1,i , T 2,i , T 3,i , T 4,i , T 5,i , T 6,i , T 7,i , T 8,i , T 9,i , T 10,i , T 11,i , T 12,i , T 13,i , T 14,i , T 15,i , T 16,i , T 17,i , T 18,i , T 19,i , T 20,i , T 21,i , T 22,i , T 23,i , T 24,i , T 25,i , T 26,i , T 27,i , T 28,i , T 29,i , T 30,i , T 31,i ] is divided into training set and test set in a ratio of 3:
1.
4. The working method of the temperature sensor testing system based on the Lstm neural network according to claim 2 is characterized in that: The root mean square error RMSE calculation formula in step 2.4 is: In the above formula, n is the total number of prediction results, T pre is the predicted value, T act is the true value.
5. The working method of the temperature sensor testing system based on the Lstm neural network according to claim 1 is characterized in that: In step 4: The formula for linear fitting is: f=ax+b In the above formula, f represents the output sequence of the best polynomial linear fit, x is the input voltage data, a is the slope, and b is the intercept; The best fitting slope value a and the best fitting intercept value b of the observation point (X, Y) are obtained through linear fitting, where X represents the voltage data input at the observation point, and Y represents the temperature data read at the observation point; The formula for nonlinear fitting is: In the above formula, f i is the output sequence of the best polynomial nonlinear fit, m is the polynomial order, a j is the coefficient of the j-th polynomial, x i is the voltage data corresponding to the input of the j-th polynomial.
6. The working method of the temperature sensor testing system based on the Lstm neural network according to claim 1 is characterized in that: In step 5, the data storage module saves the read data in the form of a txt file to a specified file.
Citation Information
Patent Citations
Novel high-precision testing device for hexagonally-arranged temperature sensors
CN215893841U
Thermosensitive thermometer calibration method based on neural network
CN107063509A
TBM scraper service life prediction system and method based on real-time monitoring
CN111337234A