0.5-4.5 V 0-1.2 MPa (174PSI) read

I feel like this belongs in the general category, but I couldn’t post to it.

I found a number of posts that I feel got me very close but I’m missing something key and I’m not sure what.

For simplicity, lets say this sensor is awesome and does what it’s touted to do (yeah right, but lets start there).
Sensor is a “5 V” 0.5v to 4.5v pressure transducer capable of measuring 0-174 PSI.

I’ve got a voltage divider to get me into the 3.3v readable range.

Worth noting that last I checked, the atmospheric pressure should be ~14.78 PSI.

Here’s what I’ve worked out so far:
Its currently reading ~1955 on my analog input. This seems a little high, but I could be wrong.
Some of this is just notes that I’ve translated from other posts that were similar:

Max Pressure = 174 psi
0.5-4.5v = 4v range @ 5v
43.5 psi per volt

0.33-2.97 V = 2.64 V range @ 3.3 V (66% of 4v range)
0.33 V = 0 PSI
2.97 V = 174 PSI
(2.64-0.33=2.31)

0.013276 volts per PSI
16.4783 steps per PSI

3.3 V/4096 = 1241 steps per volt ~ 1.241 steps per mV (1241/1000)
3.3/1241=0.002659 volts per step
1241*0.33 V= 409.53 = ~409-410 @ 0 PSI
1241*2.97 V= 3685.77 = ~3685-3686 @ 174 PSI

range from 0-174 PSI ~3277 (starting at 409, maxing at 3686)

Assuming my “0 PSI” is at 0.5 v (for 5v) then that should mean ~0.33v maxing out at 2.97v
I tried using some mapping functions to help me out but the results either didn’t make sense or something is not physically working. By my calculations (that are a mess), I end up somewhere between 80psi and 100psi (quite the headache I would imagine…) I’ve tried 2 of these sensor with the same rating, and one at rest gives me 1868 ish and the other 1955 ish.

I’m certain I’m missing something obvious and its driving me nuts - this is a hard topic to search for too, so if the exact answer is already posted somewhere, pleeease send me there :stuck_out_tongue:

Semi-mostly-unrelated, I don’t think the DS18B20 likes being used next to the alternator on my jeep… but thats another topic…

Have you measured the voltage given by the sensor?
What resistors have you used and how have you wired them to the sensing pin?

Also, do you have the datasheet for the sensor? Does it have a linear output from 0.5 to 4.5V? Any halfway decently documented sensor should have graphs detailing the response and accuracy.

@ScruffR - I measured the output at a little over 1.5v.
On this sensor, I don’t have any resistors on it - I actually spent a little time trying to figure out what, if any, I should us for this - I’m used to having to use something to help debounce or pull up/down a line etc., but either it was late an my brain was shut off or I just couldn’t find anything.

The sensor is one of those cheapish pressure transducers on amazon that have mixed reviews, I’ll have to dig around to find an actual data sheet, but here’s the basics:
Working Voltage: 5VDC
Output Voltage: 0.5-4.5 VDC
Working Current: <=10 mA
Working Pressure Range: 0-1.2 MPa
The Biggest Pressure: 2.4 MPa
Destroy Pressure: 3.0 MPa
Working TEMP. Range: 0-85 Celsius Degree
Storage Temperature Range: 0-100 Celsius Degree
Measuring Error: +_ 1.5 %FSO
Temperature Range Error: +_3.5 %FSO
Response Time: <=2.0 ms
Cycle Life: 500,000 pcs

Digiten 5V 0-1.2MPa

I have to run to a… zoom… but I’ll try to grab more info when I can.

There’s actually a lot of these guys out there of varying specs. (its supposed to be linear btw). It’d be nice to have a nice formula or library to just drop in values - min pressure, max pressure, sensor voltage (5v), system voltage (3.3v - if different), sensor voltage range at sensor voltage (0.5-4.5) etc. I spent several hours trying to figure out some reasonable maths that didn’t involve me grabbing an air compressor and just making measurements as I went… though I was tempted… (still looking for the data sheet)

This is what I use for those sensors:

  sensorValue = analogRead(A4) ;
  // Convert the analog reading (which goes from 0 - 4095) to a voltage (0 - 3.3V) 
  voltage = (sensorValue) * ((3.3 / 4095.0));
  pressure = ((voltage-0.470) * (MaxSensorPressure/4) ) ; 
// Note: 0.470 was the actual Output at Zero Pressure for this particular sensor at it's Supply Voltage...verses 0.5V Spec'd Bias

These sensors are linear and will operate at 3.3V Supply.

As @ScruffR hinted to, you will need to calibrate with the measured voltage at Zero Pressure (0.470V in the code above). The MaxSensorPressure is the “Rated” Pressure.

