Next Article in Journal
FMCW Laser Fuze Structure with Multi-Channel Beam Based on 3D Particle Collision Scattering Model under Smoke Interference
Previous Article in Journal
Detection Method of Stator Coating Quality of Flat Wire Motor Based on Improved YOLOv8s
Previous Article in Special Issue
Optimizing Data Flow in Binary Neural Networks
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Temperature Compensation Method for Piezoresistive Pressure Sensors Based on Gated Recurrent Unit

by
Mian Liu
1,
Zhiwu Wang
1,*,
Pingping Jiang
1 and
Guozheng Yan
2
1
School of Electronic Information and Electrical Engineering, Shanghai Jiao Tong University, Shanghai 200240, China
2
School of Biomedical Engineering, Shanghai Jiao Tong University, Shanghai 200240, China
*
Author to whom correspondence should be addressed.
Sensors 2024, 24(16), 5394; https://doi.org/10.3390/s24165394 (registering DOI)
Submission received: 2 August 2024 / Revised: 19 August 2024 / Accepted: 19 August 2024 / Published: 21 August 2024

Abstract

:
Piezoresistive pressure sensors have broad applications but often face accuracy challenges due to temperature-induced drift. Traditional compensation methods based on discrete data, such as polynomial interpolation, support vector machine (SVM), and artificial neural network (ANN), overlook the thermal hysteresis, resulting in lower accuracy. Considering the sequence-dependent nature of temperature drift, we propose the RF-IWOA-GRU temperature compensation model. Random forest (RF) is used to interpolate missing values in continuous data. A combination of gated recurrent unit (GRU) networks and an improved whale optimization algorithm (IWOA) is employed for temperature compensation. This model leverages the memory capability of GRU and the optimization efficiency of the IWOA to enhance the accuracy and stability of the pressure sensors. To validate the compensation method, experiments were designed under continuous variations in temperature and actual pressure. The experimental results show that the compensation capability of the proposed RF-IWOA-GRU model significantly outperforms that of traditional methods. After compensation, the standard deviation of pressure decreased from 10.18 kPa to 1.14 kPa, and the mean absolute error and root mean squared error were reduced by 75.10% and 76.15%, respectively.

1. Introduction

Pressure sensors are the most widely used types of sensors [1,2]. They convert the pressure of a fluid or gas into an electrical signal. According to the principle of pressure sensors, they can be divided into piezoresistive, piezoelectric, capacitive, and resonant sensors, as well as other types [3]. Due to their high sensitivity, fast dynamic response, good stability, and easy integration, piezoresistive pressure sensors have extensive applications in the automotive industry, electric machinery, environmental monitoring, smart homes, and other fields [4]. However, various application scenarios and working environments pose many challenges to pressure sensors, requiring high-precision and high-stability measurements across a wide temperature range. Unfortunately, the characteristics of piezoresistive pressure sensors are often influenced by the manufacturing process and various environmental variables, leading to nonlinearity. Among these factors, temperature significantly affects the accuracy of piezoresistive pressure sensors [5]. Temperature changes impact the piezoresistive coefficient [6], causing temperature drift. Additionally, temperature changes result in the thermal expansion and contraction of materials, leading to additional thermal stress on the pressure sensor [7]. Therefore, temperature compensation to improve the output accuracy of piezoresistive pressure sensors has become a widely discussed topic in both scientific and industrial circles.
Temperature compensation methods typically involve hardware compensation and software compensation [8]. Hardware compensation aims to enhance accuracy under different scenarios through circuit design [9], primarily utilizing built-in analog circuits to mitigate temperature drift. However, as packaging processes continue to improve, most sensors are put into use after packaging, making it challenging to make subsequent adjustments after completing the hardware compensation circuit design. External temperature changes also have an irreversible impact on components in the compensation circuit, leading to a significant increase in errors as usage time progresses [10]. Moreover, hardware compensation methods increase production costs [11] and the usage costs of sensors. As a complement and extension to hardware compensation methods, software compensation methods are increasingly utilized to enhance the overall accuracy and adaptability of piezoresistive pressure sensors.
Software compensation methods exhibit strong robustness and have lower manufacturing process requirements. These methods can be categorized into numerical computation-based and machine learning-based methods. Numerical computation-based temperature compensation methods include lookup table, surface fitting, and polynomial interpolation. Lookup table can effectively compensate for temperature drift, but the accuracy after compensation is related to the number of stored points [12]. Surface fitting is adequate for the nonlinear calibration of pressure sensor outputs [13]. Wang proposed a method based on Newton interpolation and cubic spline interpolation for online temperature compensation [14]. This method is easy to implement and has high accuracy, but solving polynomial coefficients may lead to ill-conditioned problems, reducing the reliability of the compensation model. Machine learning-based methods exhibit strong nonlinear approximation capabilities, overcoming some limitations of numerical calculation and offering new options for the high-precision temperature compensation of pressure sensors. Machine learning methods commonly employed by researchers include support vector machine (SVM), extreme learning machine (ELM), and artificial neural network (ANN). Suykens introduced the least squares support vector machine (LSSVM), transforming the inequality constraints of traditional SVM into linear equations in regularization theory [15]. A study by Li demonstrates that the backpropagation (BP) neural network temperature compensation method is effective and robust [16]. However, this method has some drawbacks, such as slow convergence, susceptibility to local optima, and uncertainty in weight thresholds. Therefore, some researchers have improved the BP neural network using different optimization algorithms, accelerating the algorithm’s speed and enhancing its applicability [8,17]. Fu developed a temperature compensation model using the radial basis function (RBF) neural network optimized by chicken swarm optimization (CSO), which exhibited sound compensation effects in piezoresistive pressure sensors [18]. Ge optimized the wavelet neural network (WNN) model and applied it for temperature compensation [19]. However, the above software compensation methods are static compensation methods that require the collection of discrete data. The required data are obtained by measuring the response voltage of the sensor under different temperatures and applied pressures. These methods neglect the coupling effect of pressure and temperature on temperature drift, significantly increasing the time for calibration.
Due to thermal hysteresis, the temperature drift of pressure sensors depends not only on the current input but also on the previous information. ANNs have failed to utilize previous information effectively, leading to lower accuracy and poor robustness. Considering temperature drift’s highly nonlinear and sequence-dependent nature, deep learning networks are particularly suitable for temperature compensation [20]. Among them, recurrent neural networks (RNNs) stand out as one of the most promising deep learning networks, performing exceptionally well in time series processing. RNNs have memory capabilities, retaining and applying previous information to current output calculations. However, traditional RNNs suffer from inherent issues of gradient vanishing and exploding gradients [21]. Some improved RNN structures, such as long–short-term memory (LSTM) and gated recurrent unit (GRU), effectively address these problems. LSTM establishes new cell states and uses gate mechanisms to filter information and manage long-term memory [22]. By introducing gate mechanisms, especially the forget gate and input gate, LSTM can better remember and utilize long-term information, thus exhibiting significant advantages in handling long sequence data and remembering long-term information [23,24]. In contrast, GRU solves the gradient problems of RNNs and uses fewer parameters, resulting in shorter training times and making them suitable for processing time series data [25]. In recent years, RNNs have begun to be applied in temperature compensation for various sensors. However, there is limited research on applying RNNs to compensate for temperature compensation in pressure sensors.
To address this research gap, we propose a temperature compensation method based on the RF-IWOA-GRU model. This model first preprocesses the actual pressure data using random forest (RF), filling in the missing values in the continuous data. In response to the challenge of traditional neural networks struggling to utilize previous information effectively, we incorporate temperature, the rate of temperature change, and the output of the pressure sensor as input variables for GRU. Furthermore, we optimize the hyper-parameters of GRU using the improved whale optimization algorithm (IWOA), significantly improving the model’s training efficiency and prediction performance. Ultimately, experimental validation demonstrates the effectiveness of the RF-IWOA-GRU model. This method enhances the measurement accuracy of pressure sensors, shortens the time required for calibration, and provides a reference for the temperature compensation of other types of sensors.

