Hi everyone,
Im trying to write my own program (just playing). Im using Arduino Mega R3 + Ramps 1.4 Shield
I have thermistor that i have plugged it to pin called "T0" on the ramps board then i wrote the next lines in my code:

``````#define TEMP_0_PIN          13   // ANALOG NUMBERING

float A = 1.009249522e-03, B = 2.378405444e-04, C = 2.019202697e-07;
float T, logRt, Tf, Tc;
float Thermistor(int Vo) // GET TEMP IN CELSIUS INSTEAD OF VOLTAGE FUNCTION
{
logRt = log(10000.0*((1024.0/Vo-1)));
T = (1.0 / (A + B*logRt + C*logRt*logRt*logRt));  // We get the temperature value in Kelvin from this Stein-Hart equation
Tc = T - 273.15;                     // Convert Kelvin to Celcius
// Tf = (Tc * 1.8) + 32.0;              // Convert Kelvin to Fahrenheit
return Tc;
}
``````

i get very high values m like 120 degree celcius while the true reading should be 21.

ther termistor is 12v ( like those in the 3d printers)
and the ramps pinout is here : Link

Thanks you!!

Take the thermistor out of the circuit and measure its resistance using your multimeter.

Check that it varies, depending on temperature.

Its says 115 on the "2000K" scale

So I probably need to fix the next line:

``````logRt = log(11500.0*((1024.0/Vo-1)));
``````

?

thank you!

That code assumes that the thermistor is of a particular type, modeled by the coefficients A, B and C, and is used in a voltage divider with a 10K resistor.

If the thermistor you have is not of the type assumed by the code, or the other resistor in the voltage divider is not 10K, the calculated temperature values will be wrong.

is there any way to get those three coefficients?
Like solving 3 equations?
Thanks!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.