 # Trouble getting pt100 Celsius reading from spark analog pin

Having problems getting correct vallues from a PT100 thermal resistor.

Here is our setup:
5v -----> resistor------> Our spark line is here ------> PT100 ------> Ground

Power drains to ground through a resistor, with our analog spark pin we can detect how much power is drained.
This works and gives us an value to read,
however, not in celsius.

so far i know just about the values for the resistance:celsius from here
http://en.wikipedia.org/wiki/Resistance_thermometer.
there is a function which estimates it, i wanna calculate it!.

Found a calculator online
http://www.thermibel.be/documents/pt100/conv-rtd.xml?lang=en

What kind of resistor and math can we use to calculate the temperature?

Erik

PS. ive been at this for 5 hours and tried several functions and examples from the internet, which all of them failed to give a proper reading.

most examples use something like

``````
temp=(temp2-0.5)*100;
or

// float millivolts = (analogRead(A0) / 1024.0) * 5000;
// float celsius = millivolts/10; // sensor output is 10mV per degree Celsius

``````

Both does not give a proper celsius display.

The simplest (and most accurate) way to approach this is to calibrate the sensor.

First put the sensor in an ice+water bath - this will hold at 0° C. Record the value you get from analogRead(A0).

Then put the sensor in boiling water (assuming it can tolerate that) and again measure the value. This gives you two point calibration.

In your code, you then compute the temperature based on the offset and scale of the calibration points:

``````int zeroDeg = 123; // the analog value you measured at 0C
int hundredDeg = 789;  // the analog value you measured at 100C