Rev Analog Pressure Sensor Reading

Is there a way to read the pressure from the Rev Pneumatics Hub? Can I get it directly through there, or do I need a separate sensor plugged into the analog rail on the Rio? It seems moderately wasteful to need 2 of them.

It seems like the PH knows the voltage on the analog sensor, is there a call to read that voltage, then do a little math to convert that voltage to pressure?

You can use the getPressure() method of the PneumaticHub class.

If your pressure sensor is plugged into channel 0:

PneumaticHub hub = new PneumaticHub();
double pressure = hub.getPressure(0);

Awesome, thanks. Where is the api for the rev hardware?

1 Like

For the PDH and PH, they’re part of WPILib. PneumaticHub (WPILib API 2022.1.1)


So we have followed the assembly guide. We have a compressor, REV PH, analog pressure sensor and code that runs a solenoid (and all the appropriate tubing/gauges/air tanks etc.) However the compressor is not automatically turning on. The analog sensor is plugged into the #0 port on the PH. We tested the system by using the standard digital pressure sensor and the compressor worked. We are able to get an accurate pressure reading from the analog sensor, so we know it is working. I’m not sure what else we are missing.

And you called enableCompressorAnalog?

1 Like

Nope, didn’t know that was a thing. I will have our software team try that out.

@Sky_Captain - the software team has tried this out. And it certainly helped. However it doesn’t seem to run the compressor up to a high enough pressure.
Based on the API:
enableCompressorAnalog​(double minPressure, double maxPressure)

We set the min to 100 and the max to 120 expecting the pressure to run up to 100 and then keep the pressure at that minimum i.e. turning on the pressure if it dropped below 100.

However it only pressurized to somewhere around 50-60 PSI and then turned off. If I activated the solenoid, causing the pressure to drop, the compressor would turn back on again but again stop at a substantially lower pressure than 100. The actual value it stopped at varied.

Are you measuring the pressure before or after the regulator?

1 Like

What does getPressure return? Compressor (WPILib API 2022.2.1)

getPressure was what I was reading (I put a widget on shuffleboard to see it). I also looked at the bot and at the time, both pressure gauges (before and after the regulator) were hovering around 60ish. The getPressure returned value seemed to work correctly. We did check several times to see if it matched what the gauge said.

We haven’t been able to recreate what you’re seeing, but we’re going to need some more information.

Please send an email so that we can start collecting more information, recreate what you’re seeing, and get you back up and running.

1 Like


Making sure you didn’t miss this, is your pressure sensor plumbed prior to the regulator? This would certainly cause this behavior.

It may be helpful to post a photo of your pneumatic system, specifically the area around the pressure switch and regulators.

1 Like

Yes the pressure sensor is plumbed prior to the regulator.

The compressor is turning off at a value somewhere between 45-60 PSI regardless of the min/max values we provide to enableCompressorAnalog. We tried min=115 and max=120 and it still shuts off early.

Our pneumatic hub is powered with 12 volts from position 22 on the rev PDH.
The picture of how to wire the hub in the REV documentation here:
shows the hub plugged into the switchable channel.

Is that necessary? There’s no reason to turn off the hub so there’s no reason to have it switchable.

by the way, we can run the compressor manually and fill the tank to 120 psi. The rev pressure sensor reads 120 when it’s done manually.

@dyanoshak thanks for responding. I’ll send an email.

This is a mistake in the diagram. We’re working on fixing it. Connect it to any of the other low-current channels.

We’ll look out for your email.

1 Like

Since Team Update 01, R503B.c says this is not legal. The switchable circuit many only be used for non-actuator CUSTOM CIRCUITS.

If I had a spare port 1-20, I’d do it with a 20 amp breaker.