Go Down

Topic: Impossible Sensor? (Read 7219 times) previous topic - next topic

RobDrizzle

I was planning on using a autometer 2242 oil pressure sender to read water pressure... I don't know if I can get it to work and wanted to run it by the pros  :P

The characteristics of the sensor are as follows:

0 PSI ------------------100 PSI
250 ohm ---------------50 ohm

I am having a hell of a time trying to figure out how to set up a voltage divider to get this to work!!!.. It seems no matter what combination of resistors I use, I lose a lot of resolution, meaning, I get .25v-1.1v. I have been trying different Vin's and resistors.

I think I'm over my head here... so any help will make me happy!

p.s. I'm using an Uno.

WillR

#1
Mar 03, 2011, 04:29 am Last Edit: Mar 03, 2011, 04:39 am by WillR Reason: 1
If you are using the Arduino USB for power only...

You could use an external +9V Wall wart... or Battery...

Then you use a  250---o---250 network. The max voltage should be 4.5V when the sensor is at 250 ohms... You supply a 250 ohm resistor, attach it to the +9V the other end to the sensor... The other sensor lead goes to board ground... if you use a battery you have to attach battery ground to the board as well...  

Then you attach the center point of the divider to the ADC...

The when it goes to 50, you get what?... 50/300 * 9V  ===  0.15V (at minimum) or am I too tired to do arithmetic??? When the sensor is 250 Ohms -- you get 4.5V -- so that is a reasonable swing.

Total R is the 250 Ohm Resistor plus the 50 ohm minimum reading from the sensor... for determining current flow and minimum voltage. If you have a divider with equal resistors you know you get half the voltage at the mid-point.

Your current is 9V/300 ohms = 30ma -- which should be OK even for a battery -- fine for a wall wart 9V supply.

I use a 9V wall supply on my Mega2560 -- sometimes the additional voltage is handy..

Does this make sense to you?

PS: If you want you could put a 5V Zener across the sensor for safety... However, the thing you learn quickly when designing large systems is that doubling the number of components more than doubles the odds of failure... Also -- mostly it is the safety/checking circuits that fail.

You could also do a separate divider (using 1k--o--1k) then take the 4.5V and use it for the Analog Reference -- just read the CAUTIONS first -- on the reference page so you don't fry your analog in pins.


liuzengqiang

#2
Mar 03, 2011, 04:33 am Last Edit: Mar 03, 2011, 04:35 am by liudr Reason: 1
Can you put three resistors in series between 5V and GND like: 5V----1K--A0--sensor----1K----GND? The A0 is analog 0. This way you may get a better resolution, I guess. You can calculate the relative error:
dR/R=4/1024*Ralg^2/Rgeo^2, where Ralg is algebraic average between 1K and 1K+sensor, Rgeo is geometric average between 1K and 1K+sensor, you can use 1K+sensor for R.

With 250Ohm , the error is 250*4/1024*(2250/2)^2/(1000^2+1250^2)=0.5Ohm.
With 50Ohm, the error is 50*4/1024*(2050/2)^2/(1000^2+1050^2)=0.1Ohm.

This looks good to me. 8)

Also looking at the original circuit will help.
Serial LCD keypad panel,phi_prompt user interface library,SDI-12 USB Adapter

WillR

liudr...

If you do that you get a swing between .23 Volts and...   .833 volts... I don't think that is what he wants...

RobDrizzle

#4
Mar 03, 2011, 04:45 am Last Edit: Mar 03, 2011, 04:47 am by RobDrizzle Reason: 1
Thanks for the replys gents,

WillR,
      I'm getting 1.5v for the 50/300 * 9v.

liudr,
      Maybe I'm not following you, but when I run your number though Vout=R2/(R2+R1)*Vin, I only get a difference of .8volt.

Is there a way to cut my losses and limit the sampling range to more convenient voltages? Like 2.8v and .75v? lol...

RobDrizzle

Or even... does someone know a better sensor or way to get water pressure? I'm trying to keep this under $100 and I know that some pressure transducers can work but they are typically more than $100 themselves.

WillR

Right... too tired..  :P

Considering the water pressure is likely to be about 50 psi... what i suggested would give a swing from  4.5 to 1.5V or three volts... But our water pressure varies typically from 35-55 psi (well system)...

But even from 0-50psi that is a 1.5 v swing... which is OK... 1.5/5 *1024  or about 307 bits on the 10 bit ADC UNO converter...

1.5/4.5 * 1024 = 341 bits if you use the analog reference.

What is the intended purpose? Is that enough range?

Alternatively do the obvious.... use two batteries -- put a -9v at the bottom of the sensor and choose the resistor hooked to the top to bias the sensor output to 0V when the sensor is at 50 ohms... using a resistor to the -9V battery might allow you to do this more easily... it's just Ohms law.... nothing more complicated....


