Go Down

Topic: Transducer mapping (Read 491 times) previous topic - next topic

White_Lady

Hi, I have a problem reading sensor Value display on serial monitor. I used a 3 wire pressure transducer 0-200 psi 0.5-4.5v. My project is a compressor charges the tank then to electronic valve as gate to the pneumatic cylinder. Pressure sensor is attach between valve and cylinder.

My problem is its not reading straight linear and start reading at cylinder psi. It jumps and starts to read at higher psi (spike) when valve opens and when valve close it goes back down to correct reading. I need reading that starts with cylinder psi straight up linear reading when valve is open.

I test it on potentiometer and it works ok. It gives straight linear reading.

Im a newbie on arduino

Any help will do. thank you very much.

Code: [Select]

const int Cyl = A0;  //Tank Sensor


void setup() {
  Serial.begin(230400);

  pinMode(Cyl, INPUT);

}

void loop() {

  int Cyl = map(analogRead(Cyl), 102 , 1024, 0, 200);
  Cyl = (Cyl);

  Serial.println(" ");
  Serial.print(Cyl);

  delay(50);

}

Paul_KD7HB

That is EXACTLY what I would expect to see. The pressure before the piston begins to move is exactly the pressure from the tank. The solenoid valve limits the air flow, so as the piston begins to move, the pressure drops.  Get a solenoid valve large enough to not restrict the air flow and you will get your steady reading.

Paul

JCA34F

If 4.5V = 200 PSI then this:
Code: [Select]
int Cyl = map(analogRead(Cyl), 102 , 1024, 0, 200);
Should be:
Code: [Select]
int Cyl = map(analogRead(Cyl), 102 , 921, 0, 200);
But you gave your PSI variable (Cyl) the same name as your input pin.

White_Lady

Thanks for the reply. yes i think its the high pressure of the tank then when the valve opens and high tank pressure joins the low pressure of the cylinder, it hammers the transducer and returns correct reading when valve closed. Are there any solution like algorithm to cure the spike? What about capacitor on analog pin to absorb spike voltage from transducer? I need a constant linear reading from cylinder pressure.

White_Lady

Even on pressure release of valve, reading will go below the cylinder reading and stops high  correct reading when valve close. It fluctuates

Wawa

Should be:
Code: [Select]
int Cyl = map(analogRead(Cyl), 102 , 921, 0, 200);
But you gave your PSI variable (Cyl) the same name as your input pin.
Could be:
Code: [Select]
float pressure = (analogRead(A0) - 102) * 0.244;
//
Serial.print(pressure, 1); // one decimal place

For five times the resolution.
map only works with integers.

Oversampling could take that (almost) to a real decimal place.
Leo..

White_Lady

Could be:
Code: [Select]
float pressure = (analogRead(A0) - 102) * 0.244;
//
Serial.print(pressure, 1); // one decimal place

For five times the resolution.
map only works with integers.

Oversampling could take that (almost) to a real decimal place.
Leo..
thanks for the help Leo. I cant make it work. it read wrong using potmeter for test. It gives wrong value not 0 to 200 psi.


White_Lady

Code: [Select]

const int Cyl = A0;  //Tank Sensor


void setup() {
  Serial.begin(230400);

  pinMode(Cyl, INPUT);

}

void loop() {

  float pressure = (analogRead(A0) - 102) * 0.244;
//
Serial.print(pressure,1); // one decimal place

  delay(50);

}

Paul_KD7HB

Redesign your system to include an appropriate sized accumulator to absorb the pressure wave.

Paul

Wawa

Working code (tested with pot).
Leo..
Code: [Select]
const byte sensorPin = A0; //Tank Sensor
float pressure;

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

void loop() {
  pressure = (analogRead(sensorPin) - 102) * 0.244;
  Serial.print("Pressure: ");
  Serial.print(pressure, 1);
  Serial.println(" psi");

  delay(250);
}

White_Lady

yes Leo it works with println using potmeter.. I will test it later in sensors.

Im totally blank as of now. I tried pressure snubber and micron filter to control pressure hammering of sensor but still the same. voltage spike from sensor i think is the problem.
I just need a linear reading from cylinder close and open valve because Im building a trigger on and off in pressure reading.

Wawa

A hardware solution seems to be needed, but you could try averaging multiple readings (smoothing code).
Leo..
Code: [Select]
const byte sensorPin = A0; // tank sensor
unsigned int sensorValue; // can hold up to 64 A/D values
float pressure;

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

void loop() {
  sensorValue = 0; // reset
  for (int i = 0; i < 64; i++) { // 64 readings
    sensorValue += analogRead(sensorPin); // add readings
    delay(1); // time between readings
  }
  pressure = (sensorValue - 6528.0) * 0.0038125;
  Serial.print("Pressure: ");
  Serial.print(pressure, 1);
  Serial.println(" psi");
  delay(200);
}

Paul_KD7HB

yes Leo it works with println using potmeter.. I will test it later in sensors.

Im totally blank as of now. I tried pressure snubber and micron filter to control pressure hammering of sensor but still the same. voltage spike from sensor i think is the problem.
I just need a linear reading from cylinder close and open valve because Im building a trigger on and off in pressure reading.
Where did you place the pressure sensor when you did this? All snubbers, accumulators, etc, must be BEFORE you pressure sensor.

Paul

White_Lady

Where did you place the pressure sensor when you did this? All snubbers, accumulators, etc, must be BEFORE you pressure sensor.

Paul
Hi Paul. yes its before pressure sensor. I tried snubbers only with different porous and adjustable. still the same. I would like to ask if putting a capacitor to absorb the voltage spike from sensor to analog in will do? Kinda voltage buffer to slowly introduce spike voltage to analog input. Or any Ideas how to solve? I will give it a try. Thanks

JCA34F

How about a diagram showing where the sensor is located in relation to  compressor, tank, valves and air bags / cylinders.

Go Up