Go Down

Topic: PT100 sensor - help a beginner? (Read 79563 times) previous topic - next topic


Hi guys, I'm a beginner when it comes to understanding the Arduino. I'm currently using the Uno, and that's the only one I've used.

So, don't let me waste your time, and let's get in topic...
I just got the PT100 sensor (the one with 3 wires, one blue, red and white) and I'm going to make a thermometer, but well, I have a problem... I have no idea how to read the temperature, or the values at all. I get very strange values and it seems like it doesn't work at all, but it's just messing around with me.

I've looked around on the internet, for people using the PT100 with the Arduino and how they've done but it seems like nobody has. So I looked up a random page (http://www.yetanother.eu/arduino/articles/temp_basic.php) with a guy using an Arduino for reading temps (Note: with another sensor!) and I used his code (code in link, and I'll post it below) which didn't really work. When I uploaded the code (after modifying it just a little bit, because it was minor errors in it) the Arduino just started to give me strange values in the Serial Monitor (in the range of 70-90), and the values didn't change when I had the PT100 in my room (21c), or on the balcony (11c).

Strange code that I got off an website:
(note that the comment in the code says "Temperature sensor plugs into analog pin 0" and later on "int tempPin=0;")
Code: [Select]
  TMP36 Temperature Sensor.
  Temperature sensor plugs into analog pin 0.
  5V supply.

int tempPin=0;

void setup()

void loop()
  float temp=(analogRead(pin)*5.0)/1024.0;


I think that I've wired something wrong. I tried a lot of combinations (switching the wires between 0, A0, GND and 5+), but nothing seems to work. Could someone explain to me how and where to connect those wires and maybe give me a little code just to make it work? :I

I'd appreciate quick response, thanks guys! :)


Oct 18, 2012, 01:11 am Last Edit: Oct 18, 2012, 01:16 am by retrolefty Reason: 1
A PT100 is a temperature sensor called properly a RTD (resistance temperature detector), is simply a resistor that varies it's resistance in a very specific manner Vs the temperature it is exposed to. They are very precision sensors capable of very accurate measurements. Two of the wire represents the variable resistance and the third wire is attached to one of the other wires at the sensor so that in the proper circuit the length of the lead wire back to the circuitry will be able to factor out the fixed resistance that the wire distance represents. A RTD is not used directly by itself but is rather the variable component in a typical wheatstone bridge configuration, usually followed with a instrumentation quality op-amp stage to raise the measurement voltage to a more useful value. There are also special purpose ICs designed to interface with RTD sensors to make the conversion from variable resistance to variable measurement voltage a little simpler to realize.

So we really need to know how you are wiring the RTD up to see if you are close to having a viable solution. in a wiring schematic. It would require at the minimum a second fixed resistor so that you could form a voltage divider so that the changing RTD resistance would be able to be measured as a changing voltage capable of being measured by an arduino analog input pin, but as I said the vast majority of usage of RTDs is with a full wheatstone bridge configuration followed with amplification.

Here is a handle PT100 temp Vs resistance and resistance Vs temp calculator so you can see the range of resistance change that any given temperature range will result in.

And here is a Wikipedia article on RTD sensors that gives both good theoretical info as well as practical info.


So in conclusion you first have to wire up the RTD sensor into a proper measurement circuit before you worry too much about the software sketch details that will read the results of that external circuitry. We used a lot of RTD sensors in the refinery I worked at before retirement and we considered them the best overall temp sensor over the prior popular thermocouple types.



Best way a pt100 to volt converter (0-5volt). about 40 euro.


Maybe you would do better with a less ambitious sensor like the one in the page you link?  Platinum resistance thermometers are unwieldy to use but are extremely reliable, repeatable and cope with high temperatures.  For ordinary temperatures there are many other sensors that are simpler to deal with.

However if you want to learn about instrumentation amplifiers and wheatstone bridge circuits, go right ahead!
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Well, I think that I'll just go and buy a DS18B20 http://www.lawicel-shop.se/prod/dig-therm-ds18b20-1wire_854351/Maxim--Dallas_55370/ENG/EUR and save myself a lot of frustration and time. Thanks for your answers guys!

Papa G

Although it's the least of your problems, you seem to be reading an analog input pin that you haven't defined:
Code: [Select]
int tempPin=0;
float temp=(analogRead(pin)*5.0)/1024.0;

which probably explains why you are not getting a stable erroneous reading.



Sorry to drop in to an old-ish thread, but my question seems highly relevant to this and I thought it's better to keep things together.

Anyway. I'm quite a beginner with Arduinos (and C/C++ in general), but I love tinkering with things and programming, so...

Long story short, I'm "pimping up" a toaster oven (yes, laugh if you will, I did), and I pretty much need a thermal sensor that can go up to 250C. I ordered a PT100+ (description said it is good from 0C to 400C) from ebay because they seemed to be dirt cheap for what they do.

But now that I read this, was that something I shouldn't have done? I mean, am I digging a hole for myself by trying to use that, or is that a viable thing to use just for measuring temperatures between 50C and 250C (maybe 100C-250C, haven't decided yet)? I'm looking for 1C accuracy, I don't need anything more, probably 5C would be ok.

Do you have any advice of what I should do when using that, or do you have any examples of what I should've bought instead that would be easier to use?

I thought that I'd just analogRead() that sensor (connecting it to 5V and GND also, I'd guess) and figure out what temperature is what reading and go with it. Would that not work?


Apr 01, 2013, 06:07 am Last Edit: Jun 01, 2013, 03:28 pm by Nick_Pyner Reason: 1
For the temperature range you require, an RTD is a sensible way to go.  Their main problem compared to the likes of the DS18B20 is that they require additional hardware, usually an amplifier and perhaps a multiplexer. There has been information here and at openenergymonitor.org.


Thanks for the reply. Is that additional hardware strictly necessary (meaning it won't work AT ALL without it)? Or can I just connect the sensor straight to arduino and have it work, somehow. As I'm just tuning a small oven, I could go with ~5C precision quite well. Also the 0..400C range is a bit overkill, but hey, it was around 3€ so who cares. If I go to bare minimum, I'd be well if it measured 50, 100, 125, 200, 225 and 250C points, wouldn't really need anything more.

Before I read anything I just thought I'd connect it similar to a potentiometer and have it return some range of numbers with analogRead(). Does it not work that way at all and an amp/multiplexer is required? (if so, any pointers to what I'd need to get. Preferable cheap as the cost so far has been really, really low. (iduino nano at ~6€  is the priciest part...))


The components required for an amplifier would be just a couple of dollars - an LM324 opamp and a few peripherals which could be assembled on a proto shield. This last would be the most expensive item. If you just want some crude relative readout, you may get by without them but, in that event, you may be better off with a cheapo thermistor.

I have managed to leave my PT100s on the shelf. The link I posted should have all you need.


Thanks again! I'll check out if I can find what parts I'd need.

But, you're correct. I would be okay with an "el cheapo" thermistor, but for the life of me, I can't find any online (ebay) that could handle 250C. They all seem to stop at 125C. I can't really by local, because... well, you wouldn't believe the prices if Id' show you a photo. I didn't believe them when I saw them with my own eyes. (for starters, the small metallic part in side a common jumper? 1,20€. ONE. JUST the metal. 0,80€ for the plastic. ONE 3mm ~3V standard red led? 3.50€. Yeah, I bought 20 bi-color LEDs for ~2€ via eBay...)


Apr 01, 2013, 11:10 am Last Edit: Jun 01, 2013, 03:30 pm by Nick_Pyner Reason: 1
OK, if you can't find any thermistors good for +125 on eBay, they probably don't exist, and you are right to use the PT100 - again. Hopefully it didn't cost more than about $5 anyway. I really can't comment on their use without amplification. I needed the accuracy they can provide, it's just that I was able to use the DS18B20 and preferred to go that way. I think it would be better to go with amplification - the better support would probably justify the dollars.


Thanks, yet again. Yeah, I was just reading the link you gave me, and the schematic doesn't look too difficult to implement. A bit more work, but, hey, if I didn't like tinkering, I don't think the Arduino forums were the right place to be in the first place :)

Anyway, the opamp and the multiplexer were *really* cheap parts (both were in the 0.20-0.30€/piece category), so I ordered a few of those already. The rest are just a few resistors, caps and a pot that I probably already have. I have a few pieces of breadboard lying around so I'll first build it there and see if I can scourge up something more permanent after that. I'll probably first try without the amp/multiplexer (simply because they take time to arrive) and see if I'm able to do without.

I just wish there'd be something as simple as a TMP36, but with more temperature range... well, anyway. Thanks for the pointers.


I might try putting the PTs I have into service, and I will be interested in  hearing how you go. The dumb thing is that they are already installed in my equipment but they are just serving as screw-in plug!

If you plan on several, you might want to make up proto shield for them. This is by far the best deal on shields I have seen, and should bve very suitable. The headers have long pins.



Yay, my sensor (finally!) arrived (that's what you get from ordering overseas via ebay...), and I got to play with it. I connected it straight to the analog pin of my arduino (well, "straight", I of course made a voltage divider for it, otherwise it wouldn't much make sense..) and run a program to read the values - and it worked!

A few minutes of math later I had a (very) rough temperature meter working. The normal 0-5V reference is way too much for the sensor (that at my current resistor values, outputs something between 0.44 and 1.39V when fed the arduino 5V). Luckily there were two facts:

1) I won't ever be hitting the 1.39V limit of the sensor, because that would need 850*C temperature. I'd at MOST be hitting 300*C which is about 0.86V)
2) Arduino has an internal 1.1V reference voltage capability.

By setting my reference to that 1.1V (on a mega you need INTERNAL1V1 and not just INTERNAL) I got a reasonably accurate meter just from the sensor and a couple of resistors, no need for op-amps or anything. Because I will be using this in a normal baking-oven project, I don't need that accurate readings. The cake won't care if the oven is at 225*C or 223.4*C... :)

Go Up