NTC Thermistors - I''m baffled!
Archiver
Posts: 46,084
Oh, what follows is the code I'm using to make one table. a11, b11, c11, and
d11 are the values from the datasheet to calculate temp as a function of
resistance. adc is the measured value from the ADC, r, is what the
resistance of the thermistor should be when that value is read, and t is the
calculated temperature. The results don't look as expected.
Ho, my reference voltage will be 5 volts.
#include <iostream.h>
#include <math.h>
const double a11 = 3.354016;
const double b11 = 2.909670;
const double c11 = 1.632136;
const double d11 = 0.719270;
long adc;
double r;
double t;
int main()
{
for (adc = 1; adc <= 4096; adc++) {
r = ((4096 / adc) - 1) * 5000;
t = 1 / (a11 + b11 * log(r / 5) + c11 * log(r / 5) + d11 * log(r / 5));
cout << adc << "," << r << "," << t << endl;
}
}
Original Message
From: "Steve Ziuchkovski" <zman97211@y...>
To: <basicstamps@yahoogroups.com>
Sent: Saturday, June 14, 2003 3:38 PM
Subject: [noparse][[/noparse]basicstamps] NTC Thermistors - I'm baffled!
> First, here are links to the datasheet and a document at Maxim that
descibed
> how to interface a thermistor to an ADC I'm going to reference below:
>
>
http://rocky.digikey.com/WebLib/BC%20Components/Web%20Data/2322%20640%203,4,
> 6%20NTC%20Thermistors.pdf
> http://www.maxim-ic.com/appnotes.cfm/appnote_number/1753/ln/en
>
> Okay, The thermistor I have is 2322-640-63102 (R25 value of 1000 ohms).
The
> Maxim datasheet discusses a simple voltage divider of the thermistor and
> another resistor, and includes equations that (to me) should be able to
> generate a table showing the relationship of the measured value (the value
> of the ADC, for me 12 bits, 0-4095) and temperature.
>
> I've written a C++ program that generates a table using the equations
listed
> in the Maxim document, substituting the T(R) function from the datasheet
for
> equation 5 of the Maxim document. I don't get the results that I should be
> getting. Now, the datasheet shows two different sets of values (A1, B1,
C1,
> and D1) for temperatures above and below 25 degrees C, which isn't a
> problem. I can make two tables, using the appropriate numbers.
>
> But why doesn't this work? I've searched and searched the net for
examples,
> application notes, etc, for using a thermistor with an ADC to determine
> temperature, but I just don't get how to calculate the curves and make a
> lookup table.
>
> Please help!
>
> Steve
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
d11 are the values from the datasheet to calculate temp as a function of
resistance. adc is the measured value from the ADC, r, is what the
resistance of the thermistor should be when that value is read, and t is the
calculated temperature. The results don't look as expected.
Ho, my reference voltage will be 5 volts.
#include <iostream.h>
#include <math.h>
const double a11 = 3.354016;
const double b11 = 2.909670;
const double c11 = 1.632136;
const double d11 = 0.719270;
long adc;
double r;
double t;
int main()
{
for (adc = 1; adc <= 4096; adc++) {
r = ((4096 / adc) - 1) * 5000;
t = 1 / (a11 + b11 * log(r / 5) + c11 * log(r / 5) + d11 * log(r / 5));
cout << adc << "," << r << "," << t << endl;
}
}
Original Message
From: "Steve Ziuchkovski" <zman97211@y...>
To: <basicstamps@yahoogroups.com>
Sent: Saturday, June 14, 2003 3:38 PM
Subject: [noparse][[/noparse]basicstamps] NTC Thermistors - I'm baffled!
> First, here are links to the datasheet and a document at Maxim that
descibed
> how to interface a thermistor to an ADC I'm going to reference below:
>
>
http://rocky.digikey.com/WebLib/BC%20Components/Web%20Data/2322%20640%203,4,
> 6%20NTC%20Thermistors.pdf
> http://www.maxim-ic.com/appnotes.cfm/appnote_number/1753/ln/en
>
> Okay, The thermistor I have is 2322-640-63102 (R25 value of 1000 ohms).
The
> Maxim datasheet discusses a simple voltage divider of the thermistor and
> another resistor, and includes equations that (to me) should be able to
> generate a table showing the relationship of the measured value (the value
> of the ADC, for me 12 bits, 0-4095) and temperature.
>
> I've written a C++ program that generates a table using the equations
listed
> in the Maxim document, substituting the T(R) function from the datasheet
for
> equation 5 of the Maxim document. I don't get the results that I should be
> getting. Now, the datasheet shows two different sets of values (A1, B1,
C1,
> and D1) for temperatures above and below 25 degrees C, which isn't a
> problem. I can make two tables, using the appropriate numbers.
>
> But why doesn't this work? I've searched and searched the net for
examples,
> application notes, etc, for using a thermistor with an ADC to determine
> temperature, but I just don't get how to calculate the curves and make a
> lookup table.
>
> Please help!
>
> Steve
>
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>