4

I'm an automotive enthusiast and I want to build some gauges by myself using Arduino.

I was taking a look at this pressure transducer or sender, 100 psi, stainless steel, for oil, fuel, air, water and I was thinking if I can use this sensor to do all of the these tasks: Water, Boost and Oil Pressure.

Look at the Signal output vs read PSI chart of the sensor

 Signal output vs read PSI chart of the sensor

I came out with this equation for the PSI calculation:

Since it is a Y = bx + a, where:

a = 0.5 
b = y2 - y1 / x2 - x1 = (4.5 - 0.5 ) / (100 - 0) = 4/100 = 0.04
x = PSI
y = Signal's Voltage

This means that

Voltage Reading = 0.04PSI + 0.5

So we have :

PSI = (Voltage Reading - 0.5 ) / 0.04

Am I correct? Can I use this sensor?

3

You math checks you to me.

When you code it, You will probably read a voltage using an analog pin (or external ADC) that will return an integer between 0 being 0 volts, and 1024 = vin volts. vin will be 5 if you don't wire up the vin pin, and 1024 could be different if you use an external ADC.

Anyway you should be aware that the raw readings will probably not be 0-5, and they dont have decimal points. You will need to first convert the reading into the voltage with something like this:

float voltage = ((float)reading)/1024.f;

notice that the datatype float is used (enables decimal points) and that the constant being divided by is also a float so that the calculations will definitly happen between floating point numbers.

  • float calculation is slow on an arduino. You could just use regular integers. byte psi = (analogRead(A1)-102)/8 would be a pretty good aproximation. Or if you need more precision; int psi = (analogRead(A1)-102)*100/819. – Gerben Dec 14 '14 at 14:47
  • 1
    integer arithmetic is more efficient but I doubt the time difference really matters. When I tested this there was no difference is running times between the two versions given the 4 microsecond resolution of micros(). – BrettAM Dec 14 '14 at 18:01
  • Careful... the formula for conversion is float voltage = ((float) rawADC + 0.5 ) / 1024.0 * Vref (from gammon.com.au/adc with explanation). In your case 8 bit integers (0-255) are fine, no need of additional precision. – FarO Feb 9 '17 at 14:18
0

I'd add code to test for voltage between 0.0 to less than or near 0.5 volts. Disconnected pressure transducer won't present 0.5v, 0 PSI transducer voltage; not output 0.5 v @0 PSI shows a lower voltage indicated a fault or open circuit in transducer wiring. My experiences, too many times other engineers "borrowed" hardware and I wound up troubleshooting a non-fault but theft ;} Only a few lines of code to ensure connections are correct. The floating point vs integer arithmetic compute time is outweighed by settling time of A/D converter and transducer. The auto part was my solution to show HOA board stats for my wildly varying water pressure at Condo Assn, very cost effective too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.