REV Pressure Sensor - enableCompressorAnalog not reaching configured pressure

Running into an issue where the pressure read by the REV Pressure is off by approximately -3% which is double the stated tolerance (1.5%) in the datasheet. Trying to set the high pressure side of the system (tied in before the regulator) to 120 psi, but the sensor is reading a max of 115-116 psi (code snips below):

//enable compressor
armPH.enableCompressorAnalog(110, 120);

(in “public void periodic” in the subsystem):
SmartDashboard.putnumber(“Compressor Value:”, armPH.getPressure(0));

The other interesting note is trying to set the maxPressure in enableCompressorAnalog > 120 causes the code to crash. I can’t find anything documented on this and while it makes sense due to the rules, crashing the code seems an odd way to handle it.

Any thoughts on why my pressure is off by more than the stated 1.5% accuracy? I am thinking possibly that there is something causing my input voltage to be lower than expected (resistance?), but would appreciate any thoughts.

Do you get a stacktrace when the code crashes? I’d definitely be interested in knowing where exactly that is happening (as I’m sure the WPILib and REV folks would be as well).

As for your issue, I presume you’re confirming this by running the compressor and seeing what the pressure is after it shuts off? What’s the layout of your pneumatics system?

If your sensor is too close to the compressor (or otherwise not “buffered” by storage tanks), it may see pressure spikes in tune with the compressor cycle that could push it to read >120 and turn off the compressor. Once that settles back down, the pressure will be lower, though not necessarily low enough to turn it back on.

If this proves to be the case, I would say this is expected behavior. Your solution would be to add a few storage tanks (likely in series, but not certain that actually matters) between the compressor and sensor.

What does get5VRegulatedVoltage() return?

I will modify the code and check, but done for today. Thanks!

The code says:

    if (maxPressure < 0 || maxPressure > 120) {
      throw new IllegalArgumentException(
          "maxPressure must be between 0 and 120 PSI, got " + maxPressure);
    }

What are you using to compare the sensor’s output? How accurate is that?

2 Likes

Both the high pressure gauge and the gauge on the regulator which show the same pressure reading (less than the setting specified in the code). The likelihood that both gauges are miscalibrated is somewhat low, I think. And the value read by the sensor (via the getPressure read) is consistently 4-5 psi lower than the setting.

1 Like

The gauge on the regulator should show the low (regulated) pressure, so <= 60 psi.

1 Like

Correct, but we turned it up to see where the error was occurring. At full (unrestricted) pressure, the regulator guage agreed with the high pressure guage. Of course to align with the rules that would be set appropriately.

The compressor voltage is measuring (on SmartDashbaord) at ~2.7v from this command:

SmartDashboard.putNumber(“Compressor Voltage”, armPH.getAnalogVoltage(0));

I asked about get5VRegulatedVoltage()

Apologies. 4.92v

See Use PH voltage to calc analog pressure switch threshold by sciencewhiz · Pull Request #5115 · wpilibsuite/allwpilib · GitHub

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.