2. Failure Mechanism of Pressure Sensors

2.1. Introduction of Piezoresistive Pressure Sensors

The structure of the piezoresistive pressure sensor [26,27] used in this study is shown in Figure 1a. The principle of the sensor is based on the piezoresistive effect of monocrystalline silicon. The core component of the sensor is a silicon diaphragm placed on a circular silicon cup. The diaphragm separates two chambers: the high-pressure chamber exposed to the measured pressure and the low-pressure chamber exposed to the standard atmospheric pressure as the reference pressure. Four diffused resistors are attached to the diaphragm, one pair experiencing compressive stress and the other experiencing tensile stress. When the pressure difference between the two chambers causes deformation of the diaphragm, the resistance changes accordingly, leading to an imbalance in the bridge and conversion of the pressure signal into a proportional electrical signal. By measuring the voltage output of the bridge, the pressure difference acting on the diaphragm can be determined, and thus, the measured pressure value can be calculated. Figure 1b shows the equivalent circuit diagram of the piezoresistive pressure sensor [28,29].
According to the principle of the Wheatstone bridge [30], the output voltage of the piezoresistive pressure sensor is given by the following:
U out = R 2 × R 4 R 1 × R 3 R 1 + R 2 R 3 + R 4 × U in
where U in is the constant excitation power supply, and U out is the output voltage.
When the pressures in the two chambers are equal, the relationship between the resistances in the arms of the Wheatstone bridge is R 1 × R 3 = R 2 × R 4 , resulting in the bridge being balanced and the output voltage, U out , being zero. However, when there is a pressure difference across the silicon diaphragm, the diaphragm deforms, causing the four resistances to change, and the bridge becomes unbalanced, ultimately generating an output voltage:
U out = R 2 + Δ R 2 R 4 + Δ R 4 R 1 Δ R 1 R 3 Δ R 3 R 1 Δ R 1 + R 2 + Δ R 2 R 3 Δ R 3 + R 4 + Δ R 4 × U in
According to the piezoresistive effect, if process errors are disregarded, and it is assumed that R 1 = R 2 = R 3 = R 4 = R , with corresponding resistance changes being identical and the stress experienced by the resistors being the same, then the resistance change induced by biaxial stress is given by the following:
Δ R R = π l σ l + π t σ t
where π l and π t are the longitudinal and transverse piezoresistance coefficients, and σ l and σ t are the longitudinal and transverse stresses, respectively.
In summary, Equation (2) can be simplified into the following:
U out = I in × R × π l σ l + π t σ t

2.2. Temperature Effects of Pressure Sensors

Due to unpredictable errors in the manufacturing process of pressure sensors, it cannot be guaranteed that the resistance of each resistor in the Wheatstone bridge is equal. The resistance and silicon piezoresistive coefficient with temperature change are given by the following [31]:
R = R 0 ( 1 + α Δ T )
where R 0 is the reference resistance, α is the temperature coefficient of resistance, and Δ T is the temperature change.
Furthermore, the piezoresistive coefficient π is influenced by the silicon doping level and temperature, with temperature changes leading to variations in the piezoresistive coefficient [32]. Additionally, heat generates thermal expansion and contraction when the resistor is powered. The packaging material of the pressure sensor also changes due to temperature, resulting in additional thermal stress Δ σ .
In summary, changes in actual pressure and temperature will both cause nonlinear variations in the output voltage, U out . The coupling effect between pressure and temperature makes these variations even more unpredictable. Moreover, other factors, such as the hysteresis of the electronic components and the different impurity doping concentrations, can lead to more complex variations in the temperature drift.

2.3. Factors for Temperature Compensation

In environments with changing temperatures, the error of piezoresistive pressure sensors is mainly caused by thermal zero drift, changes in thermal sensitivity, and thermal hysteresis [33]. For temperature compensation in pressure sensor research, the environment can be comprehensively described by the temperature itself, the rate of temperature change, and the temperature gradient [34,35].
The pressure sensor and the probe of the thermometer are placed inside a sealed metal container in our experiment. However, due to the thermal time constants of the pressure sensor and probe varying inconsistently with temperature changes, this results in uneven heat conduction within the metal container. This inconsistency creates complex thermal hysteresis between the actual temperature of the pressure sensor and the collected temperature. The effects disrupt the coupling relationship between temperature and pressure, introducing errors in pressure measurement.
Considering the above factors, the input variables of the temperature compensation model of the pressure sensor include temperature, T; the rate of temperature change, T ˙ ; and the output of the pressure sensor, U out . The temperature gradient, T , causes an asymmetric change in the temperature field, and the effect mechanism is similar to the rate of temperature change. However, its measurement requires multiple thermometers. We only use one thermometer in the experiment, so it is not considered for now. In addition, the second-order rate of temperature change, T ¨ , is not included as an input variable because T and T ˙ are sufficient for capturing the temperature variation trends, while also reducing the model’s complexity. Furthermore, the low temperature sampling rate may lead to an inaccurate computation of T ¨ , potentially introducing additional noise and instability.
Through analysis, we know that the purpose of temperature compensation is to establish the following relationship:
P ^ = f ( U out , T , T ˙ )
where P ^ is the predicted pressure value. f ( · ) is an unknown complex function that relates to the characteristics of the pressure sensor and external environmental factors, which we will model using gated recurrent unit networks in Section 3.

3. Compensation Algorithms and Model

Based on the above discussion, it can be concluded that the temperature drift of the pressure sensor depends on the current input and previous information. Traditional temperature compensation methods do not utilize previous information, leading to poor predictive performance and weak robustness. Gated recurrent unit (GRU) networks can remember historical information by changing their internal state, which allows the information to be backpropagated smoothly. For modeling with GRU, a continuous time series dataset is indispensable for improving prediction accuracy. However, the actual pressure data collected in experiments contain missing values. Therefore, we utilize random forest (RF) to predict and fill these missing values using other relevant features. Considering the model’s performance is significantly influenced by the hyper-parameters of GRU, a meta-heuristic algorithm is adopted to optimize the hyper-parameters. Compared with other traditional meta-heuristic algorithms, the improved whale optimization algorithm (IWOA) boasts the advantages of stable convergence, minimal parameters, and straightforward implementation.

3.1. Random Forest

Random forest (RF) is a versatile machine learning method that extends the classification and regression tree (CART) approach. It is a supervised learning algorithm that constructs an ensemble of decision trees known as a “forest”, typically trained using the bagging process. RF applies to both regression and classification problems [36]. In regression problems, RF combines multiple simple trees, which vote for their responses and average them to estimate the dependent variable [37]. Data and variables can be iteratively sampled randomly using bootstrap sampling to generate a forest of regression trees. The predictions of RF are the average predictions of these trees:
y ^ = 1 K k = 1 K y ^ k
where k indexes the individual trees in the forest.
RF uses out-of-bag errors to calculate the relative importance of feature variables, thereby enhancing regression accuracy. Implementation of RF depends on the regularization of decision trees and stopping parameters. Parameters of the decision tree model include the maximum number of trees that must be grown in the forest and the number of variables randomly selected in each node.

3.2. Gated Recurrent Unit Networks

While traditional time series prediction methods are typically designed for steady-state signals, the reality is that most signals are non-steady-state. Consequently, utilizing neural networks to address time series problems has emerged as a significant approach [38]. Unlike traditional neural networks, which can only handle a single input signal without considering the mutual influence between the input at the previous moment and the output at the next moment, time series problems require us to account for the impact of past inputs on future outputs. The GRU has gained widespread acceptance as an approach capable of capturing temporal dependencies due to its high computational efficiency and accurate time feature extraction [39].
The GRU model comprises the update gate, z t , and the reset gate, r t . The update gate controls the information carried from the previous state to the current state, while the reset gate determines the integration of new input information with the previous memory [40]. Figure 2 illustrates the schematic diagram of the GRU. The two gating states are derived from a hidden state, h t 1 , transmitted from the previous node and a current input node, x t , and can be expressed as follows:
r t = σ W x r x t + W h r h t 1 + b r
z t = σ W x z x t + W h z h t 1 + b z
Furthermore, the reset and update gates together contribute to the derivation of the final hidden state:
h ˜ t = tanh W h x x t + W h h r t h t 1 + b h
h t = 1 z t h t 1 + z t h t ˜
where W is the weight matrix connecting different structures; b is the offset vector of the corresponding structures; x, h, r, and z are the input, hidden state, reset gate, and update gate, respectively.
The sequences of temperature, the rate of temperature change, and the output of the pressure sensor are taken as the input variables of GRU, while the actual pressure is taken as the output variable. GRU contains three hyper-parameters that affect the accuracy of the model, including the initial learning rate, the batch size, and the number of neurons. Here, the IWOA is used to find the optimal parameters of the GRU.

3.3. WOA and IWOA

3.3.1. Whale Optimization Algorithm

WOA is a meta-heuristic algorithm proposed by Mirjalili, inspired by the behavior of humpback whales in capturing prey in the wild [41]. In this algorithm, the position of each whale represents the problem solution, whereas the position of the prey refers to the optimal solution of the problem. During hunting, whales randomly choose one of the following two parts with a 50% probability.
  • Contraction Encircling
    This process imitates the behavior of whales surrounding their prey through circular movement. The way the whales shrink their enclosures is modulated by A .
    A = a 2 r 1
    where r is the random number in the interval 0 , 1 , and a is the adjustment factor.
    At A < 1 , the algorithm performs a local search.
    a = 2 t T 1
    C = 2 r
    D = C · X ( t ) * X ( t )
    X ( t + 1 ) = X ( t ) * A · D
    where D is the distance between the current whale position and the best whale position, X ( t ) * and X ( t ) are the optimal position and the current individual position at the t iteration, respectively, C is the perturbation coefficient, and T is the maximum number of iterations.
    At A 1 , the algorithm performs a global search.
    D R = C · X R ( t ) X ( t )
    X ( t + 1 ) = X R ( t ) A · D R
    where X R ( t ) is the random whale position in the current iteration, and D R is the distance between the random whale position and the current whale position.
  • Spiral Updating position
    This process imitates the behavior of whales encircling a target through spiral movement.
    D * = X ( t ) * X ( t )
    X ( t + 1 ) = D * · e b l · cos ( 2 π l ) + X     ( t ) *
    where D * is the distance between the current and best whale positions, b is the spiral shape coefficient, and l is the random number in the interval [ 1 , 1 ] .
