I was looking for a way of reading a PT100 temperature sensor with a Raspberry Pi. I couldn’t find an inexpensive way of accomplishing this on a hobbyist budget. And to be honest I like to build things so this was how I did it.
Amazon and eBay are full of things like this now. This is a $10 PT100 temperature sensor. I wouldn’t use this for a commercial application but it works just fine and I personally trust it for my beer brewing application.
It’s a three terminal sensor. A PT100 thermistor is just a resistor that varies with temperature. The resistance goes up when the temperature goes up. For a chart, see the wikipedia page.
There are three ways to hook up a thermistor.
Typically you have somewhat long, thin, wires so the resistance is not negligible.
The resistance of a PT100 varies at about 0.38 ohms per degree celsius, so if your wires measure a total of 0.5 ohms, you’re off by over 1 degree. And the thermal coefficient of copper is significant (3.8 Ohm/Ohm/K) so your wire resistance cannot be linearly calibrated out.
The first way is to use two wires.
R1 and R2 represent the two wires leading to the thermistor.
The thermistor (R3) is sensed by measuring the voltage V = V1 – V2
And you calculate R3 by using Ohm’s law, R = V / I
R2 and R1 can be measured but like I talked about, you can’t just calibrate these.
Nobody does this except when the leads are very short. For example if your thermistor is on the PCB with the ADC.
On to method #2:
Three wire thermistor sensing
The 1mA current flows from the positive supply through the wire (R2) through the thermistor (R3) and through the final wire (R1) before reaching the current sink (I1) (and on to ground)
Here I added another wire represented by R4 and terminated at the node V3.
Almost no current will be flowing in or out of V3 – we’re just using it to measure the voltage on the other side of R1.
We can use this extra wire (V3) to measure the voltage drop across resistor R1 because we also know the voltage V2. The voltage drop across R1 is:
V(R1) = (V3-V2)
which also happens to be the same as the voltage drop across R2. The wires are the same size and length (approximately)
V(R2) ≈ (V3-V2)
Now that we have a third wire (V3) we should use this in place of V2 to measure the thermistor. Consider the value (V1-V3). This eliminates the voltage drop due to R1 but it still has the voltage drop due to the 1mA current flowing through R2. Since we already calculated the voltage drop V(R2) we can simply subtract it, giving the voltage across the thermistor Vtherm:
Vtherm = (V1-V3) - V(R2) or Vtherm = (V1-V3)-(V3-V2)
Four wire sensing
Four wire sensing is the easiest but nobody uses it. You need an extra wire.
I added a wire represented by R5 and terminated into node V4 in the above schematic. Measuring the thermistor would be really simple if you have a four wire setup: you just measure V4 and V3 with a voltmeter (or differential ADC). The voltage across the thermistor is (V4-V3).
On to the PCB!
The following board that I’m sharing is free-for-all. It’s not perfect but it worked for me the first time around and I was incredibly surprised. As an engineer you come to expect your designs to be nearly FUBAR on the first try. Actually – I’m being modest; they often work reasonably well. I just stopped being modest. I’m sorry.
Here’s the schematic. Click the image to see a larger view:
This board has two current sinks. Each sinks 1.0mA with a reasonably wide compliance range (TBD).
The current sinks are connected between the EX+ and EX- pins. The ADC inputs are connected across SENSE+ and SENSE-.
The current sink is fixed at 1mA.
The ADC is the Microchip MCP3427. It is a 16 bit I2C converter with an onboard 2.048v reference. It also has a programmable gain amplifier (PGA) that can multiply the analog input by 2, 4, or 8. This allows you to achieve higher dynamic range in the digital domain. The analog inputs are differential so you can measure a differential voltage without adding external op-amps, which is perfect for this application.
Let’s say you want to measure between -50 Celsius and +200 Celsius using a PT100 with a 1 mA current sink. The Wikipedia chart shows that the resistance varies between about 80 and 176 ohms and thus the voltage is 80 mV to 176 mV. Enabling the x8 PGA will multiply these values by 8, giving 640 mV minimum to 1.408 volts maximum.
The voltage is then converted by the 16 bit ADC with 2.048v reference. This gives
0.64 / 2.048 * 2^16 = 20480 LSB for -50 Celsius
1.408 / 2.048 * 2^16 = 45056 LSB for +200 Celsius
This is 24576 LSB over 250 degrees, or about 98 LSB per degree. Or (about) 0.01 degrees per bit. This is completely neglecting linearization issues. I’m just showing you the dynamic range of the signal path.
This design is not ideal for three wire PT100 sensors, but it does work just fine if you don’t have long lead wires. You could use the second ADC channel as the wire compensation channel. Just subtract the wire voltage drop from the primary channel reading.
If you don’t care about the static offset due to one of the PT100 sensor wires, you can use this board as a two-channel device. Just hook up the single red wire to both the EX+ and SENSE+ lines and hook up one blue wire to EX- and the other blue wire to SENSE-.
(The colors could be anything, but there will be one of color ‘A’ and two of color ‘B’)
I made the decision to leave the terminals independent so that you can easily attach a different type of sensor to the ADC.
As usual, I had OSH Park make the boards and I’m sharing the project so that anyone can order boards for themselves. Here’s a link to the OSH Park page for this project.
Bill of materials:
Finished board! Sorry it’s a bit messy.