Pt1000 converting Resistance to Temp


hi im trying create function converts resistance temperature values pt1000 sensor!

code: [select]

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 1090ohm 0.00;-0.00 c temp.

the equation  im trying use looks this:

r = r0 * (1 + a*t + b*t^2 -100*c*t^3 + c*t^4)

where

r = resistance of sensor in ohms
r0 = resistance @ 0 degrees celsius in ohms (100 pt100, , 1000 pt1000)
t = temperature in degrees celsius
a = 3.9083*10^-3
b = -5.775*10^-7
c = -4.183*10^-12 t < 0 degrees celsius
c = 0 t >= 0 degrees celsius

using pow function expensive:
code: [select]
float a=3.9083 * pow(10,-3);


code: [select]
float = 3.9083e-3;
is valid way of initializing a, without need function call.

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

try changing integers in expression floats. (4 -> 4.0).

try printing intermediate values. somewhere, performing integer arithmetic when don't want (probably because of integer values in equation).


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Pt1000 converting Resistance to Temp


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums