PT1000 shield

Anyone know if exist a shield for PT1000 temperature sensor compatible with fezspider?

It’s just an resistor, right?
All you Need is a 2nd fixed resistor to build a voltage divider.
Then you can use an analog Input pin.

Lets assume the PT100 can get up to 3k max.
Then put an 2k resistor right before it.
5V to the 2k resistor,
A-In to the other side of the 2k and the one side of the PT.
Gnd to trhe other side of the PT.
By this you get Zero to 3V on the aIn.
Not perfect, but it should work.

Thas’s the circuit, vcc 3.3 extender module it’s connect on socket n°9 on fez spider board. I get the voltage but it’s change continuosly…

RTD sensor it’ PT1000



public partial class Program
    {
        int socketNumber = 9;

        Gadgeteer.Socket.Pin socketPin = Socket.Pin.Three;

        AnalogInput aIn;

        Socket _socket;

        double readVoltage = 0;

        void ProgramStarted()
        {
            extender.SetupAnalogInput(GT.Socket.Pin.Three);

            _socket = Socket.GetSocket(socketNumber, true, extender, null);

            aIn = new AnalogInput(_socket, socketPin, null);

            GT.Timer timer = new GT.Timer(1000);
            timer.Tick += timer_Tick;
            timer.Start();


            Debug.Print("Program Started");
        }

        void timer_Tick(GT.Timer timer)
        {
            readVoltage = aIn.ReadVoltage();

            Debug.Print("vIn:" + readVoltage);
        }
    }


Console output:

vIn:3.2483870967741932
vIn:3.2451612903225806
vIn:3.2451612903225806
vIn:3.2548387096774194
vIn:3.2516129032258063
vIn:3.2419354838709675
vIn:3.2451612903225806
vIn:3.2612903225806451
vIn:3.2451612903225806
vIn:3.2516129032258063
vIn:3.258064516129032
vIn:3.258064516129032
vIn:3.2483870967741932
vIn:3.258064516129032
vIn:3.258064516129032
vIn:3.2612903225806451
vIn:3.2548387096774194
vIn:3.2451612903225806
vIn:3.258064516129032
vIn:3.2419354838709675
vIn:3.2451612903225806
vIn:3.2612903225806451
vIn:3.2516129032258063
vIn:3.2612903225806451
vIn:3.2516129032258063
vIn:3.258064516129032
vIn:3.258064516129032
vIn:3.2612903225806451
vIn:3.2387096774193549
vIn:3.2354838709677418
vIn:3.2516129032258063
vIn:3.2516129032258063
vIn:3.2516129032258063
vIn:3.258064516129032
vIn:3.2483870967741932
vIn:3.2483870967741932
vIn:3.2516129032258063
vIn:3.2483870967741932
vIn:3.2483870967741932
vIn:3.2548387096774194
vIn:3.2483870967741932
vIn:3.2483870967741932
vIn:3.2483870967741932
vIn:3.2451612903225806
vIn:3.2483870967741932
vIn:3.258064516129032
vIn:3.2516129032258063
vIn:3.2516129032258063
vIn:3.2612903225806451
vIn:3.2516129032258063
vIn:3.2387096774193549
vIn:3.2548387096774194
vIn:3.2612903225806451
vIn:3.2483870967741932
vIn:3.2483870967741932
vIn:3.2451612903225806
vIn:3.2419354838709675
vIn:3.2548387096774194
vIn:3.2516129032258063
vIn:3.2516129032258063
vIn:3.2548387096774194
vIn:3.2483870967741932
vIn:3.2387096774193549

How I can do to convert this to temperature?

you typify the voltage range against the PT1000’s datasheet, and the error rate in your other resistor, and then do maths. Yes, the values vary, but the point is you’re moving not very much and once you convert to degrees and work out to maybe 1 or .5 degree, you should not see much variation. From that other thread, you can see the hard coded conversion to temperature that the other code examples used by adjusting the scale of the ADC reads:

                adc = new AnalogIn((AnalogIn.Pin)pin);
                 adc.SetLinearScale(-22, 56);

So really all you need to do is make sure your assumptions are correct and your maths works for your resistance set up.

