1

Neural Network Based Sensor Linearization KUNDAN KUMAR Roll Number 05EC1019 Department of Electronics and Electrical Communication Engineering Indian Institute of Technology, Kharagpur-721302, India E-mail: [email protected]

Abstract One of the most important parameters required in most sensors design is an essential linear output. However, nonlinearity is present in one form or another in almost all real sensors and therefore it is very difficult to achieve a true linear relationship. Analog circuits are one of the common solutions adopted for improving the linearity of the sensor characteristics, but sometimes complex circuits are needed and it can be difficult to cope with component tolerances. The use of a Look-up Table is another solution but the amount of memory requirement can be an important problem. In this paper a procedure for extending the linear range of an arbitrary sensor is proposed. The process is carried out by a neural network which compensates the sensor nonlinear characteristic. The method is suitable for embedded systems based on standard microcontrollers in which the neural network can be programmed without requiring any extra hardware. For the application example, a Negative Temperature Coefficient (NTC) Resistor Sensor is used. Its implementation is analyzed in low resolution microcontrollers. Problem Definition and Details Thermistor (made from the words thermal and resistor) is a temperature measuring device based on its temperature versus resistance characteristics. If the temperature coefficient of resistance is negative, resistance decreases with increase in temperature and the device is called a Negative Temperature Coefficient (NTC) thermistor. But as expected, the resistance versus temperature characteristic of a typical NTC resistor is highly non-linear. For accurate temperature measurements the resistance/temperature curve is given by Steinhart-Hart equation (equation1).

1 = a + b ln R + c ln 3 R T

……………………. ( 1 ) Where a, b and c are Steinhart-Hart parameters.

However, in a limited range, the behavior can be modeled by setting c equals to zero in the Steinhart-Hart equation. Applying the first order expansion, the characteristic can be given as

