Monday, June 11, 2012

NTCtemp: a simple AVR library to read temperature from ntc thermistor

updated version here: http://davidegironi.blogspot.it/2012/12/reading-temperature-on-avr-atmega-using.html

NTCtemp is a simple AVR library to read temperature from ntc thermistor connected to an atmega micro.



The library implements the Steinhart-Hart Thermistor Equation or the Beta Model Equation to convert adc value read from analog input to temperature (Celsius).
There are plenty of articles around here speaking about the theory behind those equations, it's not the purpose of this post to teach you this, i just want to provide you a simple library.

Code was tested on an atmega8 connected with a cheap ebay ntc sensor.
I've compared results with a digital thermometer. Temperatures are almost the same, i.e. +/-0.5 Celsius from 20 to 90 Celsius.
Code is release under GPL3 license.


A sample circuit to interface with a thermistor and filter noise is provided.
On the left upper side there is an rc filter, which remove high freq noise. On the right side the thermistor wiring. For further informations and as references please look at http://arduino.cc/playground/ComponentLib/Thermistor4 or RLC Filter Design for ADC Interface Applications (Texas Instruments).


A digital iir filter is implemented to remove unwanted reading errors. As reference please look at "Guillem Planissi tutorial: Measurement and filtering of temperatures with NTC", you should find this tutorial here: http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=61128



Code


Notes
  • read risk disclaimer
  • excuse my bad english

No comments:

Post a Comment