Implementation of Artificial Neural Network-Based Signal Conditioning Circuit for a Temperature Transducer

Thermistors are widely used as temperature transducers due to their low cost, small dimensions, and high sensitivity. However, their nonlinear resistance-temperature characteristics make their use in temperature measurement and control applications challenging. This paper presents a new method to linearize thermistors using an op-amp-based astable multivibrator and an artificial neural network. The proposed technique involves obtaining frequency values corresponding to the resistance values of the thermistor using an op-amp-based astable multivibrator circuit. The nonlinear frequency data obtained can then be used to train an ANN to obtain the best-fit linear curve. A signal conditioning circuit is then constructed that takes the read frequency value and matches it to its corresponding linearized value, which is displayed. The method offers several advantages over traditional techniques, including improved accuracy and reduced cost. Additionally, it can improve the accuracy of measuring temperature, and control applications by eliminating the nonlinearities associated with thermistors.


I. INTRODUCTION
A thermistor functions as a resistor that adjusts its resistance in reaction to fluctuations in temperature.It stands out for its heightened sensitivity to temperature changes compared to standard resistors.The term "thermistor" is derived from the fusion of "thermal" and "resistor."Two categories of thermistors exist based on their resistance-temperature relationship: Negative Temperature Coefficient (NTC) thermistors, exhibiting decreased resistance at elevated temperatures, and Positive Temperature Coefficient (PTC) thermistors, showcasing increased resistance with rising temperatures.NTC thermistors find widespread use in curbing inrush current and temperature measurement, while PTC thermistors serve as safeguards against overcurrent and self-regulating heating elements.The operational temperature range of a thermistor is contingent on the probe type and typically spans from −100 °C and 300 °C (−148 °F and 572 °F) [1] [2].
The correlation between temperature and resistance in a thermistor is nonlinear [3] [4].This signifies that the relationship between resistance and temperature is not linear.For example, in the case of an NTC thermistor, there is a negative temperature coefficient of resistance, indicating that its resistance diminishes as the temperature rises.This nonlinearity poses difficulties in digital readout, wireless transmission, and other on-chip interfaces.Consequently, the implementation of a linearizer becomes essential to mitigate these challenges [5].
Over the past few decades, numerous methods have been put forth to linearize NTC thermistors.One notable research paper suggests a cost-effective approach that involves employing an operational amplifier to construct an inverting amplifier circuit with the thermistor, as outlined in reference [6].Experimental validation of this system demonstrated its performance, achieving a linearity of approximately ± 1% across a temperature range from 30 °C to 120 °C.Notably, when utilized within a narrower temperature range, the linearity was markedly enhanced, reaching ± 0.5% [7] [8].
An additional study employs the Steinhart-Hart equation for the generation of a generic model.Subsequently, the model is subjected to a linearization algorithm based on the Levenberg-Marquardt back-propagation technique, incorporating a sigmoid activation function [9].The entire modeling process and scripting of the linearization algorithm were executed within the MATLAB framework.The outcomes demonstrate minimal linearity errors optimized within the Chebyshev norms [10] [11].A third paper suggests a real-time implementation of Hybrid Neuro Fuzzy Logic (HNFL) utilizing Field Programmable Gate Array (FPGA) technology [12].

A. Procedure for Linearization
In Fig. 1, the process for acquiring linear R-T characteristics for the 20D-9 NTC thermistor is depicted.This particular thermistor, known for its compact size and high-quality temperature transduction, represents a versatile choice [13].Encased in epoxy, these chip thermistors offer genuine interchangeability over extensive temperature spans, facilitating standardization in circuit design.This eliminates the need for custom circuit adjustments and simplifies the replacement of thermistors without necessitating recalibration [14].

B. Levenberg-Marquardt Algorithm
To establish the optimal linear curves between temperature and frequency, as well as between frequency and resistance, the Levenberg-Marquardt algorithm is employed.Also recognized as the damped least-squares method, this algorithm proves effective in determining the best-fit linear relationships for temperature-to-frequency and frequency-to-resistance connections.Widely utilized in addressing nonlinear least squares problems inherent in curve fitting applications, the Levenberg-Marquardt algorithm combines elements of the Gauss-Newton algorithm and the gradient descent method [15] [16].Notably, its robust nature surpasses that of the Gauss-Newton algorithm, enabling it to converge to a solution even when the initial estimate is considerably distant from the ultimate minimum [17].
The algorithm functions as a numerical optimization that amalgamates the principles of two other methods-namely, the gradient descent and the Gauss-Newton methods.In the gradient descent method, parameter updates occur in the direction of the steepest descent to minimize the sum of squared errors.On the other hand, the Gauss-Newton method assumes local quadratic behavior in the least squares function for the parameters, seeking the minimum of this quadratic function to minimize the sum of squared errors.The algorithm demonstrates behavior akin to the gradient descent method when parameters are considerably distant from their optimal values and more closely resembles the Gauss-Newton method when parameters are in proximity to their optimal values [18].

C. Least Squares Polynomial Fit
Polynomial regression is an approach employed to characterize the association between a dependent variable y and an independent variable x by applying an n th degree polynomial fit to the dataset.The estimation assumes linearity due to that of the regression function E(y|x).This function represents the anticipated value of y given x.While the model is nonlinear, the problem of estimation is linear as it involves estimating unknown parameters in the linear regression function E(y|x), as derived from the data [19] [20].

D. 20D-9 Thermistor Characteristics
The 20D-9 thermistor underwent testing across temperatures ranging from 27 °C to 100 °C, and the corresponding resistance values (in ohms) were recorded.The resistance values R i for the temperatures T i are presented in Table I.
The nonlinearity of the resistance-temperature characteristics of the thermistor is apparent in Fig. 2. In the process of linearization, it is necessary to convert the resistance values into a measurable signal.The astable multivibrator configuration of the 741 Operational Amplifier proves useful in generating a square wave output, where the width of the wave is influenced by the thermistor's resistance.This phenomenon occurs because the resistance, changing with temperature, impacts the charging and discharging time of the capacitor within the circuit.Consequently, the temperature variation of the thermistor allows for control over the frequency and duty cycle of the square wave output.The nonlinear data acquired can be employed to train an ANN using a language such as Python, aiming to derive the necessary best-fit linear curves.Table II presents the obtained frequency values F i corresponding to the resistances R i .The frequency values exhibit a notable correlation with the resistance values, making them suitable as training data for ANNs employing algorithms like Levenberg-Marquardt and Least Squares Polynomial fit.The subsequent phase involves constructing the ANNs to generate equations that take the frequency values F i as input and produce adjusted resistance and temperature values conforming to linearity.The process of linearization is not directly physical but relies on strategic computational calculations.

E. Obtaining Mathematical Relations
Utilizing the Least Squares Polynomial fit, the ANN can infer a third-degree polynomial curve that provides a rough relationship between T i and F i values, as expressed in (1).The ANN model additionally determines the coefficients of the polynomial, enabling the estimation of approximate temperature values T a : In Fig. 3, the optimal-fit polynomial is illustrated over the T i and F i values.The Levenberg-Marquardt algorithm is employed to derive the most fitting linear curve for the recorded temperature T i values and frequencies F i .This is crucial to ensure that when a temperature value T a is read from F i , the resultant linearized frequency value F L is obtained.Upon determining the fitted coefficients of the linear curve, the expression is derived as in (2): In Fig. 4, the linear fit curve is depicted, considering the nonlinear relationship between T i and F i .To derive the best fitting linear curve for frequencies F i and resistances R i , enabling the extraction of linearized resistance value R L from linearized frequency values F L , the L-M algorithm is employed again.The expression is provided in (3): 3 Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.From ( 2) and ( 3), the linear relationship between resistances R L and temperatures T L can be derived, as expressed in (4): Using ( 4), the temperature value T L can be inferred based on the linearized resistance value R L .Fig. 5 and 6 depict the linear F-T and R-T curves derived from the adjusted values using the obtained equations.This dataset facilitates the extraction of linearized frequency, resistance, and temperature values from any given input frequency F i .Table III presents the estimated temperature values T a and the linearized F L , T L , and R L values for the utilized temperature range, which is employed to generate the graphs.

III. MEASURING SETUP A. Frequency Measurement using Op-Amp Circuit
Frequency measurement is employed because resistance cannot be directly utilized for linearization.To address this, Fig. 6.Linearized R-T graph.the 741 Operational Amplifier in an astable multivibrator configuration can be employed to convert resistance values into corresponding square wave frequencies.Fig. 7 illustrates the block diagram, including an oscilloscope to monitor the output waveform.

B. Simulation and Theoretical Calculations
To ascertain the optimal values for the capacitor and resistor of the astable circuit, ensuring a consistent square wave, the circuit is initially simulated in NI Multisim before physical assembly.The circuit diagram is depicted in Fig. 9. Instead of an actual thermistor, a resistor with adjustable resistance values is employed.The frequency of the square wave is visualized on the virtual oscilloscope, as illustrated in Fig. 10.It is observed that the frequency of the square wave, with a resistance of 20.1 Ω, is approximately 150 hertz.To validate the simulated values, the theoretical frequency values are derived from the established relationship between resistance and time period of the astable configuration, as expressed in (5): According to Fig. 9, the fixed parameters are Table IV compares the frequency values obtained through theoretical calculation, simulation, and the practical circuit.The values have a high degree of proximity, ensuring consistent measurements across the temperature range.

IV. DETECTING TEMPERATURE A. Arduino Uno circuit
For detecting an unknown temperature and acquiring the linearized frequency, resistance, and temperature values, an Arduino Uno is utilized.The Arduino Uno retrieves the frequency values from the astable circuit, calculates the linearized values using the equations generated by the ANN network, and showcases these values on a graphical OLED display.Fig. 11 illustrates the connections.

B. Calculation of Linearized Values
For instance, if F x represents the frequency acquired at an unknown temperature, the linearized values are determined by substituting F x into equations ( 1)-( 4).The resulting equations are as follows: where F L , R L , and T L are the linearized values of frequency, resistance, and temperature displayed on the OLED.

V. RESULTS
The circuit interfaced with Arduino underwent testing by heating the thermistor from 27 °C to 100 °C, and the corresponding linearized values are observed, as presented in Table V.It is observed that the values are slightly different from those obtained in Table III due to Arduino rounding off the digits during calculation.The physical circuit setup is depicted in Fig. 12.The OLED display reading for the temperature of 55 °C is shown in Fig. 13.Fig. 14 illustrates the plotted temperature and resistance values, revealing a reasonably linear relationship.In Fig. 15, a comparison is made between the measured (displayed) temperature values and the actual temperature values.An observed mean error of ± 0.69% is noted.

VI. CONCLUSION
Hence, the development of an ANN-based signal conditioning circuit and linearizer for a thermistor, employing curvefitting methods, has shown notable advantages over conventional techniques.This methodology has led to enhanced accuracy and cost reductions, positioning it as an appealing alternative for temperature measurement and control applications.The Arduino Uno platform served as an effective interface for reading input frequency values and acquiring linearized results, underscoring the potential widespread applicability of this approach.In conclusion, this study underscores the significance of exploring innovative approaches to optimize the functionality of temperature-measuring devices.

2
Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.

Fig. 3 .
Fig. 3. Plotting of the fitted polynomial over original values.

Fig. 4 .
Fig. 4. Linear fit curve over the nonlinear F-T data.

Fig. 8
Fig. 8 displays the visual representation of the square wave observed on the oscilloscope at a temperature of 55 °C.

6
Authorized licensed use limited to the terms of the applicable license agreement with IEEE.Restrictions apply.

TABLE V VALUES DISPLAYED ON OLED Actual T i
( °C) F L (Hz) R L (Ω) T L ( °C)