Pt1000 converting Resistance to Temp

Hi im trying to create a function that converts resistance to temperature with the values from a pt1000 sensor!

float ConvertRtoT(float R) {
    float A=3.9083 * pow(10,-3);
    float B=5775 * pow(10,-7);
    float T;
    
    T = (0-A + sqrt(pow(A,2) - 4 * B * (1 - R/1000))) / 2 * B;
    
    Serial.print(T);
    Serial.print(";");
    T=(0-A - sqrt(pow(A,2) - 4 * B * (1 - R/1000))) / 2 * B;
    Serial.print(T);
    return T;

}

the value of R is 1090Ohm but i only get 0.00;-0.00 C temp.

The equation that im trying to use looks like this:

R = R0 * (1 + AT + BT^2 -100CT^3 + C*T^4)

where

R = resistance of sensor in ohms
R0 = resistance at zero degrees Celsius in ohms (100 for Pt100, and 1000 for Pt1000)
T = temperature in degrees Celsius
A = 3.908310^-3
B = -5.775
10^-7
C = -4.183*10^-12 for T < 0 degrees Celsius
C = 0 for T >= 0 degrees Celsius

Using the pow function like this is expensive:

float A=3.9083 * pow(10,-3);
float A = 3.9083E-3;

is a perfectly valid way of initializing A, without the need for a function call.

pow(A,2) is again a slow way of computing A * A.

Try changing all the integers in the expression to floats. (4 -> 4.0).

Try printing intermediate values. Somewhere, you are performing integer arithmetic when you don't want to be (probably because of the integer values in the equation).

Ok i changed the code like this:

float ConvertRtoT(float R,float R0) {
    float A=3.9083E-3;
    float B=5775E-7;
    float T;
    R=R/R0;
    
    T = (0.0-A + sqrt(A*A - 4.0 * B * (1.0 - R))) / 2.0 * B;
    
    Serial.print(T);
    Serial.print(";");
    
    T=  (0.0-A - sqrt(A*A - 4.0 * B * (1.0 - R))) / 2.0 * B;
    
    Serial.print(T);
 
    return T;
}

But still no change in the values!

From your first post:

B = -5.775*10^-7

From your last post:

float B=5775E-7;

B is 3 orders of magnitude off, and with the wrong sign.

ooops must be a copy error =) still no change in the output though

I suggested that you break the function up into smaller pieces, and print intermediate results.

You've shown no input, no output, and no proof that there is a problem.

Ball's back in your court.

Fixed it!

float GetPlatinumRTD(float R,float R0) { 
    float A=3.9083E-3; 
    float B=-5.775E-7; 
    float T; 
    
    R=R/R0; 
    
    //T = (0.0-A + sqrt((A*A) - 4.0 * B * (1.0 - R))) / 2.0 * B; 
    T=0.0-A; 
    T+=sqrt((A*A) - 4.0 * B * (1.0 - R)); 
    T/=(2.0 * B); 
    
    if(T>0&&T<200) { 
      return T; 
    } 
    else { 
      //T=  (0.0-A - sqrt((A*A) - 4.0 * B * (1.0 - R))) / 2.0 * B; 
      T=0.0-A; 
      T-=sqrt((A*A) - 4.0 * B * (1.0 - R)); 
      T/=(2.0 * B); 
      return T; 
    } 
}