In summary, the hunting behavior of whales can be summarized by the following mathematical model:
X ( t + 1 ) = X ( t ) * A · D * , | A | < 1 X R ( t ) A · D R , | A | 1 , p < 0.5 D * · e b l · cos ( 2 π l ) + X ( t ) * , p 0.5
where p is the random number in [ 0 , 1 ] . When p < 0.5 , the contraction surrounding position is selected, and when p 0.5 , the spiral update position is selected.

3.3.2. Improved Whale Optimization Algorithm

Although the traditional WOA has advantages such as high efficiency, few control parameters, and the ability to avoid local optima, it has certain limitations regarding convergence speed and precision. To address this issue, we propose an improved version of WOA, which mainly focuses on the following two aspects.
  • Chebyshev Chaotic Map
    The Chebyshev chaotic map generates chaotic sequences through the repeated application of iterative functions. It exhibits nonlinearity, high sensitivity to initial values, excellent ergodicity, and unpredictability [42]. This map is frequently used for population initialization to enhance algorithmic diversity and randomness [43]. Based on the comparison of chaotic optimization algorithms, the Chebyshev chaotic map has a large Lyapunov exponent, which means its chaotic nature is pronounced, and its degree of chaos is high. Furthermore, considering the optimal, mean, and standard values, the Chebyshev chaotic map exhibits stability and high applicability. Therefore, considering all these factors, we chose the Chebyshev chaotic map to optimize the traditional whale algorithm. The formula is as follows:
    x n + 1 = cos λ · cos 1 x n
    where x n ( 1 , 1 ) and λ are control parameters.
  • Adaptive Weight
    In the case of contracting the encircling and spiral updating positions, a large weight value should be selected at the initial stage of the algorithm to improve the optimization speed and global search ability of the algorithm [44]. As the algorithm iterates continuously, the weight values should gradually decrease to reduce the fluctuation amplitude of the search and improve the convergence accuracy of the algorithm. Given the above situation, adaptive weight ξ is introduced to optimize the algorithm so that the contraction encircling and spiral updating positions are adjusted according to the current iteration degree. The mathematical expression of ξ can be expressed as follows:
    ξ = B 1 + B 2 · sin t · π 5 · e t T
    where B 1 and B 2 are constants. ξ decreases with the number of iterations of the whale population. With the following, we can update Equation (21) to become the following:
    X ( t + 1 ) = X ( t ) * ξ · A · D * , | A | < 1 ξ · ( X R ( t ) A · D R ) , | A | 1 , p < 0.5 ξ 2 · D * · e b l · cos ( 2 π l ) + ξ · X ( t ) * , p 0.5

3.4. RF-IWOA-GRU Model

As discussed above, the design of hyper-parameters for GRU is essential. The IWOA possesses global solid search capability, with a fast convergence speed that allows it to quickly find the global optimal solution and avoid falling into the local optimal solution. In this study, we utilize the IWOA to search for hyper-parameters such as the initial learning rate, batch size, and number of neurons in GRU until the desired prediction accuracy is achieved.
As time series data, the outputs of the pressure sensor are characterized by instability, periodic uncertainty, and nonlinearity, and are influenced by various factors. We use the advantages of GRU in time series analysis to establish a temperature compensation model. The RF-IWOA-GRU model is constructed by combining RF, the IWOA, and GRU to align the model’s structure with the output characteristics of the pressure sensor. Several hyper-parameters controlling the structure and model parameters in GRU are optimized through the IWOA. Figure 3 illustrates the structure of the RF-IWOA-GRU model.
The steps for modeling with the RF-IWOA-GRU are as follows.
(1) Experiment. Vary and record the ambient temperature and actual pressure while continuously collecting the corresponding output voltage from the pressure sensor.
(2) Preprocess data. Use the random forest to predict and fill in missing values. Combine the output of the pressure sensor with the temperature and the rate of temperature change as inputs to the model.
(3) Initialize and adjust multiple sets of hyper-parameters. The original sets are generated randomly through the Chebyshev chaotic map, including the initial learning rate, the batch size, and the number of neurons. Each set of hyper-parameters represents a different structure of GRU. The loss function is used as the fitness function of the IWOA. The IWOA adjusts hyper-parameters through this function until the conditions are met.
(4) Train the model. Train the GRU networks using the dataset. Then, the trained model will be utilized for prediction, compensating for the error of the pressure sensors.

4. Experiment and Results Analysis

4.1. Experiment and Data Collection

Temperature experiments were carried out to demonstrate the necessity of the IWOA-GRU temperature compensation model based on RF and to examine the temperature characteristics of the pressure sensor. The experimental environment and equipment are shown in Figure 4. In this experiment, the pressure sensor and thermometer probe were securely placed inside a sealed metal container, which served as the controlled environment for our measurements. This metal container was placed in a temperature calibration bath to regulate the surrounding environmental temperature. Pressure within the container was controlled via a pressure controller connected to a nitrogen cylinder, allowing us to create various pressure conditions for the sensor. The primary goal of the experiment was to evaluate the effectiveness of the compensation method. In practical applications, it is recommended to use a higher-integrated temperature sensor positioned at an appropriate distance from the pressure sensor. During the experiment, temperature and actual pressure data were collected using an embedded controller. When the piezoresistive pressure sensor was powered, it produced an output voltage that was sent to a signal-conditioning module. This module amplified the voltage and converted it into digital data at a frequency of 150 Hz using a 24-bit ADC. The digital data were then stored and made available to the embedded controller, which transmitted them to a computer via Ethernet for data processing and neural network training. In practical scenarios, once the computer receives the output voltage and corresponding temperature data, the pre-trained model processes this information to predict the pressure value in real time.
To improve calibration accuracy and reduce calibration time, we conducted an experiment capable of collecting time series data, the experimental process of which is illustrated in Figure 5. We first kept the temperature calibration bath at −20 °C for 20 min to ensure the temperature was stable and then heated it at a rate of 0.5 °C/min to 60 °C. Simultaneously, the pressure controller continuously cycled the actual pressure between 110 kPa and 310 kPa until the experiment was concluded. Notably, during the pressure cycling process, airflow inside the container caused temperature changes of about ±2 °C. These fluctuations mimicked real-world thermal noise, introducing random temperature drift that helped us evaluate the robustness of the model. To avoid chance factors, we conducted four experiments and found that the drift trends were consistent. From these experiments, we selected a dataset ranging from 60 °C to −20 °C for testing the model.
Additionally, we selected sensor output voltages of 160 kPa and 260 kPa, measured at 20 °C, as reference points to establish a linear conversion relationship between output voltage and pressure. The sensor output voltages, recorded under various conditions, were linearly converted to corresponding pressure values. The uncompensated error was determined by subtracting the converted pressure values from the actual pressure values. Figure 6 shows the relationship between uncompensated error and temperature. We can see that the error follows the same trend as the temperature and is affected by the rate of change in temperature. In addition, Figure 7 shows the errors at different temperatures and actual pressures. It is evident that due to the presence of thermal sensitivity, which varies with temperature, the error increases continuously with the rise in actual pressure.Therefore, it is necessary to establish a temperature compensation model.

