Interfacing sensor problem

JaniM

Member
I have a pressure sensor, VDO-style. The ohms are 1.5 to ~160 ohm and 0-150 psi range.
How I connect that to 40X1? I had read voltage dividers topics, but I don't understand that how big resistor should be.
The supply voltage would be +5V and the sensor end is in ground and one signal wire.
 

moxhamj

New Member
Quick test - put it in series with a 1k resistor and use the readadc10 command. ok, it isn't using the full range but the resolution will still be very good. You could lower that resistor a bit. Maybe 470 ohms. Then the resolution gets better. But also more heat is dissipated in the sensor so perhaps don't go much lower than that.

You can calculate the expected volts. 160R +1000R so the divider is 160/1600. Then multiply by 5V = 160*5/1600. = 1/2 a volt. Readadc10 gives 0-1023 so you are using 10% of the range with a 5V supply so the numbers will go 0 to 102.
 

JaniM

Member
Thanks for replies.
Yes it's 1.5 ohms.
Should it be some protection in AD input, because application would be in automotive? I would use cell phone charger.
 

moxhamj

New Member
I'd still try 1k. Resolution is going to be 1% which ought to be fine. Protecting the AD input is fine in theory. But if you put another resistor in it will upset the AD input. If you have a 5V regulator - go 5V => 1k => sensor => ground. Measure the volts between the sensor and ground. Should go 0-1/2V. Maybe put a 0.1uF cap across the sensor to smooth any spikes. You may get lots of posts about using picaxes in cars. My experience is they work fine, and I've been using one in my car for a year now to replace part of the engine management system. Use a 5V reg, 22uF and 0.1uF across the picaxe power supply. Maybe don't put it right near the spark plugs. My picaxe sits over the battery.
 

JaniM

Member
Yes, I know earlier automotive topics of power supply.
I have Megasquirt in car and they works fine also.
 

westaust55

Moderator
With a 1kOhm resistor it would be better to use the READADC10 command for 10 bit resolution.
Then the fact that you are only using about 13% of the operating range (0 to 5V) would be virtually irrelevant as one increment/step equates to 0.75% or approx 1.1 psi.


If needing to keep the variable usage to a byte rather than a word, then reconsider the resistor value. At 1 kOhm, the increment/step will be 3% or 4.5psi.
With a 220 Ohm series resistor, the working range is 40% of the supply voltage and you will be roughly the same increments accuracy as the 10-bit READADC10 command.
For READADC command which is 8-bit resolution the 220 Ohm resistor will again give similar increments of 0.95% or 1.4 psi
 

wapo54001

Senior Member
The VDO sensor is rated at 10 ohms to 180 ohms, but can vary rather widely, but 1.5 ohms seems a stretch, unless there is a sensor type that I am not aware of.

I recommend you use a 250 ohm (249 ohm 1%) metal film resistor, or go as high as 300 ohms if you wish. At 250 ohms, you will draw about .1 watt through a shorted sensor (worst case scenario), which is well within the rating of a 1/4 watt resistor.

Go here to this URL for a voltage divider to determine the output voltages at the two extremes. You are looking at a divider of 250/10 for "0psi" and and 250/180 for 30psi or 100psi depending on which VDO you are using.

If you need more resolution and/or precision, you should go with the sensors I discuss below. A 4.0V spread will give you about 820 counts to work with, and the precision and linearity of the sensor is outstanding.

http://hyperphysics.phy-astr.gsu.edu/hbase/electric/voldiv.html

For 0psi, I show an output of 0.192V, and for maxpsi, an output of 1.895V (assuming a high Z input -- I'd use a 10K resistor between the divider and the Picaxe input if I were you).

The difference is about 1.70V - so divide 1.7V by 5.0V and multiply by 1023 and you get a 348 count, which is the number of steps you have to work with over that pressure range.

I feel that both the VDO and the Stewart Warner resistive sensors are primitive and inaccurate by modern standards. If you want to do precision measuring, suggest you purchase an Autometer 2245 (15psi) or 2246 (100psi) sensor. Then, you'll have a full 4.0V spread between 0psi and maxpsi, and an overall error of <1% of FS across the entire pressure range. Or go to Digi-key and type in "pressure transducer" and you'll find SSI models available for around $65 with 24-gauge wire pigtails. This is the best buy you can get, but be aware they are not protected for reverse or over voltage and I don't like the idea of 24-gauge wire in engine compartments.

Hope this helps

PS With reference to "spikes" on the input: I would recommend that, rather than a capacitor, you write some code to average the input over a period of time. Write a loop that runs while x<20, and add the input value each time. Then, after taking twenty readings or however many you want (with a "pause 2") in between, divide the value by 20, and you've got an average count over around 50ms that will take care of any variation. Your routine should run fast enough that you will not notice the delay. You can play with the values in the routine.
 
Last edited:
Top