How to read resistance
Hotpuppy
Posts: 10
I'm looking for advice on how to determine resistance.
I want to use a BS2 to read the resistance on a pressure sensor.· The resistance will be in a range of 0 to 300 ohms or so.
I'm thinking that if RCTime is designed to work with a known resistor and unknown capacitor that I could use a known capacitor, a current limiting resistor and then an unknown resistance value instead.· Would that work or am I off base here?
thanks,
Brian
I want to use a BS2 to read the resistance on a pressure sensor.· The resistance will be in a range of 0 to 300 ohms or so.
I'm thinking that if RCTime is designed to work with a known resistor and unknown capacitor that I could use a known capacitor, a current limiting resistor and then an unknown resistance value instead.· Would that work or am I off base here?
thanks,
Brian
Comments
After converting N to seconds (Tm) the following equation holds:
Tm = RxC
If you know either R or C you can solve for the unknown.
If you use a known resistor in series with an unknown resistor
you have to keep in mind that R in the equation is the TOTAL
resistance and you will have to subtract the known resistance
in order to calculate the unknown part.
So using the RCTime command to find an unknown resistance will
work fine. A lot depends on the accuracy and resolution you want
to achieve in finding the unknown resistance. An A to D converter
may give a better result.
phil kenny
Post Edited (phil kenny) : 5/3/2009 7:59:48 PM GMT
Thanks for the response. What I want to do is measure the rough temperature and oil pressure of a small diesel engine on my sailboat. In a nutshell, the temperature sensor and pressure sensor use resistors. Temperature is done via a thermistor. I'm currently playing with a temp sensor ($6.99 autozone for a 1980's Ford Escort Temp Sensor). At room temp it reads approximately 300ohms. As temp increases resistance decreases.
I've got it wired like this:
R1 C1
p7
/\/\/220/\/\/\
|
3300uf Cap----vss
|
thermistor
Vss
T1
This is how it is diagrammed in "What's a microcontroller" page 145. I'm substituting the thermistor for a "test" resistor.
Because I know R1 is 220 and C1 is a known value I should be able to build a result set like this:
Condition Time Reason
p7 unhooked A Baseline to show that program functions
p7 hooked up and T1 unhooked B Measurement of a known state of RC
P7 hooked up with T1 hooked in
and water at room temp C data sample. Difference between B and C should be approximately 300 ohms.
Right now I can Time A, but B and C don't seem to work.
i'm using the code out of pp146 and 147 which basically sets P7 high for 1 second and then sets p7 to input and counts until it's low.
How would an A/D converter do this differently?
I ordered the Dallas 1 wire PIC from PH Anderson..... and a few dallas thermometers. That will cure my temp issues... but I still will have to read pressure. His PIC board does AD conversion as well, but I got the impression it read voltage. The way most temp senders work is as a resistance sink.
12v
gauge
sender (variable resistor)
ground
|
ground
So if you substitute an AD converter for the guage and eliminate the second ground you will still see 12v, right? You would need to be in between the sender and ground in order to get a good idea of it's resistance.....
I appreciate the discussion and responses.... the stuff about reading engine sensors isn't terribly well documented and this should help others. The underlying metrics make a stamp the nearly perfect data tool for engine performance.
470, 1k, 2k and 10 k ohms before you try substituting the thermistor
and make sure you get reasonable time measurements.
Then try a 300 ohm resistor and note the results.
phil
Post Edited (FearTurtles) : 5/4/2009 2:46:16 PM GMT
Rating - Measured - Stamp Finding
10k - 9840 9223
1k - 982 644
500 463 172
220 216 15
I'm checking each resistor with a digital multimeter. this doesn't seem to be accurate enough to be dependable. Especially when a thermistor will be involved.
The code that I'm running is:
tc=0
HIGH 7
PAUSE 250
RCTIME 7,1, tc
req= (tc*15) + (tc *7/10) + (tc *4/100)
I forget why I called it REQ but that is the calculated ohms. I read in some stuff on PH Anderson's site that 14.74 was the conversion from RC time to ohms. This formula came from one of his project/assignments for his college EE class.
I also tried varying the wait time from 100 to 750 and the results were repeatable. This indicates that the capacitor charges adequately in 250 ms. I tried a couple different capacitors and again, the results were repeatable which indicates that the cap isn't the issue.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Callsign: NQ5I
Interests: Robotics, Embedded Systems, Computers, Machining
If you search the Help menu in the Basic Stamp Editor for RCTime you will see
exactly how it functions. The time measurement measures how long it takes for the
capacitor/resistor voltage to reach the threshold voltage of 1.4 volts assuming
that the capacitor has been charged to +5 volts.
There is a 220 ohm resistor in series with the output pin being used to charge the
capacitor. When you have a 10 kohm resistor in parallel with the capacitor, the
voltage on the capacitor will reach nearly 5 volts during the charging phase.
Therefore, the formula you are using to calculate the RC time constant:
T = RC
is fairly accurate.
However, as you keep lowering the 10 kohm resistor, the voltage divider
formed by it and the 220 ohm resistor in series with the output pin means
that the maximum voltage on the capacitor isn't able to reach 5 V. The
consequence is that the time constant formula becomes more and more
inaccurate, just as you have verified from your own measurements.
If you need to measure the resistance down to these low resistance
levels, you will probably have to use an A to D converter.
Take a known resistor of 270 ohms connected to + 5 volts and connect
your unknown resistor to ground and the 270 ohm resistor forming a
voltage divider. Connect the output of the voltage divider to the input
of the A to D converter.
Use the Stamp to monitor the A to D converter output. From this
measurement is is a simple matter for the Stamp to calculate the value
of your unknown resistor.
phil kenny
Post Edited (phil kenny) : 5/7/2009 7:35:23 AM GMT
You raise some good points. Hopefully this discussion will be helpful to others as well. I did not test it last night, but last Sunday I did hook my DMM (digital multimeter) up to the circuit and put it in max hold. The circuit was able to reach 5v quickly. As a second point of reference, either the parallax documentation (help files) or PH Anderson's documentation shows that the time required to charge to 5v is actually quite small with most capacitors. I think this is backed up by the lack of variance when I extend the charge time.
My thinking with this second point is that if the capacitor was not reaching 5v in 250ms and you extend it to 500 ms you would achieve more charge or a complete charge which would show itself as an increase in the rctime measurement. This isn't the case, so the references I have that suggest that charge time is quite short appear to be accurate.
Moving back to your post, I need to go read more about the concept of voltage divider networks. My understanding is that the 220 ohm resistor is there to prevent damage to the stamp in the event of a short. It's a current limiting resistor or throttle. My understanding is that the stamp charges the cap, and some current leaks out via the unknown resistor. When the stamp stops charging it starts measuring. Some time is invariably lost to executing the RCTime command, but this should not be significant. This is probably the missing measurement amount.
How would an AD converter work and do you have any suggestions on chipsets that I should look at? Would the AD converter simply measure the voltage to be used to solve for resistance? I suspect you would want to do a similar tap where you use a small, known protective resistor and use the AD converter to sense the voltage in the circuit.
something like
12v
/\/\/\/
+
*******
DSS (negative post)
220 ohm | thermistor
A/D
voltage sense
-P0
|
Do I have the right idea here?
Thanks again for your help and answers,
Brian
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Callsign: NQ5I
Interests: Robotics, Embedded Systems, Computers, Machining
www.parallax.com/Store/Components/IntegratedCircuits/InterfacingChips/tabid/613/CategoryID/78/List/0/SortField/0/Level/a/ProductID/232/Default.aspx
Data sheet for the LTc1298 is at:
www.parallax.com/Portals/0/Downloads/docs/prod/appkit/ltc1298.pdf
This pdf file has Basic Stamp code for the LTC1278.
Hookup as follows:
+5v
270 ohm
Thermistor
Gnd
Junction of 270 ohm and Thermistor goes to ADC CH 0 input
Note that the LTC1298 input on both channels is +5 volts maximum.
The ADC 0831 is similar but only has 8-bits:
http://forums.parallaxinc.com/www.parallax.com/Store/Components/AllIntegratedCircuits/tabid/154/CategoryID/78/List/0/SortField/0/Level/a/ProductID/245/Default.aspx
Data sheet for it is at:
http://forums.parallaxinc.com/www.parallax.com/Portals/0/Downloads/docs/prod/datast/dsadc0831.pdf
Programming the ADC 0831 is a little simpler, but follows very closely to the
protocol used for the LTC 1298.
The reason I suggested the LTC 1298 is you can still get fairly good accuracy for low
values of Thermistor resistance (50 ohms or less). If accurate measurements in this
range are important, use the LTC 1298. If not, use the ADC 0831
Let me know if you have more questions.
phil
Post Edited (phil kenny) : 5/7/2009 8:57:31 PM GMT