Pages: [1]   Go Down
Author Topic: Thermistor - Pull-up resistor sizing  (Read 706 times)
0 Members and 1 Guest are viewing this topic.
Seattle WA
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Attachment has specs on the thermistor I would like to use.  It is an automotive air/coolant sensor, which I have several of laying around.

I had my UNO reading the temp voltages, and converting to temp (deg F) almost dead on, using a 5th order polynomial to fit the data in the attached table, and a 10k variable resistance knob (potentiometer?, whatever was supplied in my MEGA kit).

When I switched the potentiometer for the sensor and pullup resistor, my numbers were significantly off.  I tried using a 10k pull-up resistor.

How do I select a pull-up resistor for a thermistor?
Is it trial and error, or is there some method to the madness?

Thanks,
jason


* ACT-ECT_Volt_Ohm_Table.gif (42.68 KB, 1000x414 - viewed 43 times.)
Logged

Quote from: Albert Einstein
If we knew what we were doing, we wouldn’t call it research, would we?

Oregon, USA
Offline Offline
Edison Member
*
Karma: 69
Posts: 2408
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

For highest sensitivity near the operating point (that is, the temperature near the middle of the range of interest) the fixed resistor should have about the same resistance value as the thermistor. But the value is not at all critical.

What IS critical is that you properly calibrate your circuit after making any changes. Fixed resistors are typically accurate to only 5% or 10% (better, if you pay more) and the actual resistance used has to be accurately known, in order to estimate the thermistor resistance at a given temperature.

If you wish more help, post your code using code tags.
Logged

"It seems to run on some form of electricity"

0
Offline Offline
Shannon Member
****
Karma: 217
Posts: 12583
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Fixed resistors are typically accurate to only 5% or 10% (better, if you pay more)

I'd change your supplier, nominally 5% resistors these days are just 1% resistors
that made the reject bin, so they are usually much better than 5%, and 1% resistors
are commonplace and cheap now.  I very rarely find a resistor more than 0.5% out
these days.

Just avoid carbon resistors entirely, they drift with age, have high temperature and
humidity sensitivity, and are noisy.  I don't think they are even made any more!
Logged