4.2. Data Preprocessing

4.2.1. Calculation of the Rate of Temperature Change

An effective rate of temperature change must be calculated to serve as input for the compensation model. The rate of temperature change is represented as the derivative of temperature with respect to time, denoted as T t . Since the temperature changes at a slow rate of 0.5 °C/min (0.0083 °C/s), the rate of temperature change calculated using only adjacent points is close to zero. Therefore, we propose a rate of temperature change calculation method based on the moving average (MA). The MA involves applying a sliding window to a data sequence and calculating the average of the data points within the window to smooth the data. The moving average temperature, T ¯ ( i ) , at time i is calculated as follows:
T ¯ ( i ) = 1 k j = i k 2 i + k 2 T ( j )
where k is the window length. To reduce noise and fluctuations in temperature measurements, we set the window length k to 120.
Therefore, the rate of temperature change, T ˙ ( i ) , can be given by the following:
T ˙ ( i ) = T ¯ ( i + 1 ) T ¯ ( i 1 ) 2 · Δ t
where Δ t is the sampling interval, and in our experiment, Δ t = 1 s.

4.2.2. Interpolation of Missing Actual Pressure Data Values

In our experiment, the pressure controller required a certain amount of time to switch between increasing and decreasing pressure, during which serial communication to transmit actual pressure data was not possible. As a result, whenever the actual pressure reached 110 kPa or 310 kPa, the actual pressure sequence experienced three consecutive missing values. These missing values disrupted the temporal continuity of the data, making it challenging for the GRU networks to capture long-term dependencies in the time series. Additionally, missing values hindered gradient propagation, making it difficult for the model to converge and generalize, ultimately reducing the predictive accuracy of the model.
RF effectively handles non-linear relationships, exhibits robustness against outliers and noise, and utilizes all available features. Unlike traditional methods such as linear or spline interpolation, RF provides more accurate imputation by accounting for the correlations between multiple variables, resulting in more reliable estimates of missing values. Therefore, RF is utilized to interpolate the missing values before training the GRU networks. We first partitioned the data, using temperature and the output of the pressure sensor as inputs to the model, and trained the model with data that did not contain missing values. Then, we used the trained model to predict and fill in the missing values in the actual pressure data. Although the true values corresponding to the missing values could not be obtained, the interpolated data were observed to follow the original trend. Moreover, the variance before and after interpolation was calculated and found to show no significant change, indicating the consistency of the data, thereby validating the effectiveness of RF.

4.3. Modeling and Training

After preprocessing the input and output data, a model was constructed using temperature, the rate of temperature change, and the output of the pressure sensor as input features to predict corresponding actual pressure values through a regression output layer. A GRU, dropout, and fully connected layers between the input and output layers were optimized using the Adam optimizer. Considering computational efficiency and training time, the GRU was trained for 60 epochs.
Model training was conducted alongside the IWOA search for optimal hyper-parameters. In the IWOA, we set the number of whales to 15 and the maximum number of iterations to 50. The initial ranges of the parameters optimized in IWOA and the final search results are shown in Table 1. This completed the training of the RF-IWOA-GRU model, and the optimal performance neural network was saved.

4.4. Results and Discussions

Next, to validate the effectiveness and accuracy of the proposed RF-IWOA-GRU model, comparisons were made with other models, including GRU, LSTM, RNN, and BP neural network models. Each network model’s parameters were appropriately allocated. Across the entire training set, all models were generally able to predict the actual pressure trend. To more clearly compare performance, Figure 8 shows the actual pressure and the predictions of each model over a segment of the training set. Overall, the RF-IWOA-GRU model outperforms all other models in prediction accuracy.
To quantitatively compare the prediction performance of the RF-IWOA-GRU model with that of other neural network models, mean absolute error (MAE), mean absolute percentage error (MAPE), and root mean square error (RMSE) were used as error metrics. The smaller these error metrics, the better the model’s compensation effect. The definitions of these error metrics are as follows:
MAE = 1 n i = 1 n y ^ i y i
MAPE = 1 n i = 1 n y ^ i y i y ^ i × 100 %
RMSE = 1 n i = 1 n y ^ i y i 2
where y ^ i is the predicted value, y i is the actual value, and n is the number of samples.
From Table 2, it can be seen that the RF-IWOA-GRU model outperforms the other models. Specifically, the proposed RF-IWOA-GRU model reduces the MAE by 68.36%, 62.99%, 32.44%, and 28.77%, and the RMSE by 68.43%, 61.92%, 32.85%, and 24.15% compared to other models. This indicates that the RF-IWOA-GRU model can better extract the characteristics of the pressure sensor and has more minor prediction deviations.
Additionally, the prediction performance of the GRU and LSTM models is relatively close. Compared to the LSTM model, the GRU model omits the separate output gate, using only the update and reset gates to solve the gradient vanishing and exploding problems, reducing computational cost requirements and improving computational efficiency. Among the five models, the BP neural network performs the worst, indicating its lack of capability in handling time series data and capturing the intrinsic relationship between temperature drift data caused by thermal hysteresis. Moreover, the performance of RNN is significantly lower compared to that of the GRU and LSTM models, as RNN fails to capture the long-term dependency of temperature drift on previous information. This result also highlights the importance of long-term memory in modeling. Notably, the IWOA-GRU model’s prediction performance surpasses that of GRU, demonstrating that the IWOA can find better hyper-parameters, and the GRU model is sensitive to hyper-parameter settings. The IWOA can prevent GRU from converging to local optima and enhance the model’s robustness and generalization ability.
The same experiments and quantitative analyses were conducted using the test set to validate the proposed model’s effectiveness further. Figure 9 shows the uncompensated error and the error after compensation of each model on the test set. The error metrics for each model are shown in Table 3. The table shows that the RF-IWOA-GRU model performs the best, with model performance rankings similar to those in the training set results. Notably, compared to the uncompensated error, the MAE after temperature compensation using the proposed model decreased by 75.10%, and the RMSE decreased by 76.15%. Additionally, the standard deviation of the compensated pressure decreased from 10.18 kPa to 1.14 kPa.
In summary, the proposed RF-IWOA-GRU model was validated for the temperature compensation of the pressure sensors. The comparison with other models indicated that the RF-IWOA-GRU model excels in prediction accuracy and computational efficiency.

