Interfacing to PT1000 w/ limited range of interest

Hi all,
Im not sure if this is the right forum, but it seemed to be the closest match.

I want to interface an Arduino with a PT1000 RTD temperature sensor. My range of interest is 85C to 95C which corresponds to 1328 Ohms to 1366 Ohms.
I have breadboarded a circuit and am using a 25 ohm variable resistor to roughly simulate the RTD sensor.

So, I am reading the "sensor" value, performing an operation on it to get the range of values I am interested in and serially outputting to my pc. And its working.....

But I am getting only integer values, whereas I really want 0.1 resolution.

Is it possible to do this with the serial output?

Later I will be also interfacing with a LCD, so maybe I can only do it on the LCD?

Here is my code....

/*
  RTD Analog Input
 This will read the value of RTD/POT, save it as 
 a variable, then calculate the temp
 
 The circuit:
 * Wheatstone bridge feeds diff amp attached to analog input 0
 
 
  */

int sensorValue = 0;  // variable to store the value coming from the sensor
int tempValue = 0; // variable to store calculated temp

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

void loop() {
  // read the value from the sensor:
  int sensorValue = analogRead(0);
  tempValue = ((sensorValue-225)/54)+85;
  Serial.println(tempValue);
  delay(10);

}

Any advice would be greatly appreciated! :slight_smile:

You're being bitten by "integer division". In C++ 150/54 (for example) is 2. Not 2.777 or 2.8 but just 2. So your expression ((sensorValue-225)/54) loses a lot of precision.

You can try using floats or doubles to work with real numbers prior to converting back to an integer:

tempValue = ((sensorValue-225.0)/54)+85;

Adding a real number forces real-number computation, and the final result is converted back to an integer when you write the result to tempValue.

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, light sensor, potentiometers, pushbuttons

So, by using floats my calculation is more precise, due to not getting anything after whole numbers chopped off until it gets written to tempValue?

Later, when I interface the lcd with the arduino, would I perhaps send a larger number to the lcd then divide it to get 0.1 resolution?

Sorry, Im still really new to arduino and programming :frowning:

Yes, it's best to stick to integer numbers whenever possible as floating-point computation takes quite a bit more work (time). Just computing 10 times the needed quantity and displaying it on an LCD with the decimal point in the right place is the way to go.

--
The Quick Shield: breakout all 28 pins to quick-connect terminals

Thank you very much for clearing this up for me! :smiley: