Shop OBEX P1 Docs P2 Docs Learn Events
Measuring Sensor Resistance — Parallax Forums

Measuring Sensor Resistance

CPUMANCPUMAN Posts: 55
edited 2005-12-02 23:46 in BASIC Stamp
I’m trying the read the resistance of a Honeywell TD4A temperature resistor and having a little bit of difficulty.
·
First a little about my setup… I’m using a RC circuit the same as the one seen in the stamp manual (figure A of the 2 circuits), with a C value of 0.1uF.
·
The problem is I’m get a value that is fairly off from the actual resistance, which I determined the actual resistances with a multi meter and made sure that value matched the data sheet value for the current room temperature (which is the temperature the sensor was at).· The calculated resistance value from RCTIME is off by 300 Ohms.· I verified the calculation to make sure it wasn’t an error do to the stamp only being able to do integer math, but using the RCTIME value I came to the same value as the stamp calculated.· A variance of 300 ohms from the actual value is significant because the sensor’s resistance range is only about 1584 ohms to 3128 ohms to cover the temperature range of –40C to 150C.· I’ve pasted the code I’m using below and the diagram for the circuit I’m using is in the RCTIME section of the stamp manual.
·
I would like to get the variance down to about +/- 25 ohms of the actual value.· Can anyone give me a suggestion on how to get a more accurate and reliable reading?
·
Any help is much appreciated.

Chris

' {$STAMP BS2} 
' {$PBASIC 2.5} 
tempSensor PIN 0 
rawValue VAR Word 
tempValue VAR Word 
DO 
HIGH tempSensor 
PAUSE 1 
RCTIME tempSensor, 1, rawValue 
'k = 2 / (0.1uF * (ln(5.0/1.4)) 
'k = 15.71 
'tempValue = rawValue * k 
tempValue = (rawValue * 15) + (rawValue * 7 / 10) + (rawValue * 1 / 100) 
DEBUG HOME, "Raw: ", DEC rawValue, CR 
DEBUG "R (Ohm): ", DEC tempValue 
PAUSE 50 
LOOP 
END

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-12-02 05:47
    Chris -

    You are in a better position to evaluate the validity of the following, as it applies (or not) to your present situation. At issue is the precision of ALL of the components in the RC circuit.

    One of the things to consider here is that to obtain precise results, you must start with precision components, otherwise no matter what you do, your results will only be as GOOD as the WORST tolerence of any of your components. As an RTD device, we'll have to accept that the grid resistor therein is the basis for all precision in this aplication.

    Capacitors, as a general electronic component, are notoriously suspect as sources of poor tolerence, as well as being subject to temperature variability, and thus are often viewd as potential culprits when expected precise readings are imprecise and suspect. Check with Vishay and take a look at their polypropylene film capacitors, for various types with overall precision down to 1%. Here is a link to the poly-film capacitor section their web site: http://www.vishay.com/capacitors/polypropylene/

    A search of "high precision capacitors" will unearth others as well, I'm sure. I would imagine when you tighten up on the capacitor tolerance, so too will your results will become more accurate than they presently are.

    Regards,

    Bruce Bates
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2005-12-02 06:31
    The capacitor has to be a stable film type. Even if you use a 1% film type capacitor, a final calibration step is necessary, because 1% is not good enough for what you need and also there is variation from Stamp to Stamp in the switching threshold for RCTIME. You have to calibrate it using a precision resistor in place of your thermistor. That gives you your multiplier, k. You can't trust the theoretical calculation to get it right.

    The circuit layout should take into account possible ground loops--With poor layout it is possible to turn an RCTIME circuit into a pretty good random number generator!

    You might find something of interest on my RCTIME web page:
    www.emesys.com/BS2rct.htm

    Even with the good components and layout, there is a systematic error in the circuit. The equations are true when the resistance being measured is large, something on the order of 20 kohms or more. But your thermistor only goes from 1550 to 3000 ohms or so. When p0 goes high to put the capacitor in the high state, the 220 ohm protection resistor forms a voltage divider with the thermistor.
                 270           thermistor
       p0 ----/\/\----o----/\/\----Vss
                          |
                       === 0.1uf film cap.
                          |
                       Vss
    



    Actually, I showed it as ~270 ohms instead of 220 ohms, because there is internal resistance inside the Stamp. The capacitor does not charge all the way up to 5 volts (which is the assumption of the equation, true only when Rthermistor>>270 ohms). It instead charges up to less than 5 volts:
    .....V = 5 * (Rtherm / (Rtherm+270)) = 5*1550/1820 = 4.25 volts.
    where I used the worst case value, 1550 ohms. So, when the pin turns to an input, the discharge time through the thermistor will be less than it would be if it had charged all the way to 5 volts.

    This is a systematic error and can be eliminated by calculation, but it complicates the math.

    Another effect is possible self heating of the thermistor. When p0 is high, the power dissipation in the thermistor is on the order of 0.01 watt. Not much, but that can be enough to substantially heat a small thermistor in air.

    After working through all this, you might decide it is worthwhile to add an ADC in order to achieve better accuracy.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • CPUMANCPUMAN Posts: 55
    edited 2005-12-02 23:46
    Would the easiest method for reading the resistance of the sensor with an A/D to put the sensor in a simple voltage divider circuit?

    Chris
Sign In or Register to comment.