5. Conclusions

In this study, we proposed a novel temperature compensation method for piezoresistive pressure sensors based on GRU optimized by the IWOA. Our experiments demonstrated that the RF-IWOA-GRU model outperforms traditional compensation models regarding prediction accuracy and computational efficiency.
The GRU model, with its simpler structure compared to that of LSTM and its ability to handle long-term dependencies, proved effective in capturing the intrinsic relationship between the output of the sensor and temperature. The integration of the IWOA with GRU further enhanced the model’s performance by optimizing its hyper-parameters, thereby preventing the model from converging to local optima and improving its robustness and generalization ability. In conclusion, the proposed RF-IWOA-GRU model provides a robust and efficient solution for temperature compensation in piezoresistive pressure sensors and is a reference for other types of sensors.

Author Contributions

Conceptualization, M.L. and Z.W.; methodology, M.L.; software, M.L.; validation, M.L., Z.W. and P.J.; formal analysis, Z.W. and P.J.; investigation, M.L. and Z.W.; resources, G.Y.; data curation, P.J.; writing—original draft preparation, M.L.; writing—review and editing, Z.W., P.J. and G.Y.; supervision, Z.W.; project administration, Z.W.; funding acquisition, G.Y. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the National Natural Science Foundation of China under grant number 62273225 and 62103263, the Science and Technology Commission of Shanghai Municipality under grant number 21ZR1429900, and the China Postdoctoral Science Foundation under grant number 2022M712093.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The data presented in this study are available on request from the corresponding author. The data are not publicly available due to privacy restrictions.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
SVMSupport vector machine
ANNArtificial neural network
RFRandom forest
GRUGated recurrent unit
WOAWhale optimization algorithm
IWOAImproved whale optimization algorithm
ELMExtreme learning machines
LSSVMLeast squares support vector machine
BPBackpropagation
RBFRadial basis function
CSOChicken swarm optimization
WNNWavelet neural network
RNNRecurrent neural network
LSTMLong–short-term memory
CARTClassification and regression tree
MAMoving average
MAEMean absolute error
MAPEMean absolute percentage error
RMSERoot mean square error