For the 174 Psi Sensor, you can operate in a system up to 122 Psi without exceeding the 3.3V limit on input pin… assuming you Don’t use a Voltage Divider.

These cheap sensors exhibit a “Bathtub” Failure Rate Curve. If one lives for the first week, its generally good for a long time.

1 Like

vs.

How do you build your voltage divider without resistors?

Oh! Sorry, I thought you meant for debouncing etc. I actually said that because I was drawing a ‘brain not working’ blank - its actually a bidirectional logic level converter LLC

That should work for this… right?

Really… that would have saved me some time lol - though I’m curious what happens past 122 psi? if I’m only supplying 3.3v. I realized after writing all this that the actual sensor I’m using - which is already hooked up to a ruggeduino at 5v is only 80 psi which is about 20 psi over the actual range I need - I made some impulse buys when I was first toying with this a few years ago and kept them around for testing (such as this). I’m looking to swap out the ruggeduino (which is a great device, but doesn’t quite do all I need at the moment)… I digress :stuck_out_tongue:

How do you suggest I get to zero pressure…? I have a vacuum pump that I’ve used for working on the AC in my jeep (which I can’t stand working on), but its designed to actually make a vacuum, not get to zero, so I’m not quite sure how to go about that - may have to google around if thats starting to get a bit out of scope.

Logic Level converters can only convert logic levels (true/false, 1, 0) not analog signals tho’

I… um… bloody hell… I was using it for my serial device… and must have just thought, ah, I’ve got more room…

I’m nut sure what the heck I was thinking… Don’t drink and solder! (sigh)

I’ll get back to you…

For the best accuracy, you would need to fine-tune the linear equation. For this, a Top-End measurement should be made, in addition to the Bottom End. If you stick with a 5V supply, the output would be greater than 3.3V which is the limit on your sensing pin.

I guess I should have said Zero Gauge Pressure. IE: open to the Air, or at Atmospheric Pressure.

The same applies to the 3.3V assumption in the ADC calculation. You can measure the Vref instead of using 3.3V.

If 60 psi (gauge) is the max expected operating pressure, then divide by 0.7 to get the minimum rated sensor that you need (these specific sensors) to not involve a voltage divider.
Example: 60 / 0.7 = 85 psi Rated Sensor @ 4.5V Output.
So one of these sensors rated Over 85 psi won’t produce a Voltage Output over 3.3V at the 60 psi operating condition.

The review of this product on amazon is bad and someone claim it’s a millivolt reading, so maybe you don’t have the sensor you are supposed (range and output). Il personnally bought one from ebay and it was useless as its output was changing by temperature (hand heated sensor vs ambiant temperature).

I need to re-wire some things, but the one I’ve currently got installed with my arduino seems to be working ok - at the time I think I wasn’t really needing it to be super accurate, just mostly accurate. That said, the first couple I bought, I didn’t realize were “British Standard Parallel Pipe” thread (BSPP)… Not to get totally derailed here, but for the love of god, can the world please standardize something??

They’re cheap enough (for the most part) that like @Rftop said, if it lives a week, you’ve probably got a winner - ish. I noticed on the one that I have installed (the 80psi one) the page shows the actual chip used (I love how they have all these different brands - like they’re fooling anyone): 80 PSI transducer - the chip would appear to have I2C on it… though I swear theres a flux capacitor in there too…

So… ready for some more fun? On top of using a logic level converter instead of a voltage divider… I apparently also forgot to wire up the positive lead to the sensor inside the box (which has a clear top I might add)… this is particularly interesting because that means that when I measured the voltage between the leads (outside of the project box), somehow I was getting voltage from ground to the sensor wire and the positive lead. My loving parents refuse to accept that I’m getting old… I on the other hand, know better… :man_facepalming: :man_shrugging:

Huzzah! Had to make some assumptions, but I think I have something usable (of course, I’ll have to re-do some of this when I switch sensors, but I know how to get there now (mostly)).

The company I work at has these crazy huge plungers - as in they look like you’re about to shoot up a gorilla sized (I’m sure they come in larger sizes). I have another that has a “needle” that I use to put lithium grease in awkward or small places. Anyway, the tip of it without a needle fits almost perfectly into the end of the sensor without going in too far. With it spitting out raw values, I pulled on the plunger - which could have damaged the sensor, but there’s odds it’d have gotten scrapped anyway. I got it to go as low as I could and decided to call that zero PSI (~155 analog read) which is roughly 0.1239 V. Shifting the expected range (@3.3v) to a max of 2.7649 V which should read at ~3431 (using the other post that has now disappeared from my tabs - there’s 1241 ‘steps’ per volt). Some mapping and rounding and viola, 14 PSI sitting in the open.

I suspect this is a little low as my (admittedly hacked together) weather station says its ~1016.1 hPA which is about 14.7 PSI. Good enough for now and I’m hungry :grinning:

1 Like