I am currently developing a program to capture the pressure decay using Arduino but I am having a problem on the captured data which have a quite wider difference.
The sensor that I am using is an SMC ZSE30 with 1 - 5v analog voltage output which the 0 kpa is 1v & 101kpa for 5v respectively.
I can't get my head around on the proper coding to get a more suitable results. Below is my created code and i need your expert advise on how to make it work properly.
// 1volt is an A/D value of ~205 with a 10-bit A/D and 5volt Aref
const int offset = 205; // calibrate zero pressure
float pressure;
void setup() {
Serial.begin(9600);
}
void loop() {
pressure = (analogRead(A0) - offset) * 101.0 / (1023 - offset);
Serial.println(pressure, 1); // one decimal place (= max resolution with a 10-bit A/D)
delay(500);
}
Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
I can't get my head around on the proper coding to get a more suitable results. Below is my created code and i need your expert advise on how to make it work properly.
What "suitable" results are you looking for.
How are you proving your results?
What is the application, what is the pressure you are trying to analyse?
The application is to measure the sealing leakage within 3 seconds in kPa. Using my code, the leakage result has a quite larger difference (deltaKpa) where the sensor's display almost no change at all.
I am asking your expert advise on how to make this work if my coding has an issue. Your help is highly appreciated.
I've had created or tried a similar code made by Wawa but the result is the same and still have a quite significant offset in first and second ready. Also able to use a potentiometer to replace the sensor and i got a zero deltaKpa.
I also attached the wiring diagram,sensor specs sheet, reading result of the sensor and potentiometer.
Have you got proof that the readings should be the same?
Have you a calibrated leak?
That is a container with a fixed leakage hole that is constant from test to test?
Do you have access to a storage oscilloscope so you can monitor the analog output of the sensor to help you correlate your results?
Can you use a cylinder that has a valve so you can cause a leak, and over say 30Seconds take one reading, then release some pressure, then measure again, knowing the pressure drop.
What I am getting at is you do two static readings.
Also ALL your pressure calcs should be floating, just declaring the answer floating will not give a proper floating answer, note all your results are 35.00, 33.00 they are ints in floating format.