Temperature compensation method and system of pressure sensor
By combining hardware compensation and RNN neural network methods, the measurement error problem of pressure sensors when temperature changes is solved, high-precision temperature compensation is achieved, reducing costs and improving adaptability.
Patent Information
- Application Number
- CN202411513709.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-02-25
AI Technical Summary
Existing pressure sensors will cause voltage output to change when temperature changes, resulting in measurement errors. The existing hardware compensation methods have low compensation accuracy, while the software compensation methods are complex and have high calculation costs.
The comprehensive method of hardware compensation and RNN neural network is adopted to initially reduce the temperature impact through hardware compensation, and then the RNN neural network model is used for software compensation. Through training and optimization of model parameters, high-precision temperature compensation is achieved.
It improves the temperature compensation accuracy of the pressure sensor, reduces measurement errors, reduces hardware costs, and improves the execution speed and adaptability of the algorithm.
Smart Images

Figure CN119509751A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of pressure sensors, and in particular to a temperature compensation method and system for a pressure sensor. Background Art
[0002] Piezoresistive pressure sensor is a semiconductor device made by using the property that the resistivity of semiconductor changes with stress. It uses integrated circuit technology to make diffuse resistors on the substrate of semiconductor materials and directly uses it as a sensitive element. The core part of the silicon piezoresistive pressure sensor is an elastic silicon diaphragm. Four equal resistors integrated on the silicon chip are connected to form a Wheatstone bridge. When the measured pressure acts on the silicon chip, the resistance value changes, the bridge loses balance, and a voltage output is generated. When the input pressure P value remains unchanged, changes in the operating temperature T and other factors will cause the voltage output U of the sensor to change, among which temperature changes have the greatest impact on it. Therefore, effective measures must be taken to reduce and compensate for the errors caused by temperature effects.
[0003] There are generally two methods for temperature compensation of pressure sensors: hardware compensation and software compensation. Hardware compensation mainly uses hardware circuits to eliminate its influence. Although this method is simple, efficient, and low-cost, it has poor adaptability, limited compensation range, and low compensation accuracy. Software compensation usually uses neural network methods for compensation. It can adaptively adjust the connection weights between neurons through training, realize modeling and processing of nonlinear problems, handle various complex problems and data, and achieve high-precision compensation; it can adapt to different conditions or improve performance by updating algorithms or parameters, and has strong adaptability; but complex software algorithms not only require higher computing power and increase hardware costs, but also increase training time and reduce compensation efficiency. Summary of the invention
[0004] The embodiments of the present invention provide a temperature compensation method and system for a pressure sensor, which can overcome the technical problems existing in the above-mentioned prior art and realize high-efficiency and high-precision temperature compensation for the pressure sensor.
[0005] To achieve the above object, the present invention provides a temperature compensation method for a pressure sensor, the specific steps of which include:
[0006] S1: Perform hardware compensation on the pressure sensor;
[0007] S2: Collecting the first output data of the pressure sensor after hardware compensation;
[0008] S3: using the first output data, the corresponding ambient temperature value and the corresponding pressure value as a first training data set to perform RNN neural network temperature compensation model training;
[0009] S4: Deploy the trained RNN neural network temperature compensation model to the FPGA development board, perform software compensation on the pressure sensor, and obtain the temperature compensation correction value;
[0010] S5: adjusting the first output data based on the temperature compensation correction value to obtain second output data;
[0011] S6: using the second output data, the corresponding ambient temperature value and the corresponding pressure value as a second training data set, optimizing and training the RNN neural network model, and updating the parameters of the model;
[0012] S7: Repeat steps S4 to S6 to achieve high-precision temperature compensation of the pressure sensor under different environments.
[0013] The present invention also provides a temperature compensation system for a pressure sensor, comprising: a hardware compensation module, a software compensation module and a feedback control module;
[0014] The hardware compensation module includes a hardware temperature compensation module, a high temperature test chamber, an S-type thermocouple, a piston pressure gauge, a constant voltage power supply and a DAQ data acquisition instrument to realize the hardware temperature compensation of the pressure sensor, and collect the first output data of the pressure sensor after hardware compensation, the corresponding ambient temperature value and the corresponding pressure value as the first training data set;
[0015] Software compensation module: training the RNN neural network temperature compensation model based on the first training data set, deploying the trained RNN neural network temperature compensation model on the FPGA development board, performing software compensation on the pressure sensor to obtain a temperature compensation correction value, and adjusting the first output data to obtain second output data;
[0016] Feedback control module: stores the second output data, the corresponding ambient temperature value and the corresponding pressure value, and uses the second output data, the corresponding ambient temperature value and the corresponding pressure value as a second training data set to optimize the RNN neural network model.
[0017] The temperature compensation method and system of the pressure sensor provided by the present invention can improve the temperature compensation accuracy of the sensor and the accuracy of measurement by combining a comprehensive method of hardware and neural network; and the neural network can handle complex nonlinear relationships and more accurately model the temperature compensation characteristics of the sensor. In addition, the neural network is deployed on the FPGA, and due to the parallel computing advantage of the FPGA, the execution speed of the algorithm can be improved; the feedback mechanism is used to use the sensor output as new training data to adjust the parameters of the neural network model, which can further optimize the performance of the neural network model to adapt to the new working environment of the sensor. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0019] Figure 1 A flow chart of a temperature compensation method for a pressure sensor provided by an embodiment of the present invention;
[0020] Figure 2 Schematic diagram of the RNN neural network temperature compensation model in an embodiment of the present invention;
[0021] Figure 3 A schematic diagram of a temperature compensation system for a pressure sensor provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0023] In addition, the terms "first", "second", etc. are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. In the description of the following embodiments, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0024] The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. To make the technical solution of the present invention clearer, the embodiments of the present invention are described in detail below in conjunction with the accompanying drawings.
[0025] Figure 1 A flow chart of a temperature compensation method for a pressure sensor provided by an embodiment of the present invention; Figure 1 As shown, the specific steps of the method include:
[0026] S1: Perform hardware compensation on the pressure sensor.
[0027] Four semiconductor varistors are distributed on the pressure-sensitive diaphragm of the piezoresistive pressure sensor, and the four resistors form a Wheatstone bridge. Changes in external pressure cause changes in the bridge resistance, and the pressure is measured by calibrating the changed resistance. Since varistors are greatly affected by temperature, the most commonly used method is to connect the corresponding Wheatstone bridge arms in series and parallel, and perform sensor hardware temperature compensation by adjusting the resistance value and temperature coefficient of the bridge arm resistors.
[0028] S2: Collect the first output data of the pressure sensor after hardware compensation.
[0029] Furthermore, in order to collect the first output data of the pressure sensor after hardware compensation, a pressure sensor first training data acquisition platform was built based on the hardware temperature compensation module, high temperature test chamber, S-type thermocouple, piston pressure gauge, constant voltage power supply and DAQ data acquisition instrument. Through this platform, the performance data of the pressure sensor at different temperatures and pressures can be collected to provide necessary experimental data for the development of hardware compensation algorithms.
[0030] When building the platform, it is necessary to ensure that all devices and components are correctly connected and work under appropriate conditions. One end of the pressure sensor is connected to the constant voltage power supply, and the other end of the signal transmission line is connected to the hardware compensation circuit; the output end of the hardware compensation circuit is connected to the DAQ data acquisition instrument, the pressure sensor pressure sensitive element end and the 0-25MPa piston pressure gauge; and the pressure sensor and S-type thermocouple are placed in a high temperature test chamber.
[0031] S3: Using the first output data, the corresponding ambient temperature value and the corresponding pressure value as a first training data set to perform RNN neural network temperature compensation model training;
[0032] Among them, by changing the pressure of the piston pressure gauge and the temperature of the high-temperature test chamber, the output value of the pressure sensor at different temperatures and pressures is obtained, which is the first output data; in order to avoid errors in the results caused by the discrepancy between the actual ambient temperature and the nominal value of the high-temperature test chamber, an S-type thermocouple is used to measure the temperature in the high-temperature test chamber, and the output value of the thermocouple is the ambient temperature value; the different pressure values of the piston pressure gauge are the pressure values corresponding to the first output data.
[0033] Specifically, the temperature compensation range of the piezoresistive pressure sensor in the embodiment of the present invention is -50 to 300°C, the operating temperature range of the high temperature test chamber is set to -50 to 300°C, the initial operating temperature is -50°C, and the piston pressure gauge pressure is set to 0MPa, 1MPa, 2MPa, 3MPa, 4MPa, 5MPa, 6MPa, 7MPa, 8MPa, 9MPa, 10MPa, 11MPa, 12MPa, 13MPa, 14MPa, 15MPa, 16MPa, 17MPa, 18MPa, 19MPa, and 20MPa; keep warm at 10°C for half an hour and take a sample once; repeat the above steps 5 times to obtain the sensor output voltage corresponding to the pressure at different temperatures.
[0034] Furthermore, after the data collection is completed, it is used as the first training data set to complete the next step of the pressure sensor temperature compensation model training process, and the specific steps include: setting network parameters, data preprocessing, model construction and model training. In the embodiment of the present invention, the Anaconda integrated development environment is built in the pycharm software, and the tensorflow learning framework is imported.
[0035] Furthermore, setting the network parameters specifically includes: setting the number of hidden neurons, learning rate, batch size, Epoch value, and input sequence length sequence.
[0036] The number of hidden neurons refers to the number of neurons in the hidden layer. The more hidden neurons there are, the stronger the network's learning ability is usually, but it may also lead to overfitting and increase computational costs. It is usually necessary to determine the optimal number through experiments. You can start with a smaller number and gradually increase it until the performance is no longer significantly improved.
[0037] The learning rate is an important parameter in the optimization algorithm, which determines the magnitude of weight adjustments during training. A learning rate that is too high may lead to instability during training, while a learning rate that is too low may cause the learning process to be slow or even stagnant. Commonly used learning rate initialization values such as 0.01, 0.001, or 0.0001 can be adjusted by learning rate decay or using an adaptive learning rate optimization algorithm.
[0038] The batch size determines the average number of samples used to compute the loss and gradients before each model update. Smaller batch sizes generally result in more frequent updates and higher memory consumption during training, while larger batch sizes may reduce memory requirements but increase the time per update. The choice of batch size depends on the size of your dataset, the complexity of your model, and the available computing resources.
[0039] An epoch refers to a complete forward and backward propagation of the model over the entire training dataset. The number of epochs determines the total number of rounds of model training. Multiple epochs are usually required to ensure that the model has enough time to learn the patterns in the data. Too many epochs may lead to overfitting, while too few may lead to underfitting of the model.
[0040] For RNNs, the input sequence length refers to the number of time steps in each training sample. This length should be long enough to capture the temporal dependencies in the data, but not too long to include too much irrelevant information or increase the computational burden. The choice of sequence length depends on the characteristics of the specific task and data, and usually needs to be determined through experiments.
[0041] In practical applications, the optimal values of the above parameters usually need to be determined through experiments and adjustments, a process called hyperparameter optimization. Grid search, random search, or Bayesian optimization can be used to find the best hyperparameter combination.
[0042] Furthermore, in order to ensure the quality and reliability of the model, the first training data set is divided into a training set and a test set according to a preset ratio. If all the data is used for training, the model may over-adapt to specific features and noise in the training data, resulting in poor performance on new data. By dividing the data into a training set and a test set, it can be ensured that the model is not exposed to all the data during training, thereby reducing the risk of overfitting. In the embodiment of the present invention, the preset ratio of the training set to the test set is set to 8:2.
[0043] In addition, in order to meet the inherent requirements of RNN for processing sequence data, and also to ensure the compatibility of data with the deep learning framework, so as to effectively train and deploy the model, the embodiment of the present invention converts the first output data, the corresponding ambient temperature value and the corresponding pressure value in the first training data set into a three-dimensional tensor as the input of the RNN neural network. In the embodiment of the present invention, the three-dimensional tensor is defined as (batch_size, sequence, input_size), where batch_size is the number of samples participating in the training each time the model is trained, sequence is the length of the design parameter or performance parameter input sequence, and input_size is the number of features.
[0044] Furthermore, the model building process specifically includes: defining the model structure, defining the loss function and optimization algorithm, and initializing the network weights.
[0045] The model structure defines the number of layers in the network, the type of each layer, and the connections between layers. For RNN, this usually includes an input layer, one or more RNN layers, and an output layer.
[0046] The loss function is used to evaluate the difference between the model's prediction and the true value, and the optimization algorithm is used to update the model's weights based on the results of the loss function. The loss function and the optimization algorithm determine how to evaluate the performance of the model and optimize it.
[0047] Weight initialization is the first step in training a neural network, which affects the convergence speed and final performance of the network.
[0048] Furthermore, the model training process specifically includes: forward propagation, loss calculation, back propagation, model evaluation and completion of training.
[0049] Among them, forward propagation involves calculating the output of input data as it passes through the network layers. During the training phase, forward propagation is used to calculate predictions, which are then compared with the true labels to calculate the loss. During the testing and deployment phases, forward propagation is used to generate predictions for new input data.
[0050] In neural networks, calculating the loss (also called loss function or cost function) is a key step in evaluating the difference between the model prediction and the actual data. The loss function is a mathematical function that takes the model's predicted value and the true value as input and outputs a non-negative real number to represent the loss. The smaller the loss value, the closer the model's prediction is to the true value. The embodiment of the present invention uses the mean square error MSE loss function to measure the difference between the predicted value of the RNN neural network temperature compensation model and the actual label.
[0051] Back propagation updates weights by calculating the gradient of the loss function with respect to the network parameters, thereby minimizing the loss function. The embodiment of the present invention updates the RNN neural network temperature compensation model parameters through a back propagation algorithm.
[0052] Model evaluation is an iterative process that may require multiple adjustments and validations to test the performance of the model and determine its generalization ability.
[0053] The embodiment of the present invention selects mean absolute error MAE, root mean square error RMSE and mean square error MSE as evaluation indicators during model evaluation.
[0054]
[0055] Where m is the total number of pressure settings at different temperatures in 5 experiments, f(x i ) is the predicted temperature compensation correction value, y i The actual value corresponding to the predicted temperature compensation correction value
[0056] After completing the RNN neural network temperature compensation model training, it can be saved for future use or deployment. Figure 2 Schematic diagram of the RNN neural network temperature compensation model in an embodiment of the present invention. Figure 2 As shown in the figure, {x1,x2,x3} is the input sequence of RNN, h0 is a randomly initialized vector, {h1,h2,h3} is the hidden vector of RNN, softmax is the fully connected layer, and y is the temperature compensation correction value output at the end.
[0057] S4: Deploy the trained RNN neural network temperature compensation model to the FPGA development board, perform software compensation on the pressure sensor, and obtain the temperature compensation correction value.
[0058] FPGA (field programmable gate array) has significant advantages in improving the execution speed of algorithms due to its unique parallel computing capabilities and customizability. In order to make full use of these advantages of FPGA, first, the trained RNN model needs to be converted into hardware description language (HDL) code, usually Verilog or VHDL. The embodiment of the present invention uses Quartus II software to convert each module in the trained model into Verilog hardware description language and map it to the programmable logic of FPGA. Secondly, compile the Verilog code in Quartus II to generate a bitstream file (.sof or .rbf file) suitable for FPGA. And load the generated bitstream file onto the Altera DE10 FPGA development board, and load the designed logic into the FPGA chip through the JTAG interface. Then, configure the input and output interface of the FPGA to receive the signal from the pressure sensor and the temperature measurement value of the thermocouple, collect the sensor output data and the ambient temperature value corresponding to the thermocouple, and format it into the input format required by the RNN model. Finally, run on the FPGA to realize high-precision temperature compensation of the sensor and obtain the temperature compensation correction value.
[0059] S5: adjusting the first output data based on the temperature compensation correction value to obtain second output data.
[0060] S6: Use the second output data, the corresponding ambient temperature value and the corresponding pressure value as a second training data set, perform optimization training on the RNN neural network model, and update the parameters of the model.
[0061] In order to further improve the compensation accuracy, the embodiment of the present invention uses the above-mentioned compensated data to further train and optimize the RNN neural network model, and updates the parameters of the model to adapt to the new working environment and conditions; after the update, it is also necessary to verify the performance of the neural network model in actual work to ensure that the temperature compensation effect is improved.
[0062] S7: Repeat steps S4 to S6 to achieve high-precision temperature compensation of the pressure sensor under different environments.
[0063] Each iteration uses new compensation data to train the model until the compensation accuracy reaches a certain preset threshold. The embodiments of the present invention use the data collected in actual applications to continuously improve the compensation capability of the model, thereby achieving high-precision temperature compensation for the pressure sensor in different environments. This iterative training method can help the model better adapt to the actual working environment and improve its accuracy and reliability under various conditions.
[0064] Figure 3 A schematic diagram of a temperature compensation system for a pressure sensor provided by an embodiment of the present invention, such as Figure 3 As shown, the system 300 includes: a hardware compensation module 3001 , a software compensation module 3002 and a feedback control module 3003 .
[0065] The hardware compensation module 3001 includes a hardware temperature compensation module, a high temperature test chamber, an S-type thermocouple, a piston pressure gauge, a constant voltage power supply and a DAQ data acquisition instrument, so as to realize the hardware temperature compensation of the pressure sensor, and collect the first output data of the pressure sensor after the hardware compensation, the corresponding ambient temperature value and the corresponding pressure value as the first training data set;
[0066] Software compensation module 3002: Perform RNN neural network temperature compensation model training based on the first training data set, deploy the trained RNN neural network temperature compensation model to the FPGA development board, perform software compensation on the pressure sensor to obtain a temperature compensation correction value, and adjust the first output data to obtain second output data;
[0067] Feedback control module 3003: Store the second output data, the corresponding ambient temperature value and the corresponding pressure value, and use the second output data, the corresponding ambient temperature value and the corresponding pressure value as a second training data set to optimize the RNN neural network model.
[0068] The composite method of hardware and neural network in the embodiment of the present invention can improve the temperature compensation accuracy of the sensor and improve the accuracy of measurement. Since the neural network can handle complex nonlinear relationships, it can more accurately model the temperature compensation characteristics of the sensor. In addition, by deploying the neural network on the FPGA, the execution speed of the algorithm can be improved due to the parallel computing advantage of the FPGA. The feedback mechanism is used to use the sensor output as new training data to adjust the parameters of the neural network model, which can further optimize the performance of the neural network model to adapt to the new working environment of the sensor.
[0069] In order to verify the proposed temperature compensation model, a set of data that did not participate in the training was used to verify the trained model, and the final evaluation index values of MSE, RMSE and MAE were 0.0009, 0.019 and 0.03 respectively. These three evaluation index values all show that the temperature compensation model has high accuracy and reliability. These low error values usually mean that the model can also work well on data that did not participate in the training and has good generalization ability.
[0070] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed by the present invention. The description and examples are to be considered exemplary only, and the true scope and spirit of the present invention is indicated by the following claims.
[0071] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A temperature compensation method for a pressure sensor, characterized in that: include: S1: Perform hardware compensation on the pressure sensor; S2: Collecting the first output data of the pressure sensor after hardware compensation; S3: using the first output data, the corresponding ambient temperature value and the corresponding pressure value as a first training data set to perform RNN neural network temperature compensation model training; S4: Deploy the trained RNN neural network temperature compensation model to the FPGA development board, perform software compensation on the pressure sensor, and obtain the temperature compensation correction value; S5: adjusting the first output data based on the temperature compensation correction value to obtain second output data; S6: using the second output data, the corresponding ambient temperature value and the corresponding pressure value as a second training data set, optimizing and training the RNN neural network model, and updating the parameters of the model; S7: Repeat steps S4 to S6 to achieve high-precision temperature compensation of the pressure sensor under different environments.
2. The method according to claim 1, characterized in that Before collecting the first output data of the pressure sensor after hardware compensation, it also includes: building a first training data collection platform for the pressure sensor based on a hardware temperature compensation module, a high temperature test chamber, an S-type thermocouple, a piston pressure gauge, a constant voltage power supply and a DAQ data acquisition instrument; Among them, one end of the pressure sensor is connected to the constant voltage power supply, and the other end of the signal transmission line is connected to the hardware compensation circuit; the output end of the hardware compensation circuit is connected to the DAQ data acquisition instrument, the pressure sensor pressure sensitive element end and the piston pressure gauge; and the pressure sensor and the S-type thermocouple are both placed in a high temperature test box.
3. The method according to claim 2, characterized in that The first output data, the corresponding ambient temperature value and the corresponding pressure value specifically include: Changing the pressure of the piston pressure gauge and the temperature of the high temperature test box to obtain output values of the pressure sensor at different temperatures and pressures, namely, first output data; The output value of the S-type thermocouple at different temperatures is the ambient temperature value corresponding to the first output data; The different pressure values of the piston pressure gauge are the pressure values corresponding to the first output data.
4. The method according to any one of claims 1 to 3, characterized in that: The RNN neural network temperature compensation model training specifically includes: Set network parameters, data preprocessing, model building, and model training.
5. The method according to claim 4, characterized in that The setting of network parameters specifically includes: Set the number of hidden neurons, learning rate, batch size, Epoch value, and input sequence length.
6. The method according to claim 4, characterized in that The data preprocessing specifically includes: Dividing the first training data set into a training set and a test set according to a preset ratio; The first output data, the corresponding ambient temperature value and the corresponding pressure value in the first training data set are converted into a three-dimensional tensor as an input of the RNN neural network.
7. The method according to claim 4, characterized in that The model construction specifically includes: Define the model structure; Define loss function and optimization algorithm; Initialize the network weights.
8. The method according to claim 4, characterized in that The model training specifically includes: forward propagation, loss calculation, back propagation, model evaluation and completion of training.
9. A temperature compensation system for a pressure sensor, characterized in that: include: Hardware compensation module, software compensation module and feedback control module; The hardware compensation module includes a hardware temperature compensation module, a high temperature test chamber, an S-type thermocouple, a piston pressure gauge, a constant voltage power supply and a DAQ data acquisition instrument to realize the hardware temperature compensation of the pressure sensor, and collect the first output data of the pressure sensor after hardware compensation, the corresponding ambient temperature value and the corresponding pressure value as the first training data set; Software compensation module: training the RNN neural network temperature compensation model based on the first training data set, deploying the trained RNN neural network temperature compensation model on the FPGA development board, performing software compensation on the pressure sensor to obtain a temperature compensation correction value, and adjusting the first output data to obtain second output data; Feedback control module: stores the second output data, the corresponding ambient temperature value and the corresponding pressure value, and uses the second output data, the corresponding ambient temperature value and the corresponding pressure value as a second training data set to optimize the RNN neural network model.
Citation Information
Patent Citations
Intelligent sensor temperature error compensation method and device based on deep learning network
CN115856342A
Valve pressure sensor temperature compensation method and system based on STM32 and LSTM
CN116818180A
Cited By
Piezoresistive pressure sensor passive resistance network temperature compensation method
CN119756670A
PEDOT sensor nonlinear response compensation optimization system
CN120427042A