Working with a NTC question

Go To Last Post
11 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

I have to read a NTC of 10k with my A/D but the curve is not linear and I need to find a way to generate a lookup table. I had check a lot of NTC datasheet but they don't say any thing that could help me,... any hints will be helpfull for me.

Thanks

Yours truly,
Sylvain Bissonnette
www.microsyl.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sylvain.bissonne wrote:
Hi,

I have to read a NTC of 10k with my A/D but the curve is not linear and I need to find a way to generate a lookup table. I had check a lot of NTC datasheet but they don't say any thing that could help me,... any hints will be helpfull for me.

Thanks

Well, the datasheet should have either the classic NTC parameters or a curve of resistance vs. temperature. With that build a voltage divider with the NTC from the ADC input to ground (the other resistor from Vcc to the ADC input). This was done in the Butterfly, and the code is available that demonstrates the look-up table approach.

Arcs_n_Sparks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes they have a curve resistance vs temperature, but that's very small and the range is from -80 to +150, I need accuaricy from +10 to +60

Thanks for your reply

Yours truly,
Sylvain Bissonnette
www.microsyl.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You don't specify the thermistor that you're using, but the datasheet for it should have the equation and constant values for it. I have attached a page from a BC Components datasheet to show you what to look for. Using this you can create a spreadsheet for the expected ADC value for a given temperature and make a lookup table. 30 or so points in the lookup table is probably enough and then linearly interpolate between the points to get the intermediate values.

Arthur

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

sylvain.bissonne wrote:
Yes they have a curve resistance vs temperature, but that's very small and the range is from -80 to +150, I need accuaricy from +10 to +60

Thanks for your reply

Then you will probably have to play with the parameters of the divider (and possibly the ADC reference voltage) to give you the most ADC counts to work with over the +10 to +60 temperature range.

Arcs_n_Sparks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, not all 10k NTC thermistors are created equal. In fact, the thermistor people can pretty much create the curve you desire, within reachable parameters.

Depending on your need for precision, and given the relatively narrow range of interest, you may be able to find a thermistor that is pretty linear in that range and just live with the small inaccuracy at the ends of the range. (I've got one app that ws within a few tenths of a degree from linear from -20 to +20.)

If that isn't good enough, plug all the numbers from the datasheet table or experimentation into an Excel spreadsheet, and have it fit a curve over your area of interest. You should be able to get very close to ideal with that, if you can stand calculating the equation.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Look into the B (beta) value and what can be done with them. The datasheet should list a B value.

This application note from Maxim shows how the B value can be used to approximate a linear scale for temp/resistance.

http://www.maxim-ic.com/appnotes...

Hope this helps.

Tim

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My rule of thumb for NTC's is to place a series resistor of the same value than the NTC at the center point of the range of interest, ie: for 0 to 50 ºC, then I put a 10K since it is the NTC's value at 25ºC. Check the datasheet for your NTC and use an Excel table to calculate the values with the voltage divider.

Since the NTC's we use have a precise curve that fits really close to the formulas they give, then I wrote a C# program that generate a .txt file with the array of ADC values, ie: for a 511 value at the ADC, then I read in the correspondent vector the temp value, usually 25 or 250 if you read in ºC on in tenths of ºC. I put one of this tables in this forum a long time ago, together with some instructions how to use it. This gives me about +-1ºC accuracy for a non calibrated NTC. Better resolutions would mean more than 10 bit ADC's.

Guillem.

Guillem.
"Common sense is the least common of the senses" Anonymous.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Andreas

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I see that the other respondents basically agree with the way I look at using thermistors:

-- For many apps, choice of model plus choice of bias resistor can give near-linear results that may be "good enough" over an area of interest (if the area isn't too wide).
-- Equations/curve fitting can get you real close, if you can afford the AVR resources to solve the higher-level equation.
-- Table lookup is probably the fastest, can give very good results with interpolation, and may actually be the smallest if "solving the equation" pulls inmath library routines that you wouldn't use otherwise.

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi
I use this method with a Philips 1% ntc, just with a pullup resistor. It gives a fair good accuracy. It is best to middle some readings of the ADC.
I use it with a mega 48.


#define RREF 10000  // value of at 25 degrees
#define BVALUE 3977 // from datasheet

// calculate resistor value
float fCalcNtc( word wADCVal ){ // from ADC
	float fRntc;
  fRntc = 10000 *  (float) wDacVal / ( 1023.0  - (float) wDacVal);  // 10000 = pullup resistor
	return(fRntc);
}


// calculate temperature from resistorvalue
float fCalcTemp( float fRntc){
	float fTemp;
  fTemp = (1.0 / ( (log(fRntc/RREF))/BVALUE  + 1.0/298.0)) - 273.0; //log = ln 
	return( fTemp);
}

Dig