[ I won't respond to messages, use the forum please ]

Oregon, USA
Offline Offline
Edison Member
*
Karma: 69
Posts: 2408
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'd change your supplier,
I have no problem obtaining the parts I require, but the OP might appreciate a specific part recommendation and a link to your favorite supplier.
Logged

"It seems to run on some form of electricity"

Seattle WA
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

For highest sensitivity near the operating point (that is, the temperature near the middle of the range of interest) the fixed resistor should have about the same resistance value as the thermistor. But the value is not at all critical.

What IS critical is that you properly calibrate your circuit after making any changes. Fixed resistors are typically accurate to only 5% or 10% (better, if you pay more) and the actual resistance used has to be accurately known, in order to estimate the thermistor resistance at a given temperature.

If you wish more help, post your code using code tags.
Would it then be ideal to use a second thermistor as the pull-up resistor?
I have several and could easily do this...

Here is the last code I used...
Code:
/*
  ReadAnalogVoltage
  Reads an analog input on pin 0, converts it to voltage, and prints the result to the serial monitor.
  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
 This example code is in the public domain.

Thermistor Schematic:
[Ground] ---- [10k-Resistor] -------|------- [Thermistor] ---- [+5v]
                                    |
                              Analog Pin 0
 */
// the setup routine runs once when you press reset:
  void setup()
{
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
  void loop()
  {
    float calctemp ;
    float voltage ;
    float tempr ;
     
      // read the input on analog pin 0:
    int sensorValue = analogRead(A0);
      // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
    voltage = sensorValue / (204.6);    // for 0-5v scaling

    // Used Excel to find 5th order polynomial equation for known ACT Transfer data
    // y = -2.7774x5 + 30.376x4 - 129.59x3 + 273.34x2 - 331.45x + 318.74
    calctemp = (-1 * (2.7774*(pow(voltage,5)))) + (30.376 * (pow(voltage,4))) - (129.59 * (pow(voltage,3))) + (273.34 * (pow(voltage,2))) - (331.45 * (voltage)) + (318.74);

    Serial.print("SensorValue ");
    Serial.println(sensorValue);
    Serial.print("Voltage From Sensor ");
    Serial.print(voltage);
    Serial.println("v");
    Serial.print("Turned into Temprature ");
    Serial.print(calctemp);
    Serial.println(" deg F");
    Serial.println("");
    delay(3000);
}
Logged

Quote from: Albert Einstein
If we knew what we were doing, we wouldn’t call it research, would we?

Oregon, USA
Offline Offline
Edison Member
*
Karma: 69
Posts: 2408
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Would it then be ideal to use a second thermistor as the pull-up resistor?
The output of such a circuit would depend on two temperatures. Is that what you want?
Logged

"It seems to run on some form of electricity"

Seattle WA
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Would it then be ideal to use a second thermistor as the pull-up resistor?
The output of such a circuit would depend on two temperatures. Is that what you want?
If they were both in the same environment, then it would basically be the same conditions.


As I look back over this thread, it sounds like I simply need to adjust my conversion equation to get my temp outputs to read correctly, now that I have the 10k resistor in place.
Basically a calibration of the sensor to the circuit.
Logged

Quote from: Albert Einstein
If we knew what we were doing, we wouldn’t call it research, would we?

Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Your quadratic equation doesn't look correct. 

This should work with 10k ohm resistor divider to ground.
y = 0.9364x^5 - 11.105x^4 + 52.457x^3 - 122.02x^2 + 177.81x - 32.269
Logged

Seattle WA
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It is working now!
I converted from sensorValue to voltage wrong and my polynomial was wrong.

Your quadratic equation doesn't look correct.  

This should work with 10k ohm resistor divider to ground.
y = 0.9364x^5 - 11.105x^4 + 52.457x^3 - 122.02x^2 + 177.81x - 32.269
How did you come up with that equation?


For reference, here is my final code, not yet cleaned up...
Code:
/*
  ReadAnalogVoltage
  Reads an analog input on pin 0, converts it to voltage, and prints the result to the serial monitor.
  Attach the center pin of a potentiometer to pin A0, and the outside pins to +5V and ground.
 This example code is in the public domain.

Thermistor Schematic:
[Ground] ---- [10k-Resistor] -------|------- [Thermistor] ---- [+5v]
                                    |
                              Analog Pin 0
 */
 // include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// the setup routine runs once when you press reset:
  void setup()
{
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
}

// the loop routine runs over and over again forever:
  void loop()
  {
    float CalcTemp ;
    float A0_TempVoltage ;
    // float Temp ;
      
      // read the input on analog pin 0:
    int sensorValue = analogRead(A0);
      // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
    A0_TempVoltage = sensorValue * 5.0 / 1023.0;    // for 0-5v scaling

    // Used Excel to find 5th order polynomial equation for known ACT Transfer data
    // y = -2.7774x5 + 30.376x4 - 129.59x3 + 273.34x2 - 331.45x + 318.74
    // from forum  y = 0.9364x^5 - 11.105x^4 + 52.457x^3 - 122.02x^2 + 177.81x - 32.269
    // CalcTemp = (.9364*(pow(A0_TempVoltage,5))) + (30.376 * (pow(A0_TempVoltage,4))) - (129.59 * (pow(A0_TempVoltage,3))) + (273.34 * (pow(A0_TempVoltage,2))) - (331.45 * (A0_TempVoltage)) + (318.74);
    CalcTemp = (.9364*(pow(A0_TempVoltage,5))) - (11.105 * (pow(A0_TempVoltage,4))) + (52.457 * (pow(A0_TempVoltage,3))) - (122.02 * (pow(A0_TempVoltage,2))) + (177.81 * (A0_TempVoltage)) - (32.269);
    // CalcTemp = (-2.7774*(pow(A0_TempVoltage,5))) + (30.376 * (pow(A0_TempVoltage,4))) - (129.59 * (pow(A0_TempVoltage,3))) + (273.34 * (pow(A0_TempVoltage,2))) - (331.45 * (A0_TempVoltage)) + (318.74);

    Serial.print("SensorValue ");
    Serial.println(sensorValue);
    Serial.print("Voltage From Sensor ");
    Serial.print(A0_TempVoltage);
    Serial.println("v");
    Serial.print("Turned into Temprature ");
    Serial.print(CalcTemp);
    Serial.println(" deg F");
    Serial.println("");
    delay(3000);
    
  // set the cursor to column 0, line 0
  lcd.setCursor(0, 0);
  // Print a message to the LCD.
  lcd.print("Home Temperature");
  // set the cursor to column 0, line 1
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(CalcTemp);
  lcd.print(" F");
}

I should also add that these are ECT/ACT/IAT sensors used in many Ford vehicles. 
« Last Edit: June 10, 2014, 10:33:12 am by vristang » Logged

Quote from: Albert Einstein
If we knew what we were doing, we wouldn’t call it research, would we?

Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
How did you come up with that equation?

1.  From your chart, enter temperature and thermistor resistance into Excel.
2.  For each temperature, calculate the voltage that the ADC will see.
       V_ADC = 5V * 10k /(10k + R_therm)
3.  Plot (x-y scatter): V_ADC (as x) & temp (as y).
4.  Use curve fit function to get quadratic equation. 

You do realize the equation is only accurate between the min and max temperatures listed.  Any measurements beyond those values will be extremely off base.

Gerry
Logged

Seattle WA
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you Gerry!

I may add a couple data points to extend the range, but for now this will work just fine.

The 10k is the pull up resistor, correct?
« Last Edit: June 10, 2014, 02:31:14 pm by vristang » Logged

Quote from: Albert Einstein
If we knew what we were doing, we wouldn’t call it research, would we?

Offline Offline
Jr. Member
**
Karma: 0
Posts: 57
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is not a pull-up resistor.  The 10k is the lower leg of a resistive divider circuit.   Look at the diagram at the top of your code.  The 10k connects to the thermistor and to ground.  It has no pull-up function.

Gerry
Logged

Pages: [1]   Go Up
Jump to: