PDA

View Full Version : How to read a 12v sending unit 240 ohms - 33 ohms using a Stamp ?

JimK
03-15-2010, 04:26 AM
I have 3 gauges on my boat (waste, fuel, water).· All use the same type sender (they come in different lengths from 4-60"·but all are a metal shaft 3/4" diameter, with a float that moves up and down) with a resistive range of 33 ohms full to 240 ohms empty.· It is a 12v based system and there is a gauge for each sender, much like a gas or temp gauge in a car.

I have attached a PDF from the manufacturer which may help.·The web site is www.wemausa.com (http://www.wemausa.com) if you want to see a picture of the sender.·I was hoping to somehow read the resistance or voltage using a basic stamp (I have a BS2, BS2P, BS2Px,BS2sx - which ever may be best suited).· I am just looking to get a linear numeric value back without affecting the accuracy of the current gauge. I bought a sample sender (12" in length) and a gauge to test this at home and found when I applied 12v I get a reading of 7v (empty) and 2.3v (full)·on the 2 wires at the sender.

Not sure if measuring resistance is possible when 12v is applied or if I should use a analog/digital convertor and try and measure the voltage, but I do not know how to scale it to handle the 7+ volts, or if this is another way to measure this ?

Any suggestions would be greatly appreciated. Thanks

stamptrol
03-15-2010, 06:50 AM
If you want to keep the existing indicators running, you'll need to go the a/d route. Otherwise you could use the RCTIME function and read the resistance directly.

You may need a scaling opamp or at least a voltage divider so the a/d input doesn't exceed the max input voltage (usually 4.096 volts or 5 volts). See the data sheet.

As for scaling, the general formula is:

output = [(( INT(IN)-K1)/(K2-K1))*(HI_LIM-LO_LIM)]+LO_LIM

where: INT(IN) = raw input value from the a/d (0 to 4095 for 12-bit a/d, 0 to 255 for 8-bit, etc) This is the value your program will obtain from the a/d and plug into the equation.
K1 = raw a/d value with lowest input value ( eg. it would be 0 when the sensor shows 7 volts)
K2 = raw a/d value with highest input value (eg. with float indicating max., 2.3 volts)
output = real world value ( eg. suppose you want the scale to read 0 - 100%) This is the output of the equation .
HI-LIM = upper real world value wanted (say 100 in this case)
LO_LIM = lower real world value wanted (say 0 in this case)

You may want to play with the a/d and equation with a pot feeding 0 to 5 volts into the a/d until you get comfortable with the equation.

Cheers,

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk

http://www.siskconsult.com
·

sam_sam_sam
03-15-2010, 07:48 AM
Take a look at this post this might help