PIC based Pt100 RTD temp sensor circuit

Can anybody give me any hints ideas or circuits to allow me to read the temperature from a Pt100 RTD probe in to a PIC microcontroller?

Regards, Mark

Reply to
MarkMc
Loading thread data ...

The signal from an RTD is very small, so you need a low offset, low drift amplifier to bring the signal up to a range that is appropriate for the PIC A/D converter.

If you are determined to roll your own amplifier, I suggest you visit the various op amp manufacturers' sites and look for application noted for platinum RTDs.

For example:

formatting link
formatting link

Reply to
John Popelish

There are 3 issues

  1. convert the change in resistance into an analog signal

  1. digitize the analog signal and get the digital value into the microcontroller

  2. convert the digitized value into real units

Which are you concerned about?

Dan

--

Dan Hollands

1120 S Creek Dr Webster NY 14580 585-872-2606 snipped-for-privacy@USSailing.net
formatting link

Reply to
Dan Hollands

I had a read of the MAXIM application notes, which use the MAX197 IC and a couple of op amps for amplification. This seems to be perfect, but the only problem is that it costs =A320 for a single 28-pin DIN MAX197, which makes it a bit unviable for me. It is a one-off personal project, but others on my brewing forum may well want to build units themselves.

I think I understand what's required at a high level, but my electronics isn't up to it at the low-level. I need a range of 0C to

100C and 0.5C accuracy/resolution for my application.

High level things I think I need (high-level block diagram)

4-wire PT100 RTD "Something" to generate the excitation current - I think this needs to be extremely accurate and invariable. Something to amplify the small voltage across the RTD in to the range of an ADC. Looks like NS ML4140A-2.500 is used for this in the links above?

An ADC to convert the analogue signal in to a format for my PIC to use. Are there not PIC's which have on-board ADC's that I can use for this purpose or is this not a good idea?

I think I know how to convert from the digital voltage in to a temperature - divide the known voltage range up in to chunks based on the bit resolution of the ADC. Say - 0-5v ADC and 10-bit, I would then 5/((2^10)-1) to get the voltage increment per bit. Then map the 'voltage' reading back to resistance (known excitation current), and use a look-up table to 'linearise' and then interpolate to give a reasonable approximation of temperature.

One thing I'm not sure about is how to calibrate this process.

Another is that IIRC 0C is 100R and 100C is 138.5R (for Platinum PT100) which @ 1mA gives a voltage reading range of 100mV-138.5mV. I'm sure I can scale this up so that the 100C resistance maps somewhere near 5 volts, but the 0C will not be near 0v. so some of the 10-bit signal is wasted. Could I not get better accuracy (perhaps it's not needed with

10-bits) by translating the 0C voltage/resistance somewhere near 0v and then scale/amplify so that 100C is near 5v so I'm using a larger portion of the bit range?

Regards, Mark

Reply to
MarkMc

I'll have to digest some of this to understand it fully, but one thing which I'm not too sure how to do is the two point calibration.

IIRC the MAX197 app notes suggest calibrating with a highly accurate

100R and 300R resistors. Say I do this and note the voltage or binary value from the ADC, what do I then do with these two values? I see how I can apply a correction factor, but this doesn't take both calibration points in to consideration.

Cheers, Mark

Reply to
MarkMc

Had a look, and they seem to be about =A3200. Not what I'd call cheap for hobby use.

What would be so expensive to make?

I have the PIC microcontrollers and programming hardware + software etc. The way I see it I just need to find a good OpAmp and ADC?

Half the fun is the journey with this hobby I think. Yep, right now, I don't know too much, but I think I'm getting somewhere - doesn't seem too scarey.

Regards Mark

Reply to
MarkMc

Ah, I see. The calibration I had in mind was to pull things in to line with the look-up tables.

Cheers, Mark

Reply to
MarkMc

MarkMc wrote: (snip)

Except for the transposition of LM, yes. It is a precision 2.5 volt reference regulator. In combination with the opamp, it forces the voltage drop across the grounded 2.5K resistor to be a constant 2.5 volts, so the RTD current is forced to be a constant 1 mA.

Most PICs have an internal 10 bit (1024 level) ADC. You just need to amplify and shift the signal into the ADC measurement range. You may also want to reference the ADC full scale voltage to a precision reference, instead of using the 5 volt supply as the full scale value, or else the accuracy of the PIC supply gets involved in the measurement.

You might use a distilled water ice bath and boiling point as a two point calibration. Otherwise, you buy a high accuracy liquid thermometer and use it in a stirred water or oil bath as a temperature reference.

