I've had a number of issues getting good stable analog readings from an RTD temperature sensor. The temperature readings have a tendency to bounce as much as +/- 5 Deg C. The circuit is very basic, a voltage divider is formed between a fixed resistor and an RTD connected to ground. The voltage at the RTD is then fed into a programmable gain amplifier set at 16 V/V. The analog signal output from the programmable gain amplifier is then fed into a 10-bit ADC on a PIC microprocessor. I've implemented a low pass filter in software to attempt to fix the problem, but the temperature readings are still very unstable. Does anyone have any suggestions about where I could look to find the source of the problem and correct it?
The first thing I'd look at is ripple in your voltage rail. Noisy voltages are killer with a voltage divider. A higher-quality measurement system might use a regulated constant current source to drive the RTD instead of a voltage divider. An LM317 can be used to do this - hook a resistor between the OUTPUT and ADJ terminal, and hook the RTD between ADJ and GND. The value of the resistor between output and adjust will set the current going through the RTD - use a precise resistor to be certain of the amount of current.
Otherwise, attempt to do the filtering in hardware if possible. You first have to figure out where the noise is coming from to make it effective. Determine what frequencies of noise you're seeing and then probe at the input to the gain stage, the output, and the input to the ADC. If there's noise everywhere, then it's in the source, otherwise it's being injected somewhere else. Make sure all of your IC's have bypass capacitors to start with. Then make sure that you don't have any long ground loops - make everything as direct (high current) of a connection to ground as possible. Don't daisy chain grounds - everything should get its own connection to ground that doesn't run through other chips.
If you're seeing noise at the source, chances are it's your voltage source for the divider. To combat this, you could put a capacitor in parallel with the RTD to make a simple filtering circuit. Just figure out what frequencies of noise you're seeing and match the capacitor to the resistance of the RTD and figure it out.
There are a few places to look.
First of all you should have some analogue filtering before you sample. Temperature measurements are usually slow changing so it should be possible to filter fairly aggressively. Even a simple RC can be very effective.
Consider how much cable you have between the circuit and the RTD. Where is that cable running in relation to other (potentially noisy) cables? Separation between wiring looms and reducing the length of the cable can both help in this case. As can better quality shielded and/or twisted pair wiring.
If you have access to an oscilloscope you should try and measure the voltage signal that you see going into the adc. Assuming that there is noise present, the nature of the noise will give some hint as to where it's coming from.
Consider how the sensor and you uC circuit are grounded with regard to what ever it is you're measuring. If the RTD is connected to an earthed object it is possible that the noise is being coupled as a result of an earth loop.
If you can post more details of the circuit you have, how you're filtering the samples and the application, it should be possible to provide some more specific feedback.
One common culprit is charge coupling between channels of the ADC (disregard if you are only using 1 channel).
Most microcontrollers with multichannel ADCs have a multiplexer and a sampling capacitor. The sampling capacitor might be in the 1-10pf range. When you switch from one channel to the next, that sampling capacitor initially retains charge from the previous channel's voltage. The sampling capacitor then has to charge up/down to the voltage on the next channel, and has a time constant that depends on the external impedance on the ADC channel input.
It is good practice to use an RC circuit right on the ADC channel inputs. (edit: if you have a voltage divider, you don't need the R; the Thevenin equivalent resistance acts as a resistor, so a 10K and a 1K divider will yield an equivalent resistance of 909 ohms.) I tend to use something in the neighborhood of 499 ohms, 100-300pf. What happens is the external capacitor in the RC network acts as a storage reservoir, so when the ADC multiplexer switches, the external capacitor very quickly charges the sampling capacitor. There's a tradeoff between using a small capacitance (fast time constant, but initial transient when ADC mux switches is very large) vs. a large capacitance (very little initial transient on external capacitor when ADC mux switches, but a long time constant) and you can solve this yourself to optimize.
You generally need to do this even if you are using an op-amp to buffer the voltage leading into the ADC. This is because op-amps aren't great at dealing with high-frequency nonlinear loads like a multiplexer + sampling capacitor.
If you are not buffering the voltage leading into the ADC with an op-amp, note that high source resistance can be a problem. This charge coupling causes a current that flows between one channel and the next, with current equal to f * C * deltaV, where f = sampling frequency, C = internal sampling capacitance, and deltaV = voltage between successive channels sampled by the ADC. Example: deltaV <= +/-3V, C = 5pf, f = 1000Hz yields a charge-coupling current of up to +/- 15nA. If your source impedance is 10K, you'll get an offset voltage of up to +/-150uV depending on the voltage difference between channels. (This really only becomes a problem with high sampling rates or high source impedances)
You might also be running into EMI susceptibility. Active components (such as your PGA) are prone to a phenomenon called RF rectification where an AC disturbance at high frequencies at the input amplifier causes a DC disturbance at the output of an amplifier. This is very common in high-gain circuits (you'll see it a lot in thermocouple amplifiers) in an electrically noisy environment.
If this is the problem, shunt out high-frequency noise by putting one or more good high-frequency bypass capacitors (1000pf-10000pf ceramic probably best) across the closest points that are inputs of your circuit. (for instance, if you have a 4-resistor one-op-amp differential amplifier:
then put 2 capacitors at the input of the resistors -- from V1 to GND and V2 to GND, you may need a 3rd one from V1 to V2 if there is a lot of differential noise -- and NOT across the op-amp inputs)