This library is an update to ntctemp 01, look here for info: http://davidegironi.blogspot.it/2012/06/ntctemp-simple-avr-library-to-read.html
A thermistor is a type of resistor whose resistance varies significantly with temperature, more so than in standard resistors.

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**, h

__elps 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);

Es. given a table which contains temperature for ADC: ..201,211,221.. temp: ..-7.21, -5.97, -4.75, the current ADC is 214, the lower index should be 211, and upper 221, so lower and upper temperature is -5,97 and -4.75. intervalstep is 214-211 = 3. t = -5.97 + (-4.75- -5.97)/10 * 3 = -5.604. Which is near to the value obtained using the beta model equation (-5.599).

**0.005 degree of error**.

This library was developed on Eclipse, built with avr-gcc on Atmega8 @ 1MHz.

**Code**
**Notes**
- read risk disclaimer
- excuse my bad english