You can add an arbitrary offset to the resistance measurement by connecting R1 in figure 1 to an adjustable voltage, instead of to ground. This voltage should be a low impedance source (not just a pot hooked up between two voltages) like an opamp follower, in order to not upset the subtracter's ability to measure the voltage across the RTD. The subtracter circuit is A4 and the resistors around it.

You can use a pot between the 2.5 volt reference and ground to feed the follower.

When you have zero degrees just above ground and 100 degrees just below the ADC positive reference voltage (full scale voltage) you are ready to calibrate and linearize the circuit with stored constants in the program.

Reply to
John Popelish

A couple suggestions. Excite the RTD with a current proportional to the PIC supply, scaled down to about 1 mA. That would involve replacing the precision 2.5 volt reference with a 2 to 1 voltage divider from the 5 volt supply. Now, since the excitation will be proportional to the supply, if you use the supply as the positive reference voltage for the A/D, the signal will also be proportional to the A/D reference. This cancels any scaling errors for changes in the supply and eliminates the need for a precision component.

Use the two point calibration method (which eliminates the need for .1% or better standard resistors and compensates for tolerances in your RTD) and apply this formula to the result. temperature in degrees C = (counts-Czero)*100/C100 where Czero is the A/D result for ice bath, and C100 is A/D result with boiling bath. If you do this at sea level, this linear approximation for the RTD averages about .235 degree error over the range of 0 to 100 degrees C. If done at higher elevations, you can change the constant

100 factor to something lower that represents the local boiling temperature. If you have precision resistors available, they can be substituted for the RTD during calibration. Store the calibration constants in EEPROM.
Reply to
jpopelish

snipped-for-privacy@rica.net wrote: (snip)

I found an error in my math. The average error in the linear approximation over this range with a best fit is .097 degrees. If you force the errors to zero at the end points (a sub optimal fit, overall) the worst error occurs at about the mid point temperature and is about

-.4 degrees. If you fudge the endpoints to read .25 degree high, the midpoint error is reduced to about -.15 degree.

Reply to
jpopelish

The two point calibration I was referring to is just interpolating 0 to 100 degrees, linearly between the two A/D values you get with an ice bath and a boiling bath, using your RTD and amplifier. The linearity errors over that small temperature range are not very big. If you want to correct them, you need a table or polynomial fit to the RTD curve, and fit that to your zero and 100 degree points.

Reply to
John Popelish

A design to do what you want is a big challange to one of your experience. You will probably spend considerable money and a great deal of time and still not achieve your goal

There are a multitude of RTD digital panel meters that do what you want available in the UK

Just buy one - it will work and probably be cheaper than you can do it yourself

Search internet for RTD temperature panel meter UK

Dan

--

Dan Hollands

1120 S Creek Dr Webster NY 14580 585-872-2606 snipped-for-privacy@USSailing.net
formatting link

I think I understand what's required at a high level, but my electronics isn't up to it at the low-level. I need a range of 0C to

100C and 0.5C accuracy/resolution for my application.

High level things I think I need (high-level block diagram)

4-wire PT100 RTD "Something" to generate the excitation current - I think this needs to be extremely accurate and invariable. Something to amplify the small voltage across the RTD in to the range of an ADC. Looks like NS ML4140A-2.500 is used for this in the links above?

An ADC to convert the analogue signal in to a format for my PIC to use. Are there not PIC's which have on-board ADC's that I can use for this purpose or is this not a good idea?

I think I know how to convert from the digital voltage in to a temperature - divide the known voltage range up in to chunks based on the bit resolution of the ADC. Say - 0-5v ADC and 10-bit, I would then 5/((2^10)-1) to get the voltage increment per bit. Then map the 'voltage' reading back to resistance (known excitation current), and use a look-up table to 'linearise' and then interpolate to give a reasonable approximation of temperature.

One thing I'm not sure about is how to calibrate this process.

Another is that IIRC 0C is 100R and 100C is 138.5R (for Platinum PT100) which @ 1mA gives a voltage reading range of 100mV-138.5mV. I'm sure I can scale this up so that the 100C resistance maps somewhere near 5 volts, but the 0C will not be near 0v. so some of the 10-bit signal is wasted. Could I not get better accuracy (perhaps it's not needed with

10-bits) by translating the 0C voltage/resistance somewhere near 0v and then scale/amplify so that 100C is near 5v so I'm using a larger portion of the bit range?

Regards, Mark

Reply to
Dan Hollands

Look at these.

formatting link
formatting link

Reply to
Jeff Thon

Thanks, these look like really good reading.

Regards, Mark

Reply to
MarkMc

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.