I don’t have this method adc.SetLinearScale

Ho I get resistance value?

How do you get the resistance value ? You get that by looking at the specs for the resistors you bought ?

The Set Linear Scale was (from memory) an old approach to scaling it. All it means is when the ADC reads 0 it is the bottom most value, and when it is it’s maximum value (which depends on the ADC width) it is the upper number. It’s just the “simple” way to do the maths for you. You will just have to do that yourself.

Thank @ Bret for reply but my knowledge in electronics is limited. So… to obtaine the vOut in the schema I read that with this method


double readVoltage = aIn.ReadVoltage();

and to obtain the RTD resistance value I use that


double vIn = 3.3;
double r1 = 10;

double resistenceRTD = (readVoltage * r1) / (vIn - readVoltage);

The RTD PT1000 it’s a resitence and chage it value in relation of externate temperature.
From the datasheet on internet at 0°C the resistance it’s 1000 ohm

and that’s it the output from this code


public partial class Program
    {
        // Vout *R / (Vcc - Vout)

        int socketNumber = 9;

        Gadgeteer.Socket.Pin socketPin = Socket.Pin.Three;
       
        AnalogInput aIn;

        Socket _socket;

        double vIn = 3.3;

        double r1 = 10;//kohm

        double readVoltage = 0;

        double resistenceRTD = 0;

        void ProgramStarted()
        {
            extender.SetupAnalogInput(GT.Socket.Pin.Three);

            _socket = Socket.GetSocket(socketNumber, true, extender, null);

            aIn = new AnalogInput(_socket, socketPin, null);
            

            GT.Timer timer = new GT.Timer(1000);
            timer.Tick += timer_Tick;
            timer.Start();


            Debug.Print("Program Started");
        }

        void timer_Tick(GT.Timer timer)
        {
            readVoltage = aIn.ReadVoltage();

            resistenceRTD = (readVoltage * r1) / (vIn - readVoltage);

            Debug.Print(" resistence " + resistenceRTD + "ohm");
            
        }
    }

output:

resistence 776.92307692307588ohm
resistence 629.37499999999841ohm
resistence 720.71428571428919ohm
resistence 558.33333333333292ohm
resistence 842.50000000000261ohm
resistence 776.92307692307588ohm
resistence 776.92307692307588ohm
resistence 672.00000000000057ohm
resistence 672.00000000000057ohm
resistence 842.50000000000261ohm
resistence 672.00000000000057ohm
resistence 842.50000000000261ohm
resistence 558.33333333333292ohm
resistence 672.00000000000057ohm
resistence 528.42105263158101ohm
resistence 720.71428571428919ohm
resistence 672.00000000000057ohm
resistence 672.00000000000057ohm
resistence 720.71428571428919ohm
resistence 672.00000000000057ohm
resistence 591.76470588235441ohm
resistence 776.92307692307588ohm
resistence 672.00000000000057ohm
resistence 919.99999999999613ohm
resistence 776.92307692307588ohm
resistence 720.71428571428919ohm
resistence 558.33333333333292ohm
resistence 591.76470588235441ohm
resistence 629.37499999999841ohm
resistence 591.76470588235441ohm
resistence 672.00000000000057ohm
resistence 720.71428571428919ohm
resistence 591.76470588235441ohm
resistence 591.76470588235441ohm
resistence 629.37499999999841ohm
resistence 629.37499999999841ohm
resistence 776.92307692307588ohm
resistence 720.71428571428919ohm
resistence 720.71428571428919ohm
resistence 842.50000000000261ohm
resistence 558.33333333333292ohm
resistence 720.71428571428919ohm
resistence 776.92307692307588ohm
resistence 776.92307692307588ohm
resistence 558.33333333333292ohm
resistence 558.33333333333292ohm
resistence 591.76470588235441ohm
resistence 672.00000000000057ohm
resistence 672.00000000000057ohm

What resistance and spec is the other resistor in your resistor divider ?

How does your calculation match up to real world temperature measurements now ?

That’s the R1

