# How to convert sensor signal to temperature from the data available from the datasheet?

I have a Pyrometer datasheet showing signal percentage (0 to 100%) with the corresponding respective temperatures (from 0 to 200 °C) and current values (from 0 to 20 mA) in the whole measuring range.

Practically, I get the Pyrometer signal output as a voltage which I want to convert into temperature by using the above data. What is the procedure to do this?

• What is the burden resistor value and is the response linear or quadratic in nature? – Andy aka Aug 15 '19 at 9:51
• share the datasheet and what does the datasheet say? – User323693 Aug 15 '19 at 9:53
• I am unable to post all the info of datasheet, but I have shared singal and temp values through an image. Please check it. The other details from the datasheet says that the output of the signal is in volts (output ranges from 0 to 1 V) and the maximum impedance is 500 Ohms – Aaron Winter Aug 15 '19 at 12:45
• can you use the table itself as LOOK UP TABLE in your code (MCU or Arduino or PC)? when the signal voltage is not exactly between the two points, you can interpolate linearly – User323693 Aug 15 '19 at 12:49
• yes, I can use it as look up table in PC. But, what exactly means 'the signal voltage is not exact between two points'? Please clarify it. – Aaron Winter Aug 15 '19 at 12:54

You have a table with 100 values in terms of temperature. It's clearly nonlinear to some degree (not insanely so over that range).

So you have a few ways of proceeding. Generally what you want to do is to fit the data to a function f so you can find T = f(a) where a is a variable that goes from 0 to 1 for 0 to 100%.

There are many ways to go about that. One is to find a polynomial of some degree that minimizes the least-squares error for each point. If the power is less than 100 you'll have some error, and generally the whole thing will get more numerically unstable the higher the degree. You could try fitting a polynomial of reasonable degree (say up to about 8) and see how well it fits with the points and how it behaves between the points.

One method that uses more storage but is typically very numerically stable is to use cubic splines where the result is a smooth (differentiable) curve that passes exactly through each of the given points and behaves reasonably between them.

The numbskull simple method is to store the points and do linear interpolation rather than a cubic spline. That's like drawing a straight line between the points, so it's ugly but it hits all the points exactly and isn't too crazy between the points if there are enough and the curve isn't too nonlinear.

The optimum method will depend on the computing resources available and the required bandwidth and the required accuracy. Since the variable is temperature, the bandwidth is likely rather low, and since the numbers are only given to 4 digits probably the accuracy isn't all that demanding either.

MATLAB (curve fitting toolbox, ideally) which is very much not free, or one of the free programs with similar capabilities (Octave or Scilab) is an easy way to proceed and you can easily find how to do it with the search terms provided. You can even use Microsoft Excel in some cases.

Note that numerically poorly conditioned algorithms can have unexpected results since you end up coming with a result that subtracts almost-equal large numbers from each other, and truncation or rounding can affect the results cosmetically or even materially, so be sure to check the algorithm carefully before deploying it.

• thank you so much for the answer.... i will try the method you have explained – Aaron Winter Aug 15 '19 at 15:46
• Excel has a decently good polynomial fitter, which is considerably less expensive than MATLAB. Depending on your platform it may make more sense to do interpolation than all the floating point math, however. – BB ON Aug 15 '19 at 19:07
• @BB ON You can do polynomial evaluation with fixed point math on an 8-bit micro if you really want to. Back 20 years ago I did it a lot. – Spehro Pefhany Aug 15 '19 at 19:09

I'm assuming you're using a microprocessor.

The output pin of the pyrometer will have to go through a resistor to ground to turn current into a voltage, and your processor will then measure this voltage over the resistor. Let's assume your processor works of 3.3V. Then the maximum output of the pyro should result in 3.3V, which means your resistor should be

3.3V/20mA = 165Ohm


Then, you use your processor's ADC to measure this voltage. The ADC's output will come in digital format, let's call this digits. Let's also assume your ADC is set to 10bit. Then the voltage measured by your processor will be:

voltage = digits * 3.3 / 2^10


To turn this into a temperature you will have to work it back:

temperature = voltage * 200 / 3.3