R(T ) = R0 exp( B(T −1 − T0−1 )

…………………….. ( 2 ) Where B and R0 are sensor parameters T0 is a reference temperature

Equation (2) models the sensor behavior in the range of about 60 0C. So, we will limit our study considering this 60 0 C range only. As equation (2) suggests, resistance has a high degree non linear

2 relationship with temperature for this range. The curve is drawn in Figure 2(a) for a 10 k Ω thermistor (10 k Ω at 25 0C).

Figure 2.(a) Resistance versus temperature characteristic of a 10k Ω thermistor (b) Resistor Divider; VT varies as the function of temperature Now, to carry out a resistance to voltage (directly measurable) conversion, the NTC is placed in a resistive voltage divider as shown in Figure 2(b). The resulting output voltage VT presents a global nonlinear dependence on temperature. The task is to generate an ANN model which can produce a linear output corresponding to every input in the range with minimum error. Application of Neural Network in Linearization Sensor linearization can be considered a function estimation (modeling) task, where the nonlinear sensor output can be used as input data and the desired linearized response as target data. One approach is to use these input-output data pairs as a training set. The ANN should learn from these data a particular sensor linearization procedure. There may be another approach in which the target values are the difference between the ideal (linear) output and the (nonlinear) sensor one. Thus, the neural network output provides a correction, which, when added to the nonlinear sensor output, gives a global linear response. The second approach is shown to be more effective and hence is adopted in the linearization technique. The schematic for this approach is shown in Figure 3.

Figure 3.Structure of the proposed linearization scheme The resistive divider output VT is used as the only ANN input as shown in the Figure 3. Target values for the ANN are the difference between the ideal linear output VLIN and the resistive divider output VT. Training inputs for the ANN are calculated from the NTC characteristic given in equation (2) and outputs (targets) from a desired linear response.

3 A Multi Layer Perceptron (MLP) is trained using these data. The structure of this MLP is shown in Figure (4). It contains an input layer, an output layer and a hidden layer with two nonlinear nodes. After all the training, all the information of the remains embedded in the only seven neural network weights as shown in the Figure (4).

Figure 4. MLP architecture and the seven weight values achieved This MLP uses a hyperbolic tangent function as the activation function. The final linear response VLIN is obtained by adding the ANN output VANN to the nonlinear output of the resistive divider VT. The graph in Figure 5 compares the NTC output VT and the neural linearized VLIN with the ideal linear response as given by simulation in floating point. From this graph, it can be seen that this linearizing procedure gives linearity errors less than 0.5 0C in an interval of 60 0C (from 268K to 328K).

Figure 5. ANN output error and nonlinear NTC error for the model (simulated in floating point) Only seven weight values and a piecewise linear approximation of the nonlinear activation function (as we will see later) makes this solution requiring very less memory. Implementation and Results Due to the low size of the neural network used in the procedure (only seven weight values), it could be implemented in embedded systems based on standard microcontrollers or fixed-point digital signal processors. After training, the resulting ANN should be discretized and programmed into a low-resolution (low cost) microprocessor or microcontroller system. It requires a very low memory and also very low cost.

4 The implementation of the nonlinear activation function of the hidden neurons is the most important problem in this case. In an MLP, this function usually has the form given by equation (3).

f ( x ) = tanh x =

1 1 + e− x

……………………… ( 3 )

Although this function has a great complexity, it can be implemented by piecewise-linear approximation. It can be shown (by computer simulation) that the results obtained by dividing the activation function (as given in equation (3) ), into nine linear pieces, are very similar to those achieved with the original one. Figure (6) compares the piecewise linear approximation with the original function. X is the neuron activation (weighted sum of inputs minus a bias) and y is the neuron output.

Figure 6. (a) Original activation function (b) Piecewise linear approximation of the activation function Now, the neural network is implemented in a microcontroller with a 16-bit fixed-point resolution and the activation function is approximated by the piecewise linear approximation as stated above. Figure (7) depicts both ANN output error and NTC error and again we can see that the linearity error given by the ANN is less than 0.5% in the same 60 0C range.

Figure 7. ANN output error and nonlinear NTC error for the model Implemented by Piecewise linear approximation and 16-bit fixed-point resolution

5

Conclusion and Summary In this paper, a technique for sensor linearization based on a simple neural network model (with only seven weights) is proposed. Thus, with this procedure the ANN can be programmed into an embedded microcontroller system with optimal results, requiring far less memory than if an LUT is used. Moreover, the error, which is less than 0.5% in this example, is very much acceptable in almost all of the application. Future Directions This paper aims at the linearization of a sensor having an accurate mathematical expression. But, this method can be even extended to the sensors lacking an accurate mathematical expression. In this case, we can use the experimental data as the training set. Also, this linearization principle using a neural network, can be applied in many more areas other than sensors. For example, in many cases linear output is expected but due to non-ideal components and measuring errors, the output shows a nonlinear characteristic. In these type of situatioons, the experimental data can be used to train the ANN and a very simple embedded microcontroller to program it within the system. Based on the degree of nonlinearity of the system, number of hidden layers and hidden nodes can also be increased. But, with the increase in nonlinearity of the system, ANN gets complicated i.e. stores the information in more number of weights. This leads to requirement of a larger memory than used in the example of the NTC thermistor and hence a complex implementation of ANN within the system. However, the benefit gained from the linearization can compensate for the increase in the memory (and hence the cost). References (1) Bonifacio Martin-del-Brio and Nicolas J. Medrano-Marques: “Sensor Linearization With Neural Networks”, IEEE transaction on Industrial Electronics, VOL. 48, NO. 6, December 2001, On Pages: 1288-1290 (2) Sensors Insight, article by Bonnie C. Baker, Microchip Technology Inc. : “ Advances in Measuring with Nonlinear Sensors “ http://www.sensorsmag.com/sensors/article/articleDetail.jsp?id=185898&pageID=1&sk=&date= (3) Wikipedia, article : “ Thermistor ” http://en.wikipedia.org/wiki/Thermistor

( ) RTR

The resistive divider output VT is used as the only ANN input as shown in the ... After training, the resulting ANN should be discretized and programmed into a ...

111KB Sizes 2 Downloads 168 Views

Recommend Documents

RTR 2017 - Sponsorship Packet.pdf
Page 1 of 4. April 6 thursday. 5:30 - 9:00pm. iWireless Center. Moline, IL SHENEA BROCKMAN. BD. DESIGNS. S. cocktail hour. unway. the R. recycle.

RTR Race Bible 2017_1.pdf
If you are. pulled from the race, you are not allowed to race or ride on the course while the race is. still in progress. • Lapped riders will be pulled from the race.

RTR Race Bible 2017_1.pdf
promo code “Youthrock” at check-out to receive discount. • DISC BRAKES ARE NOT ALLOWED AT THIS TIME. If UCI changes the rule prior to the race,. they will ...