References

  1. Hommel, M.; Knab, H.; Yousef, S.G. Reliability of automotive and consumer MEMS sensors-An overview. Microelectron. Reliab. 2021, 126, 114252. [Google Scholar] [CrossRef]
  2. Kim, T.Y.; Suh, W.; Jeong, U. Approaches to deformable physical sensors: Electronic versus iontronic. Mater. Sci. Eng. R Rep. 2021, 146, 100640. [Google Scholar] [CrossRef]
  3. Huang, Y.; Fan, X.; Chen, S.C.; Zhao, N. Emerging technologies of flexible pressure sensors: Materials, modeling, devices, and manufacturing. Adv. Funct. Mater. 2019, 29, 1808509. [Google Scholar] [CrossRef]
  4. Balavalad, K.B.; Sheeparamatti, B. Design simulation and analysis of piezoresistive micro pressure sensor for pressure range of 0 to 1 MPa. In Proceedings of the 2016 International Conference on Electrical, Electronics, Communication, Computer and Optimization Techniques (ICEECCOT), Mysuru, India, 9–10 December 2016; pp. 345–349. [Google Scholar]
  5. Wu, S.; Zhang, T.; Li, Z.; Jia, J.; Deng, Y.; Xu, P.; Shao, Y.; Deng, D.; Hu, B. Temperature characteristic and compensation algorithm for a marine high accuracy piezoresistive pressure sensor. J. Mar. Eng. Technol. 2020, 19, 207–214. [Google Scholar] [CrossRef]
  6. Tufte, O.; Stelzer, E. Piezoresistive properties of silicon diffused layers. J. Appl. Phys. 1963, 34, 313–318. [Google Scholar] [CrossRef]
  7. Chou, T.L.; Chu, C.H.; Lin, C.T.; Chiang, K.N. Sensitivity analysis of packaging effect of silicon-based piezoresistive pressure sensor. Sens. Actuators A Phys. 2009, 152, 29–38. [Google Scholar] [CrossRef]
  8. Wang, H.; Zeng, Q.; Zhang, Z.; Zou, Y. A novel whale-based algorithm for optimizing the ANN approach: Application to temperature compensation in pressure scanner calibration systems. Meas. Sci. Technol. 2023, 34, 095904. [Google Scholar] [CrossRef]
  9. Barlian, A.A.; Park, W.T.; Mallon, J.R.; Rastegar, A.J.; Pruitt, B.L. Semiconductor piezoresistance for microsystems. Proc. IEEE 2009, 97, 513–552. [Google Scholar] [CrossRef] [PubMed]
  10. Tran, A.V.; Zhang, X.; Zhu, B. The development of a new piezoresistive pressure sensor for low pressures. IEEE Trans. Ind. Electron. 2017, 65, 6487–6496. [Google Scholar] [CrossRef]
  11. Jeong, T. Design and modeling of sensor behavior for improving sensitivity and performance. Measurement 2015, 62, 230–236. [Google Scholar] [CrossRef]
  12. Samy, I.; Postlethwaite, I.; Gu, D.W. Unmanned air vehicle air data estimation using a matrix of pressure sensors: A comparison of neural networks and look-up tables. Proc. Inst. Mech. Eng. Part G J. Aerosp. Eng. 2011, 225, 807–820. [Google Scholar] [CrossRef]
  13. Zhao, X.; Chen, Y.; Wei, G.; Pang, L.; Xu, C. A comprehensive compensation method for piezoresistive pressure sensor based on surface fitting and improved grey wolf algorithm. Measurement 2023, 207, 112387. [Google Scholar] [CrossRef]
  14. Wang, J.; Hu, G.; Li, J.; Zhou, Y.; Zou, C.; Jahangir Alam, S.M. Research on temperature compensation of piezo-resistive pressure sensor based on Newton interpolation and spline interpolation. In Proceedings of the 2021 IEEE 15th International Conference on Electronic Measurement & Instruments (ICEMI), Nanjing, China, 29–31 October 2021; pp. 109–113. [Google Scholar]
  15. Suykens, J.A.; Vandewalle, J. Least squares support vector machine classifiers. Neural Process. Lett. 1999, 9, 293–300. [Google Scholar] [CrossRef]
  16. Li, X.; Ke, S.; Li, Y.; Jin, W.; Fu, X.; Fu, G.; Bi, W. Temperature compensation based on BP neural network with small sample data for chloride ions optical fiber probe. Opt. Laser Technol. 2024, 176, 110973. [Google Scholar] [CrossRef]
  17. Wang, H.; Zeng, Q.; Zhang, Z.; Wang, H. Research on temperature compensation of multi-channel pressure scanner based on an improved cuckoo search optimizing a BP neural network. Micromachines 2022, 13, 1351. [Google Scholar] [CrossRef] [PubMed]
  18. Fu, G.; Gong, H.; Gao, H.; Gu, T.; Cao, Z. Integrated thermal error modeling of machine tool spindle using a chicken swarm optimization algorithm-based radial basic function neural network. Int. J. Adv. Manuf. Technol. 2019, 105, 2039–2055. [Google Scholar] [CrossRef]
  19. Ge, Y.; Shen, L.; Sun, M. Temperature compensation for optical fiber graphene micro-pressure sensor using genetic wavelet neural networks. IEEE Sens. J. 2021, 21, 24195–24201. [Google Scholar] [CrossRef]
  20. LeCun, Y.; Bengio, Y.; Hinton, G. Deep learning. Nature 2015, 521, 436–444. [Google Scholar] [CrossRef]
  21. Ribeiro, A.H.; Tiels, K.; Aguirre, L.A.; Schön, T. Beyond exploding and vanishing gradients: Analysing RNN training using attractors and smoothness. In Proceedings of the International Conference on Artificial Intelligence and Statistics, PMLR, Online, 26–28 August 2020; pp. 2370–2380. [Google Scholar]
  22. Hochreiter, S.; Schmidhuber, J. Long short-term memory. Neural Comput. 1997, 9, 1735–1780. [Google Scholar] [CrossRef]
  23. Li, L.; Xiang, S.; Han, M.; Yan, J. Performance Improvement of Multisensor Systems Using Autocompensation Strategy-based LSTM. IEEE Trans. Instrum. Meas. 2024, 73, 2511511. [Google Scholar] [CrossRef]
  24. Ouyang, M.; Gao, J.; Li, A.; Zhang, X.; Shen, C.; Cao, H. Micromechanical gyroscope temperature compensation based on combined LSTM-SVM-DBN algorithm. Sens. Actuators A Phys. 2024, 369, 115128. [Google Scholar] [CrossRef]
  25. Zhao, D.; Liu, Y.; Wu, X.; Dong, H.; Wang, C.; Tang, J.; Shen, C.; Liu, J. Attitude-Induced error modeling and compensation with GRU networks for the polarization compass during UAV orientation. Measurement 2022, 190, 110734. [Google Scholar] [CrossRef]
  26. Thaysen, J.; Boisen, A.; Hansen, O.; Bouwstra, S. Atomic force microscopy probe with piezoresistive read-out and a highly symmetrical Wheatstone bridge arrangement. Sens. Actuators A Phys. 2000, 83, 47–53. [Google Scholar] [CrossRef]
  27. Tran, A.V.; Zhang, X.; Zhu, B. Mechanical structural design of a piezoresistive pressure sensor for low-pressure measurement: A computational analysis by increases in the sensor sensitivity. Sensors 2018, 18, 2023. [Google Scholar] [CrossRef]
  28. Nagarajan, P.R.; George, B.; Kumar, V.J. A linearizing digitizer for wheatstone bridge based signal conditioning of resistive sensors. IEEE Sens. J. 2017, 17, 1696–1705. [Google Scholar] [CrossRef]
  29. Meena, K.; Mathew, R.; Leelavathi, J.; Sankar, A.R. Performance comparison of a single element piezoresistor with a half-active Wheatstone bridge for miniaturized pressure sensors. Measurement 2017, 111, 340–350. [Google Scholar] [CrossRef]
  30. Park, Y.; Luan, H.; Kwon, K.; Chung, T.S.; Oh, S.; Yoo, J.Y.; Chung, G.; Kim, J.; Kim, S.; Kwak, S.S.; et al. Soft, full Wheatstone bridge 3D pressure sensors for cardiovascular monitoring. npj Flex. Electron. 2024, 8, 6. [Google Scholar] [CrossRef]
  31. Singh, K.; Alvi, P. Influence of the pressure range on temperature coefficient of resistivity (TCR) for polysilicon piezoresistive MEMS pressure sensor. Phys. Scr. 2020, 95, 075005. [Google Scholar]
  32. Kanda, Y. A graphical representation of the piezoresistance coefficients in silicon. IEEE Trans. Electron Devices 1982, 29, 64–70. [Google Scholar] [CrossRef]
  33. Ali, I.; Asif, M.; Shehzad, K.; Rehman, M.R.U.; Kim, D.G.; Rikan, B.S.; Pu, Y.; Yoo, S.S.; Lee, K.Y. A highly accurate, polynomial-based digital temperature compensation for piezoresistive pressure sensor in 180 nm CMOS technology. Sensors 2020, 20, 5256. [Google Scholar] [CrossRef]
  34. Xie, J.; Li, Z.; Zou, X. Dynamic Temperature Compensation of Pressure Sensors in Migratory Bird Biologging Applications. Electronics 2023, 12, 4373. [Google Scholar] [CrossRef]
  35. Yue, Y.L.; Xu, S.J.; Zuo, X. Nonlinear correction method of pressure sensor based on data fusion. Measurement 2022, 199, 111303. [Google Scholar]
  36. Xia, J.; Zhang, S.; Cai, G.; Li, L.; Pan, Q.; Yan, J.; Ning, G. Adjusted weight voting algorithm for random forests in handling missing values. Pattern Recognit. 2017, 69, 52–60. [Google Scholar]
  37. Feng, R.; Grana, D.; Balling, N. Imputation of missing well log data by random forest and its uncertainty analysis. Comput. Geosci. 2021, 152, 104763. [Google Scholar]
  38. Chung, J.; Gulcehre, C.; Cho, K.; Bengio, Y. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv 2014, arXiv:1412.3555. [Google Scholar]
  39. Chen, Y.; Xu, C.; Zhao, X. Research on soft compensation of the potential drift signal of a pH electrode based on a gated recurrent neural network. Meas. Sci. Technol. 2022, 34, 025107. [Google Scholar] [CrossRef]
  40. Han, S.; Meng, Z.; Zhang, X.; Yan, Y. Hybrid deep recurrent neural networks for noise reduction of MEMS-IMU with static and dynamic conditions. Micromachines 2021, 12, 214. [Google Scholar] [CrossRef] [PubMed]
  41. Mirjalili, S.; Lewis, A. The whale optimization algorithm. Adv. Eng. Softw. 2016, 95, 51–67. [Google Scholar]
  42. Chatterjee, S.; Roy, S.; Das, A.K.; Chattopadhyay, S.; Kumar, N.; Vasilakos, A.V. Secure biometric-based authentication scheme using Chebyshev chaotic map for multi-server environment. IEEE Trans. Dependable Secur. Comput. 2016, 15, 824–839. [Google Scholar] [CrossRef]
  43. Wu, G.; Li, Y. Non-maximum suppression for object detection based on the chaotic whale optimization algorithm. J. Vis. Commun. Image Represent. 2021, 74, 102985. [Google Scholar]
  44. Nickabadi, A.; Ebadzadeh, M.M.; Safabakhsh, R. A novel particle swarm optimization algorithm with adaptive inertia weight. Appl. Soft Comput. 2011, 11, 3658–3670. [Google Scholar] [CrossRef]