so, you’ve just grabbed a pretty standard resistor from your parts bin ? That’s probably ok for breadboard trials. What ohm measurement do you make of it ? Colour is really hard to be sure of in photos, but that looks like Orange/Brown/Yellow+Gold, which makes it by my calcs a 310K resistor with 5% tolerance. But who knows how it’s temperature and voltage performance is - probably less than ideal but again probably not significant amounts of drift in the ranges you’re likely to want to care about.

Let me ask you again. Does your calculation of temperature now correlate correctly with the ambient temperate you are now experiencing ?

no it’s wrong…

sorry, do you mean the temperature you calculate is wrong, or that my interpretation of the colour bands are wrong and the value is wrong?

Can you please tell us what temperature you are experiencing in your house, and what, when you put the voltage you measure via the ADC through your formula, what the calculated temperature is ?

The multimeter show 9.7 om 20k scale.In my room the temperature it’s about 18 °C. If I connect the PT1000 directly to multimeter it’s show 1072 and it’right.

DMM shows 9.7 kOhm = 9710 Ohm

So


double r1 = 10;

might be


double r1 = 9710;

Measure voltage across PT1000 at your testboard.

Is value of


double readVoltage = aIn.ReadVoltage();

near by the voltage shown by your DMM ?

Now I found a 1000 omh for R1, but I think my math it’s wrong


int socketNumber = 10;

        Gadgeteer.Socket.Pin socketPin = Socket.Pin.Three;

        AnalogInput aIn;

        Socket _socket;

        double vIn = 3.3;

        double r1 = 1;//kohm

        double readVoltage = 0;

        double resistenceRTD = 0;

        void ProgramStarted()
        {
            extender.SetupAnalogInput(GT.Socket.Pin.Three);

            _socket = Socket.GetSocket(socketNumber, true, extender, null);

            aIn = new AnalogInput(_socket, socketPin, null);

            GT.Timer timer = new GT.Timer(2000);
            timer.Tick += timer_Tick;
            timer.Start();

            Debug.Print("Program Started");
        }

        void timer_Tick(GT.Timer timer)
        {
            readVoltage = aIn.ReadVoltage();

            resistenceRTD = (readVoltage * r1) / (vIn - readVoltage);

            Debug.Print(" R " + resistenceRTD + "ohm");

        }

I would change the following :



and then

```cs]resistanceRTD = readVoltage / ((vin - readVoltage) * r1)[/code

Hi Sprigo thank for your reply… now I get these value

resistence 0.00088745387453874542ohm
resistence 0.00088397790055248619ohm
resistence 0.00088051470588235278ohm
resistence 0.00088397790055248619ohm
resistence 0.00088397790055248619ohm
resistence 0.00087706422018348613ohm
resistence 0.00088745387453874542ohm
resistence 0.00087362637362637361ohm
resistence 0.00088397790055248619ohm
resistence 0.00088051470588235278ohm
resistence 0.00088051470588235278ohm
resistence 0.00088051470588235278ohm
resistence 0.00087362637362637361ohm
resistence 0.00087362637362637361ohm
resistence 0.00088051470588235278ohm
resistence 0.00088397790055248619ohm
resistence 0.00087362637362637361ohm
resistence 0.00087020109689213887ohm
resistence 0.00087706422018348613ohm

lol - My maths was wrong also as you will be a factor of 1000 out. :-[

try…



Although those reading do seem very low as 0.8 ohms = approx -600 deg C???

Hi Srigo, the sensor it’s in my room about 20° C. Now the output is the fallow

resistence 890.94269870610003ohm
resistence 894.44444444444457ohm
resistence 890.94269870610003ohm
resistence 890.94269870610003ohm
resistence 894.44444444444457ohm
resistence 894.44444444444457ohm
resistence 894.44444444444457ohm
resistence 894.44444444444457ohm
resistence 894.44444444444457ohm
resistence 890.94269870610003ohm
resistence 887.45387453874537ohm
resistence 897.95918367346951ohm
resistence 890.94269870610003ohm
resistence 894.44444444444457ohm
resistence 897.95918367346951ohm
resistence 887.45387453874537ohm
resistence 894.44444444444457ohm
resistence 890.94269870610003ohm
resistence 905.02793296089374ohm
resistence 897.95918367346951ohm
resistence 897.95918367346951ohm