Reading temperature on AVR Atmega using a thermistor with NTCtemp library 02
NTCtemp is a simple AVR library to read temperature from a thermistor connected to an atmega micro.
The library implements three models convert adc value read from analog input to temperature:
- Steinhart-Hart Thermistor Equation
- Beta Model Equation
- Lookup Table estimation
A digital iir filter is implemented to remove unwanted reading errors.
For Steinhart-Hart and Beta model equation, look at the previous article.
This version of the library implements a Lookup Table estimation method, which can be usefull if you do not want to include log function, and mantain you hex smaller.
To helper are provided:
- the beta estimation helper
- the make lookup table helper
The beta estimation helper, helps you to estimate beta value of unknown thermistor.
It is almost the same provided in the reprap wiki page here: http://reprap.org/wiki/MeasuringThermistorBeta. A readme file with instruction is provided with the spreadsheet of the helper
The make lookup table helper is a spreadsheet which generate the lookup table according to preselected values. Estimation is done using the Beta Model Equation: temperature (Celsius) = beta / ( beta / tref + ln ( R / rref ) ) – 273.15
Each element in the table is a temperature for a given ADC value.
Given the ADC value of the connected thermistor, we can measure the temperature using the lookup table.
Because we know the ADC value for the first element of the table, and the interval between values, we can select the nearest lower index for any given ADC.
Then we can select the upper and lower temperature values for the selected index.
On those values we do interpolation to obtain a correct temperature value.
We must calculate the inverval step, indicates the position between upper and lower index, of the current adc value.
Then we can do interpolation of values.
intervalstep = currentadcvalue-minindex
t = lowertemp + ((uppertemp-lowertemp)/lookupadcstep) * (intervalstep);
For more detail: Reading temperature on AVR Atmega using a thermistor with NTCtemp library 02
Leave a Comment
You must be logged in to post a comment.