Difference between revisions of "Thermistor"

From Fixme.ch
Jump to: navigation, search
Line 5: Line 5:
 
== Problem ==
 
== Problem ==
  
* NTCs have a negative exponential behavior <ref name="wikipedia thermistor">{{cite web
+
* NTCs have a negative exponential behavior [1,2,3].
| url=https://secure.wikimedia.org/wikipedia/en/wiki/Thermistor }}</ref>
+
[2,3].
+
  
 
* When trying to read with the ADC on an AVR, you somehow need to fit
 
* When trying to read with the ADC on an AVR, you somehow need to fit
Line 50: Line 48:
 
The resulting temperature reading can be seen in [4] (analysis).
 
The resulting temperature reading can be seen in [4] (analysis).
  
 +
[1] https://secure.wikimedia.org/wikipedia/en/wiki/Thermistor
 
[2] https://www.avx.com/docs/Catalogs/ntc-general.pdf
 
[2] https://www.avx.com/docs/Catalogs/ntc-general.pdf
 
[3] http://imgur.com/6efmA.png
 
[3] http://imgur.com/6efmA.png
 
[4] http://imgur.com/YlRCY.png
 
[4] http://imgur.com/YlRCY.png

Revision as of 00:25, 1 September 2011

Objective

How to read a NTC thermistor via ADC to get the current temperature.

Problem

  • NTCs have a negative exponential behavior [1,2,3].
  • When trying to read with the ADC on an AVR, you somehow need to fit

the voltage into AVcc, for example using the internal reference at 2.56V.

Solution

[2] suggests combining a resistor with the NTC in parallel to create an approximate linear response for a given temperature range.

I decided to do the math first, and it turns out a voltage divider works like a charm. Set the ADC reference voltage to 2.56V. Then wire the divider up this way:

5V ----------+
             |
        NTC 10k@25C
             |
             +----------o ADC
             |
            3.6k
             |
           __|__
            ___
             -

The 3.6k value can be calculated from [2] and a bit of experimentation.

When you read the ADC (say, 8bit ADC), you'll have to post-process the reading. BUT! It is already linear. That means we can easily compute T (in degC):

T = (ADC - 40) >> 2;

Of course, you can decide not to shift and instead have .25 degC resolution.

The resulting temperature reading can be seen in [4] (analysis).

[1] https://secure.wikimedia.org/wikipedia/en/wiki/Thermistor [2] https://www.avx.com/docs/Catalogs/ntc-general.pdf [3] 6efmA.png [4] YlRCY.png