Reading ohm values
I would like to use my BS2p to read resistance-based temperature, fuel level and oil pressure sensors on a car engine. These are one wire sensors that are self grounded to the engine block so the BS2p would have to be able to measure resistance through a pin to ground. What's the easiest way to do this?
The temperature sensor resistances are generally 100 ohms (low temp) - 100k ohms (high temp) and the fuel level is from 0 ohms (empty) to 90 ohms (full).
I do have some ADCs if that helps, though I have never used them before so I'm not sure what sort of circuitry is required.
I don't need more accuracy than what would put the range of the sensor into a byte.
The temperature sensor resistances are generally 100 ohms (low temp) - 100k ohms (high temp) and the fuel level is from 0 ohms (empty) to 90 ohms (full).
I do have some ADCs if that helps, though I have never used them before so I'm not sure what sort of circuitry is required.
I don't need more accuracy than what would put the range of the sensor into a byte.
Comments
Take a look at the PBASIC RCTIME command, which should give you the facility for what you're looking to do. Both the PBASIC Help file, and the PBASIC Reference Manual have excellent examples and descriptions of how the RCTIME command can be used.
Unlike many simpler PBASIC Commands, you will need to study this rather sophisticated command, and how there are different circuits which can be used to structure the necassary external R-C circuit. It may also take a moment for you to realize how TIME (the result provided by RCTIME) is related to the variable external resistance via that R-C circuit.
Please pay CAREFUL attention to the necessity for the specific series of instructions which must be used in order, to effect a proper result. You (the progrmmer) are responsible for charging or discharging the capacitor (as may be appropriate) used in the external circuit.·Once you've used RCTIME a couple of times, the entire thing will almost become second nature, and many of your ADC's may end up gathering dust!
It probably goes without saying, but the precision (1%, 5%, 10%, etc) of the external components will effect the accuracy of the final results. You have no control over the resistance (the gauges) but you do have control over which capacitor you use.
Regards,
Bruce Bates