Figure 1. Schematic diagram of the pressure sensor. (a) Structure of piezoresistive pressure sensor. (b) Wheatstone bridge.
Figure 1. Schematic diagram of the pressure sensor. (a) Structure of piezoresistive pressure sensor. (b) Wheatstone bridge.
Sensors 24 05394 g001
Figure 2. The schematic diagram of GRU.
Figure 2. The schematic diagram of GRU.
Sensors 24 05394 g002
Figure 3. Architecture of RF-IWOA-GRU network model.
Figure 3. Architecture of RF-IWOA-GRU network model.
Sensors 24 05394 g003
Figure 4. Experimental environment and equipment.
Figure 4. Experimental environment and equipment.
Sensors 24 05394 g004
Figure 5. The time series data.
Figure 5. The time series data.
Sensors 24 05394 g005
Figure 6. The relationship between uncompensated error and temperature.
Figure 6. The relationship between uncompensated error and temperature.
Sensors 24 05394 g006
Figure 7. The errors at different temperatures and actual pressures.
Figure 7. The errors at different temperatures and actual pressures.
Sensors 24 05394 g007
Figure 8. The actual pressure and the predictions of each model.
Figure 8. The actual pressure and the predictions of each model.
Sensors 24 05394 g008
Figure 9. Uncompensated and compensated errors on test set.
Figure 9. Uncompensated and compensated errors on test set.
Sensors 24 05394 g009
Table 1. Model setting parameters.
Table 1. Model setting parameters.
Model ParameterNumerical Value
Initial learning rate0.001–0.01
Batch size10–250
Number of neurons2–50
Table 2. Prediction error on the training set.
Table 2. Prediction error on the training set.
ModelMAEMAPERMSE
BP2.0890.01292.616
RNN1.7860.01032.169
LSTM0.9760.00631.230
GRU0.9280.00601.089
IWOA-GRU0.6610.00430.826
Table 3. Prediction error on the test set.
Table 3. Prediction error on the test set.
ModelMAEMAPERMSE
Uncompensated8.2600.040210.18
BP4.2590.02675.403
RNN3.5610.01984.244
LSTM2.8960.01563.616
GRU2.7870.01723.338
IWOA-GRU2.0270.01242.428
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Liu, M.; Wang, Z.; Jiang, P.; Yan, G. Temperature Compensation Method for Piezoresistive Pressure Sensors Based on Gated Recurrent Unit. Sensors 2024, 24, 5394. https://doi.org/10.3390/s24165394

AMA Style

Liu M, Wang Z, Jiang P, Yan G. Temperature Compensation Method for Piezoresistive Pressure Sensors Based on Gated Recurrent Unit. Sensors. 2024; 24(16):5394. https://doi.org/10.3390/s24165394

Chicago/Turabian Style

Liu, Mian, Zhiwu Wang, Pingping Jiang, and Guozheng Yan. 2024. "Temperature Compensation Method for Piezoresistive Pressure Sensors Based on Gated Recurrent Unit" Sensors 24, no. 16: 5394. https://doi.org/10.3390/s24165394

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop