Next Article in Journal
The Correlation of Pickled Fish and Frequency Response Using Parallel-Coupled-Lines Band-Stop Filter Microstrip
Previous Article in Journal
A Ring Oscillator-Based Physical Unclonable Function with Enhanced Challenge–Response Pairs to Improve the Security of Internet of Things Devices
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Proceeding Paper

Accuracy of NTC Thermistor Measurements Using the Sensor to Microcontroller Direct Interface †

Department of Electrical Energy and Information Engineering “Guglielmo Marconi” (DEI), University of Bologna, 40136 Bologna, Italy
*
Author to whom correspondence should be addressed.
Presented at the 11th International Electronic Conference on Sensors and Applications (ECSA-11), 26–28 November 2024; Available online: https://sciforum.net/event/ecsa-11.
Eng. Proc. 2024, 82(1), 12; https://doi.org/10.3390/ecsa-11-20527
Published: 26 November 2024

Abstract

:
Portable and wearable sensor systems are usually based on microcontrollers or field programmable gate arrays (FPGAs), where the sensors are measured using an analog-to-digital converter (ADC). An alternative solution, with benefits in terms of cost reduction and lower power consumption, is the sensor-to-microcontroller direct interface (SMDI), a technique where the sensor is measured using the general purpose input output (GPIO) interface present on any microcontroller or FPGA. In this paper, the measurement accuracy of a non-linear temperature sensor (NTC 3950) using SMDI was evaluated by means of LTSpice simulations in the temperature range from −10 °C to 80 °C. The temperature was estimated using two different models and the results have shown that the most accurate model (Steinhart–Hart model) achieves an average temperature error of 0.078 °C.

1. Introduction

The interest in portable and wearable sensor systems is continuously increasing with impact on both research activity and market size. These systems are usually built on the paradigm of the Internet of Things (IoT), where a number of distributed sensor nodes (edge devices) communicate using wireless technologies and transfer data to a main host for data processing and analysis [1]. Portable and wearable sensor systems are adopted for a wide range of applications, such as environmental monitoring [2,3,4], microbial analysis [5,6,7,8], food safety [9,10,11,12], health monitoring [13,14,15,16], and quality analysis in industrial environments [17,18,19]. Edge devices, usually based on microcontrollers or field programmable gate arrays (FPGAs), are interfaced to the sensors using an analog-to-digital converter (ADC), that is used to measure the sensor analog output and convert it to a digital format for data processing and transmission. Edge devices are usually powered by batteries or energy harvesting; thus, their power consumption is critical and can seriously impact the sensor node lifetime [20,21].
At this regard, sensor-to-microcontroller direct interface (SMDI) is a popular technique that allows sensor measurements without an ADC with benefits in terms of cost reduction and lower power consumption [22,23]. In SMDI, the Schmitt trigger integrated in the general purpose input output (GPIO) interface of a microcontroller is exploited as an analog comparator for sensor measurements. This technique has been applied to many types of sensors, such as resistive and capacitive sensors, as well as sensors featuring an analog output voltage. A SMDI application for the measurement of three-wire [24] and four-wire [25] resistive sensors was proposed by Reverter in 2022. Techniques based on SMDI for the measurement of capacitive sensors [26] and lossy capacitive relative humidity sensors [27] were proposed by Czaja in 2020 and 2021. In 2024, Grossi presented a technique based on SMDI for the measurement of an analog voltage without an ADC and implemented it on a low-cost FPGA [28].
In the proposed study, the application of SMDI is investigated in the case of a non-linear negative temperature coefficient (NTC) thermistor using two different models (Steinhart–Hart model and polynomial model) to estimate the temperature from the sensor data. The system was tested under real operative conditions in presence of noise using LTSpice XVII simulations and the two models were compared in terms of accuracy. The results have shown that the temperature estimation using the Steinhart–Hart model provides more accurate results (average error 0.078 °C), in particular in the case of low temperatures, while the polynomial model features an average error of 0.28 °C. In Section 2, the basics of SMDI for the measurement of a resistive sensor are presented. In Section 3, the resistive temperature sensor used in the simulations and the two mathematical models for temperature estimation are presented. In Section 4, the results of the simulations are shown, while in Section 5, conclusive remarks are drawn.

2. Sensor-to-Microcontroller Direct Interface

The schematic of the circuit used to measure the resistance value of the temperature sensor using SMDI is presented in Figure 1. Here, the Schmitt trigger circuit, featuring an hysteresis window with two thresholds VH and VL, is integrated in the microcontroller GPIO interface and converts the analog voltage V1 into a digital signal V1,dig. The digital output pin (with voltage V2) is driven by the microcontroller CPU to charge/discharge the capacitance C through the non-linear temperature sensor with resistance RT.
The circuit behaves like an astable multivibrator. When the analog voltage V1 increases over VH, the signal V1,dig switches from 0 to VDD. The value of V1,dig is read by the CPU that drives the output pin to V2 = 0, and thus discharging the capacitance C. Similarly, when V1 decreases below VL, the signal V1,dig switches from VDD to 0. The value of V1,dig is read by the CPU that drives the output pin to V2 = VDD, thus charging the capacitance C.
During the charging phase of the capacitance C, the signal V1 increases from VL to VH with V2 = VDD. The circuit can be modelled with the following differential equation:
C d V 1 d t = V D D V 1 R T
Indicating with tH the rising time of signal V1, this value can be calculated by integrating the differential Equation (1).
t H = R T C V L V H 1 V D D V 1 d V 1 = R T C · l o g V D D V L V D D V H
During the discharging phase of the capacitance C, instead, the signal V1 decreases from VH to VL with V2 =0. The circuit can be modelled with the following differential equation:
C d V 1 d t = V 1 R T
Indicating with tL the falling time of signal V1, this value can be calculated by integrating the differential Equation (3), as follows:
t L = R T C V H V L 1 V 1 d V 1 = R T C · l o g V H V L
The period TP of the signals V1 and V2 can thus be calculated as follows:
T P = t H + t L = R T C · l o g V H V D D V L V L V D D V H
The period TP can be measured with a digital timer integrated in the microcontroller. Considering a case study of a 16-bit timer with a clock frequency fCLK = 64 MHz (clock period TCLK = 15.625 ns), it is TP = N·TCLK, where N is the digital counter value. Thus, the resistance value of the temperature sensor can be calculated as follows:
R T = N T C L K C · l o g V H V D D V L V L V D D V H

3. The NTC Temperature Sensor

Negative temperature coefficient (NTC) temperature sensors are non-linear resistors, whose resistance value changes with temperature. The resistance of NTC sensors decreases as the temperature increases. The characteristic of an NTC 3950 temperature sensor (Conrad Electronic, Hirschau, Germany) [29] is presented in Figure 2 in the case of the temperature range −10–80 °C.
As can be seen, the characteristic of the NTC 3950 sensor is strongly non-linear and its sensitivity, i.e., the resistance variation for temperature variations of 1 °C is higher for low temperatures.
The non-linear function that best fits the characteristic of an NTC temperature sensor is the Steinhart–Hart model, as follows:
T = 1 k 1 + k 2 l o g R T + k 3 l o g R T 3 273.15
where T is the temperature expressed in °C; RT is the temperature sensor resistance expressed in kΩ; and k1, k2, k3 are the parameters used to fit the model with the experimental data. The model defined by Equation (7) provides a good fit to the experimental data values of an NTC temperature sensor. However, the model is computationally intensive and the achieved accuracy depends on the temperature value.
A technique used to improve the linearity of the thermistor characteristic is to put a fixed resistance RP in parallel to the NTC temperature sensor. The equivalent resistance Req = RT || RP has been calculated for a set of RP values (from 100 Ω to 100 kΩ) and RT values obtained from the thermistor characteristic for temperature values in the range from −10 °C to 80 °C. The characteristic of temperature as function of Req was fitted to a linear regression line and the mean squared error (MSE) resulting from the temperature estimation using the regression line was calculated for each value of RP. The results are presented in Figure 3.
The value of RP that maximizes the linearity between the temperature and Req (i.e., it achieves the minimum MSE) is 5.41 kΩ. The characteristic of the temperature as a function of the resistance Req is presented in Figure 4, in the case of RP = 5.41 kΩ.
The characteristic shown in Figure 4 can be modelled using a polynomial equation of order 3, as follows:
T = h 1 + h 2 R e q + h 3 R e q 2 + h 4 R e q 3
where T is the temperature expressed in °C; Req = RT || RP is expressed in kΩ; and h1, h2, h3, h4 are parameters used to fit the model with the experimental data.
The models defined by Equations (7) and (8) were fitted to the temperature sensor characteristic obtained from its data sheet and the error in the estimated temperature (|ΔT|) calculated and plotted vs. the environmental temperature T for both models. The results are presented in Figure 5. As can be seen, the Steinhart–Hart model provides higher accuracy than the polynomial model with a maximum error in the estimated temperature that is always below 0.1 °C.

4. Simulation Results

The circuit of Figure 1 was simulated using LTSpice [30] for the following two cases: (a) the NTC temperature sensor RT is connected between nodes 1 and 2 with C = 33 nF; (b) the parallel of the NTC temperature sensor RT and a fixed resistor RP of value 5.41 kΩ is connected between nodes 1 and 2 with C = 330 nF. In the case (a), the temperature was estimated using the Steinhart–Hart model, while in the case (b), the temperature was estimated using the polynomial model. The thresholds of the Schmitt trigger integrated in the microcontroller GPIO interface were set to VL = 1.196 V VH = 1.644 V as a case study, since these are the threshold values of the Schmitt trigger circuit integrated in the GPIO interface of the low-cost microcontroller STM32L073RZT6 (ST Microelectronics) [31]. The period of the square-wave signal V2 (TP) was measured using a 16-bit counter with a clock frequency of 64 MHz (clock period TCLK = 15.625 ns) and a white noise voltage of peak values ±50 mV was superimposed to node 1 to simulate a real measurement scenario. The case of ten different environmental temperatures between −10 °C and 80 °C was considered and, for each temperature, 20 simulations were carried out. For each temperature, the average estimated temperature (Test) for the 20 simulations, the error in the average estimated temperature (|ΔTerror|), the standard deviation (σT), and the maximum (Tmax) and minimum (Tmin) values of the estimated temperature were calculated. The simulation results are reported in Table 1 for the case (a), and in Table 2 for the case (b). The results show that the temperature estimation using the Steinhart–Hart model provides more accurate results, in particular in the case of low temperatures (average error 0.078 °C in the temperature range from −10 °C to 80 °C), while the polynomial model features an average error of 0.28 °C.

5. Conclusions

In this paper, the measurement accuracy of a non-linear resistive temperature sensor (NTC 3950) was investigated using the sensor-to-microcontroller direct interface, a popular technique for sensor measurements without an analog-to-digital converter. The sensor and the measurement system were simulated by means of the circuital simulator LTSpice and the temperature was estimated using two different models, the Steinhart–Hart model and the polynomial model.
The results have shown how the Steinhart–Hart model features higher accuracy, with an average error of 0.078 °C on the temperature range from −10 °C to 80 °C, while the polynomial model is less computationally intensive than the Steinhart–Hart model, but features a lower accuracy (average error of 0.28 °C).

Author Contributions

Conceptualization, M.G.; methodology, M.G.; software, M.G.; validation, M.G.; formal analysis, M.G.; investigation, M.G.; resources, M.G.; data curation, M.G.; writing—original draft preparation, M.G.; writing—review and editing, M.G. and M.O.; visualization, M.G. and M.O.; supervision, M.G. and M.O.; project administration, M.G. and M.O. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Data are contained within the article.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Laghari, A.A.; Wu, K.; Laghari, R.A.; Ali, M.; Khan, A.A. A review and state of art of Internet of Things (IoT). Arch. Comput. Methods Eng. 2021, 29, 1395–1413. [Google Scholar] [CrossRef]
  2. Ziętek, B.; Banasiewicz, A.; Zimroz, R.; Szrek, J.; Gola, S. A portable environmental data-monitoring system for air hazard evaluation in deep underground mines. Energies 2020, 13, 6331. [Google Scholar] [CrossRef]
  3. Sgobba, F.; Sampaolo, A.; Patimisco, P.; Giglio, M.; Menduni, G.; Ranieri, A.C.; Hoelzl, C.; Rossmadl, H.; Brehm, C.; Mackowiak, V.; et al. Compact and portable quartz-enhanced photoacoustic spectroscopy sensor for carbon monoxide environmental monitoring in urban areas. Photoacoustics 2022, 25, 100318. [Google Scholar] [CrossRef]
  4. Ouni, R.; Saleem, K. Framework for sustainable wireless sensor network based environmental monitoring. Sustainability 2022, 14, 8356. [Google Scholar] [CrossRef]
  5. Grossi, M.; Parolin, C.; Vitali, B.; Riccò, B. A portable sensor system for bacterial concentration monitoring in metalworking fluids. J. Sens. Sens. Syst. 2018, 7, 349–357. [Google Scholar] [CrossRef]
  6. Grossi, M.; Parolin, C.; Vitali, B.; Riccò, B. Computer vision approach for the determination of microbial concentration and growth kinetics using a low cost sensor system. Sensors 2019, 19, 5367. [Google Scholar] [CrossRef] [PubMed]
  7. Pham, H.L.; Ling, H.; Chang, M.W. Design and fabrication of field-deployable microbial biosensing devices. Curr. Opin. Biotechnol. 2022, 76, 102731. [Google Scholar] [CrossRef]
  8. Grossi, M.; Parolin, C.; Vitali, B.; Riccò, B. Measurement of bacterial concentration using a portable sensor system with a combined electrical-optical approach. IEEE Sens. J. 2019, 19, 10693–10700. [Google Scholar] [CrossRef]
  9. Grossi, M.; Valli, E.; Bendini, A.; Gallina Toschi, T.; Riccò, B. A Portable Battery-Operated Sensor System for Simple and Rapid Assessment of Virgin Olive Oil Quality Grade. Chemosensors 2022, 10, 102. [Google Scholar] [CrossRef]
  10. Shen, Y.; Wei, Y.; Zhu, C.; Cao, J.; Han, D.M. Ratiometric fluorescent signals-driven smartphone-based portable sensors for onsite visual detection of food contaminants. Coord. Chem. Rev. 2022, 458, 214442. [Google Scholar] [CrossRef]
  11. Xu, J.; Wang, J.; Li, Y.; Zhang, L.; Bi, N.; Gou, J.; Zhao, T.; Jia, L. A wearable gloved sensor based on fluorescent Ag nanoparticles and europium complexes for visualized assessment of tetracycline in food samples. Food Chem. 2023, 424, 136376. [Google Scholar] [CrossRef]
  12. Grossi, M.; Bendini, A.; Valli, E.; Gallina Toschi, T. Field-Deployable Determinations of Peroxide Index and Total Phenolic Content in Olive Oil Using a Promising Portable Sensor System. Sensors 2023, 23, 5002. [Google Scholar] [CrossRef] [PubMed]
  13. Siam, A.I.; El-Affendi, M.A.; Abou Elazm, A.; El-Banby, G.M.; El-Bahnasawy, N.A.; Abd El-Samie, F.E.; Abd El-Latif, A.A. Portable and real-time IoT-based healthcare monitoring system for daily medical applications. IEEE Trans. Comput. Soc. Syst. 2023, 10, 1629–1641. [Google Scholar] [CrossRef]
  14. Wu, T.; Wu, F.; Qiu, C.; Redouté, J.M.; Yuce, M.R. A rigid-flex wearable health monitoring sensor patch for IoT-connected healthcare applications. IEEE Internet Things J. 2020, 7, 6932–6945. [Google Scholar] [CrossRef]
  15. Chen, S.; Qi, J.; Fan, S.; Qiao, Z.; Yeo, J.C.; Lim, C.T. Flexible wearable sensors for cardiovascular health monitoring. Adv. Healthc. Mater. 2021, 10, 2100116. [Google Scholar] [CrossRef] [PubMed]
  16. Kaur, B.; Kumar, S.; Kaushik, B.K. Novel wearable optical sensors for vital health monitoring systems—A review. Biosensors 2023, 13, 181. [Google Scholar] [CrossRef] [PubMed]
  17. Grossi, M.; Riccò, B. A portable electronic system for in-situ measurements of oil concentration in MetalWorking fluids. Sens. Actuators A Phys. 2016, 243, 7–14. [Google Scholar] [CrossRef]
  18. Aponte-Luis, J.; Gómez-Galán, J.A.; Gómez-Bravo, F.; Sánchez-Raya, M.; Alcina-Espigado, J.; Teixido-Rovira, P.M. An efficient wireless sensor network for industrial monitoring and control. Sensors 2018, 18, 182. [Google Scholar] [CrossRef]
  19. Kalsoom, T.; Ramzan, N.; Ahmed, S.; Ur-Rehman, M. Advances in sensor technologies in the era of smart factory and industry 4.0. Sensors 2020, 20, 6783. [Google Scholar] [CrossRef] [PubMed]
  20. Elahi, H.; Munir, K.; Eugeni, M.; Atek, S.; Gaudenzi, P. Energy harvesting towards self-powered IoT devices. Energies 2020, 13, 5528. [Google Scholar] [CrossRef]
  21. Callebaut, G.; Leenders, G.; Van Mulders, J.; Ottoy, G.; De Strycker, L.; Van der Perre, L. The art of designing remote iot devices—Technologies and strategies for a long battery life. Sensors 2021, 21, 913. [Google Scholar] [CrossRef] [PubMed]
  22. Reverter, F. The art of directly interfacing sensors to microcontrollers. J. Low Power Electron. Appl. 2012, 2, 265–281. [Google Scholar] [CrossRef]
  23. Bengtsson, L.E. Analysis of direct sensor-to-embedded systems interfacing: A comparison of targets’ performance. Int. J. Intell. Mechatron. Robot. (IJIMR) 2012, 2, 41–56. [Google Scholar] [CrossRef]
  24. Reverter, F. A microcontroller-based interface circuit for three-wire connected resistive sensors. IEEE Trans. Instrum. Meas. 2022, 71, 2006704. [Google Scholar] [CrossRef]
  25. Reverter, F. A direct approach for interfacing four-wire resistive sensors to microcontrollers. Meas. Sci. Technol. 2022, 34, 037001. [Google Scholar] [CrossRef]
  26. Czaja, Z. A measurement method for capacitive sensors based on a versatile direct sensor-to-microcontroller interface circuit. Measurement 2020, 155, 107547. [Google Scholar] [CrossRef]
  27. Czaja, Z. A measurement method for lossy capacitive relative humidity sensors based on a direct sensor-to-microcontroller interface circuit. Measurement 2021, 170, 108702. [Google Scholar] [CrossRef]
  28. Grossi, M. Efficient and Accurate Analog Voltage Measurement Using a Direct Sensor-to-Digital Port Interface for Microcontrollers and Field-Programmable Gate Arrays. Sensors 2024, 24, 873. [Google Scholar] [CrossRef] [PubMed]
  29. NTC Temperature Sensor 3950 Data Sheet. Available online: https://cdn-shop.adafruit.com/datasheets/103_3950_lookuptable.pdf (accessed on 19 May 2024).
  30. LTSpice Circuit Simulator. Available online: https://www.analog.com/en/resources/design-tools-and-calculators/ltspice-simulator.html (accessed on 19 May 2024).
  31. STM32L073RZT6 Microcontroller. Available online: https://www.st.com/en/microcontrollers-microprocessors/stm32l073rz.html (accessed on 19 May 2024).
Figure 1. Schematic of the circuit to measure the value of a resistance without an ADC.
Figure 1. Schematic of the circuit to measure the value of a resistance without an ADC.
Engproc 82 00012 g001
Figure 2. Characteristic of an NTC 3950 temperature sensor.
Figure 2. Characteristic of an NTC 3950 temperature sensor.
Engproc 82 00012 g002
Figure 3. Mean squared error resulting from the temperature estimation using the regression line plotted vs. the resistance RP.
Figure 3. Mean squared error resulting from the temperature estimation using the regression line plotted vs. the resistance RP.
Engproc 82 00012 g003
Figure 4. Characteristic of the environmental temperature as function of the resistance Req.
Figure 4. Characteristic of the environmental temperature as function of the resistance Req.
Engproc 82 00012 g004
Figure 5. Error in the estimated temperature achieved using the Steinhart–Hart model and the polynomial model plotted vs. the environmental temperature.
Figure 5. Error in the estimated temperature achieved using the Steinhart–Hart model and the polynomial model plotted vs. the environmental temperature.
Engproc 82 00012 g005
Table 1. Simulation results for the case of the NTC temperature sensor between nodes 1 and 2. The temperature is estimated with the Steinhart–Hart model.
Table 1. Simulation results for the case of the NTC temperature sensor between nodes 1 and 2. The temperature is estimated with the Steinhart–Hart model.
T (°C)Test (°C)|ΔTerror| (°C)σT (°C)Tmax (°C)Tmin (°C)
−10−9.8430.1570.107−9.643−9.986
0−0.0940.0940.1030.109−0.325
109.8580.1410.20710.2769.569
2019.9420.0580.19520.19719.638
3030.0220.0220.17230.44329.691
4040.0910.0910.25840.54539.711
5050.0610.0610.35250.58649.360
6059.9990.0010.31660.77159.293
7070.0660.0660.36770.66769.216
8079.9110.0890.44080.63779.131
Table 2. Simulation results for the case of the parallel of the NTC temperature sensor and a fixed resistor of value 5.41 kΩ between nodes 1 and 2. The temperature is estimated with the polynomial model.
Table 2. Simulation results for the case of the parallel of the NTC temperature sensor and a fixed resistor of value 5.41 kΩ between nodes 1 and 2. The temperature is estimated with the polynomial model.
T (°C)Test (°C)|ΔTerror| (°C)σT (°C)Tmax (°C)Tmin (°C)
−10−9.5710.4281.013−7.982−11.975
0−0.4630.4630.6440.589−1.665
109.5810.4190.70310.6778.489
2020.3670.3670.40420.89019.499
3030.3090.3090.27330.64529.699
4040.0170.0170.26440.37639.575
5049.6840.3160.27350.16049.123
6059.8610.1390.28660.34659.362
7070.2910.2910.39870.93169.209
8079.9300.0700.37980.63779.311
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

Grossi, M.; Omaña, M. Accuracy of NTC Thermistor Measurements Using the Sensor to Microcontroller Direct Interface. Eng. Proc. 2024, 82, 12. https://doi.org/10.3390/ecsa-11-20527

AMA Style

Grossi M, Omaña M. Accuracy of NTC Thermistor Measurements Using the Sensor to Microcontroller Direct Interface. Engineering Proceedings. 2024; 82(1):12. https://doi.org/10.3390/ecsa-11-20527

Chicago/Turabian Style

Grossi, Marco, and Martin Omaña. 2024. "Accuracy of NTC Thermistor Measurements Using the Sensor to Microcontroller Direct Interface" Engineering Proceedings 82, no. 1: 12. https://doi.org/10.3390/ecsa-11-20527

APA Style

Grossi, M., & Omaña, M. (2024). Accuracy of NTC Thermistor Measurements Using the Sensor to Microcontroller Direct Interface. Engineering Proceedings, 82(1), 12. https://doi.org/10.3390/ecsa-11-20527

Article Metrics

Back to TopTop