Put the sensor on your desk... put a battery and a resistor on either side and loudly and firmly repeat ohms law... that should smack it into line...  :smiley-mr-green:



RobDrizzle

hmmm...

Maybe I'm seeing this wrong then. I thought with a analog input, I would need to match the 0-1.1v/3.3v/5v range.

Are you saying that I don't have to have one side of the range down to 0v?

Then how would I ensure that when there is 2.6-4.5v (for example), the Uno is reading 0-100 PSI?

Having the resolution to the .3 would be fine... very fine.

Yes the average pressure will be around 50PSI but can be as high as 75 or as low as 8.

Thanks again for the help

liuzengqiang


liudr...

If you do that you get a swing between .23 Volts and...   .833 volts... I don't think that is what he wants...



Really? I admit I made a mistake with using 1K and not including it in my calculation but my voltage is around 2.5, where best resolution is. Did you see I have two 1K resistor and one on each side? :smiley-eek:

Plus your math needs a shift of the decimal point  ]:D

This is an interesting math problem. Will the sensor take what max current? My rechargeable 9V battery has less than 200mAh so with 250 Ohm serial resistor, the battery lasts around only 8 hours. Maybe you should use 1.5 battery with a typical 2000mAh rating and use internal reference of 1.024V?
Serial LCD keypad panel,phi_prompt user interface library,SDI-12 USB Adapter

WillR


hmmm...

Maybe I'm seeing this wrong then. I thought with a analog input, I would need to match the 0-1.1v/3.3v/5v range.

Are you saying that I don't have to have one side of the range down to 0v?  


Whatever for? As long as the range is sufficient for purposes desired -- who cares????
If you are really fussy you can do this...
http://arduino.cc/en/Reference/Map


Quote
Then how would I ensure that when there is 2.6-4.5v (for example), the Uno is reading 0-100 PSI?


Arithmetic? See above -- map command to make life easy... you can even have it do the inversion... (Math is a little more complicated --- arithmetic will do...  :)   --- )

Quote
Having the resolution to the .3 would be fine... very fine.

Yes the average pressure will be around 50PSI but can be as high as 75 or as low as 8.

Thanks again for the help


Before I did much I ran every example I could. Modified it tested it etc. Too many people skip this step of the learning process. There is an ADC/MAP example -- check it out...

I have been at this over 40 years and I am not too proud to run examples created by teenagers... I do not have time or inclination to be brilliant -- I would rather copy smarter peoples work... My brain hurts when I think. Anyway, I recommend the approach.  :smiley-mr-green:

QUIT THINKING! Copy... what do you think they teach in university... rotflmao!

WillR

#10
Mar 03, 2011, 06:30 am Last Edit: Mar 03, 2011, 06:33 am by WillR Reason: 1


liudr...

If you do that you get a swing between .23 Volts and...   .833 volts... I don't think that is what he wants...



Really? I admit I made a mistake with using 1K and not including it in my calculation but my voltage is around 2.5, where best resolution is. Did you see I have two 1K resistor and one on each side? :smiley-eek:

Plus your math needs a shift of the decimal point  ]:D

This is an interesting math problem. Will the sensor take what max current? My rechargeable 9V battery has less than 200mAh so with 250 Ohm serial resistor, the battery lasts around only 8 hours. Maybe you should use 1.5 battery with a typical 2000mAh rating and use internal reference of 1.024V?



Sigh! I know. Arithmetic is not my forte... Thanks.

Put a differential sign in front of it and it may slowly leak into my brain.... but maybe not... :smiley-roll-blue:


And yes we Agree -- you can use the external analog reference to set the top of the range, and use the map command to spread out the readings... The map command just makes the code a little easier to write -- it does not improve accuracy and/or precision... it just puts a pearl necklace on a pig if you get my drift...  :D



MarkT

Another approach is to use a constant current source to feed through the sensor, then measure the voltage.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

RobDrizzle

The map command is the KEY!!!! lol... I'm going to dig into this during lunch but now that I see I don't have to have a perfect 0v - AREF voltage, I see where you guys where coming from!

Please excuse my dumbness when it comes to this stuff... I'm an ME and would rather machine parts all day than work with electronics, not to mention micro processors. I really find this interesting and will continue to learn, but man is it slow going!!!

Thanks guys!

robtillaart


Spent one evening at the reference and tutorial section of www.arduino.cc Just reading to learn what is possible and it will go much faster ..
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

bld

I got a bit about that on my blog too...


http://captain-slow.dk/2010/10/18/voltage-dividers-and-arduino/
captain-slow.dk | non contagious!

Go Up