Code for 30psi pressure sensor (x4) and real time data saving in pc.

Hi everyone :slight_smile:

Your help will be very much appreciated!

I am currently doing a project that involved taking pressure readings from four 30psi pressure transducers.
These pressures are to be read from 4 different sections of my circuit to measure fluid dynamics of the system.

Could you please help with the code.

I would also like the code to log the data into the computer from all four sensors simultanesouly.

Thank you very much

The details of my sensors are
Output: Linear voltage output 0.5V ~ 4.5V. Output 0 psi 0.5V, output 15psi 2.5V, output 30psi 4.5V.

What have you tried? What were the results?

We are happy to help you code, but we do not do it for you.

If you want someone to write the code for you, post in the [Gigs and Collaborations section](Jobs and Paid Consultancy - Arduino Forum). Expect to pay.

Hi I have tried this code

int rawValue; // A/D readings
int offset = 51; // ~0.5volt zero pressure adjust (~30-72)
int fullScale = 819; // ~4.5volt max pressure (span) adjust (~798-840)
float pressure; // final pressure in psi

void setup() {
Serial.begin(9600);
}

void loop() {
rawValue = analogRead(A0);
pressure = (rawValue - offset) * 30.0 / (fullScale - offset); // pressure conversion
Serial.print("The pressure is ");
Serial.print(pressure, 1); // one decimal place
Serial.println(" psi");
delay(2);

}

I have tried this code and though I get some readings, I doubt thier accuracy... i am not sure how to save the data as I log it

Which Arduino? For a UNO, 0.5 volts reads about 102 not 51 and full scale should be close to 920. Add a Serial.println(rawValue); after reading analog pin and increase that delay from 2 to 500 so you can see what raw value you get at zero pressure.
What are you logging to?

ezekieldinama:
int offset = 51; // ~0.5volt zero pressure adjust (~30-72)
int fullScale = 819; // ~4.5volt max pressure (span) adjust (~798-840)

How did you obtain these numbers?

though I get some readings, I doubt thier accuracy...[/quote]

Why?

[url=https://forum.arduino.cc/index.php?topic=628084.msg4252648#msg4252648]Also posted in G&C[/url].

JCA34F:
Which Arduino? For a UNO, 0.5 volts reads about 102 not 51 and full scale should be close to 920. Add a Serial.println(rawValue); after reading analog pin and increase that delay from 2 to 500 so you can see what raw value you get at zero pressure.
What are you logging to?

Thank you, it is Arduino UNO R3.
I'm logging into my computer

If zero pressure = 0.5 volts, then ADC value should be near (0.5 * 1023 / 5) = 102.
If full scale pressure = 4.5 V, (4.5 * 1023 / 5) = 920 and span (difference between full scale and zero) = 920 - 102 = 818, so: pressure = 30.0 * (rawValue - offset) / (fullScale - offset);
Never done much logging, so can't help there.