Go Down

Topic: Can't get correct value from thermistor (Read 1 time) previous topic - next topic

erbedo

Hi
    I have a 50K thermistor (this one), which I cannot get to work correctly.

My set up is the following:
5V -- T -- A -- 10K -- GND
Where T is the thermistor, A is the analog PIN.

The problem is that I got weird temperatures like 100 celsius degrees, even if I am sure that the SH equation is correct, since I read the same values as in the datasheet table.

Any idea about that?

Thanks

Arrch

Have you tried manually measuring the resistance of the thermistor and verifying the temperature from the datasheet?

robtillaart


Can you post your code?
and/or the SH equation?

Such a table is work for - http://arduino.cc/playground/Main/MultiMap -

Think 11 - 15 entries should be enough to get an acceptable approximation although I do not know your requirements
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

oric_dan

Since you have a 50K@room_temp thermistor, is it possible your curve is expecting to see
R = 50K rather than 10K?

erbedo

My code is:
Code: [Select]

#include <math.h>
#define READING_PIN 5
#define SERIESRESISTOR 10000

double R1 = 10000.0; //resistance put in parallel
double V_IN = 5.0;

double A = 9.6564E-04;
double B = 2.1069E-04;
double C = 8.5826E-8;
double K = 9.5; // mW/dec C - dissipation factor

double SteinhartHart(double R) {
// calculate temperature
  double logR  = log(R);
  double logR3 = logR * logR * logR;

  return 1.0 / (A + B * logR + C * logR3);
}

void setup() {
  Serial.begin(9600);
}

void loop() {
  double adc_raw = analogRead(READING_PIN);

  double V =  (adc_raw / 1024) * V_IN;
  Serial.print("V =");
  Serial.print(V);

  //calculate resistance
  double R_th = (R1 * V ) / (V_IN - V);
  Serial.print("V   R_th = ");
  Serial.print(R_th);

  double kelvin = SteinhartHart(R_th) -  V * V / (K * R_th);
  double celsius = kelvin - 273.15;
  Serial.print(" Ohm  -  T = ");
  Serial.print(celsius);
  Serial.println("C");
  delay(1000);
}


For the map function, I think that is not the problem. I can correctly map my resistance value to temperature values, but is my resistance value which is wrong, not its mapping.

I also tried with 5 10KOhm resistors in series, but this hasn't work either.

Go Up