Using old CTRE PCM in 2022

Our team is still using last years CTRE PCM and we are running into an issue where none of the code from last year is working anymore; as well as all the new code for the digital PCM’s don’t work. Does anybody have an idea of how to do this?

The API changed to require you to specify the type of pneumatic controller that is in use.

Our team uses C++ but the API is similar for Java - you’ll see the addition of the “PneumaticsModuleType moduleType”.

This wasn’t in the API last year because there was only a single PCM module but now there are two.

Our code does have this in it but it seems as though the new code to enable the ClosedLoopControl only works for digital input and ours is analog.

here is our code for it
private final Compressor comp = new Compressor(0, PneumaticsModuleType.CTREPCM);


the comp.enableAnalog(); only works for the new Rev Hub

The CTRE PCM hardware does not have an analog input. You have to use a digital pressure switch with the PCM.

Sorry, I probably use the wrong word.
Our set up runs the compressor through a relay and we have our pressure switch into the pressure switch input on the old style PCM. How would we go about using the new code for it?

1 Like

I don’t think that’s a legal configuration per R812.

If you’re using a separate relay (such as a Spike) to control the compressor instead of using the PCM, you will need to hook up the pressure switch to a RoboRio DIO, read the pressure switch state and control the relay yourself in the RoboRIO code (see R812).

The pressure switch is connected to the pressure switch input of the PCM. The Compressor out of the PCM is activating the relay that powers the compressor. We just have the relay there to reduce power draw through the PCM. So the PCM is still controlling the compressor on/off.

Turns out that our pressure switch was faulty. And I also moved the command to enableDigital into the robot file’s teleopInit; from a subsystem (we are using command based).

This is not a legal configuration for the compressor. It either must be hooked up to a Relay, and that relay must be directly controlled by a relay output on the roborio, or it must be hooked directly to the PCM with nothing in between.


I think you are misunderstanding. The pressure switch is directly connected to the PCM. So everything in R812 after the ‘or’ about connecting the pressure switch to the roborio is irrelevant. The PCM is turning on and off the compressor. The compressor out of the PCM is controlling power to the relay for compressor power. That’s just to take the power draw off the PCM. R812 doesn’t say that’s illegal.

I think he understood perfectly well. I think that’s a good Q&A question at best. Electrically speaking, would it work? Yeah probably. Is there a safety concern? None that I can think of. Is it legal per the rules? I’m not certain. As an inspector, I’d certainly call attention to it, as I’ve never seen it done that way before. It’d be an LRI decision for sure

1 Like

This seems to violate R712:

R712 *Control PWM controllers from the roboRIO. Every relay module (per R503-B), servo controller,
and PWM motor controller shall be connected to a corresponding port (relays to Relay ports,
servo controllers and PWM controllers to PWM ports) on the roboRIO (either directly or through a
WCP Spartan Sensor Board) or via a legal MXP connection (per R713). They shall not be
controlled by signals from any other source
, with the exception of the Nidec Dynamo motor
controller which must also be connected to the roboRIO Digital I/O.


Good call. I didn’t have the rules in front of me when making my previous comment. I read that the same way as you, R712 does appear to make this design illegal.

1 Like

What kind of compressor are you running that you are worried about exceeding the 20A limit of the PCM?


One of our mentors was concerned about the wire size fitting into the PCM.
Than you for finding that in the rule book. We are changing right now!

If you’re having trouble fitting the wires attached to the compressor into the PCM, you can make an extension between the PCM and compressor wires out of 18AWG wire.

This actually depends on if the switch input of the relay is rated for 12 volts. Since the Rio output is 5 volts, I expect that to be the input rating, and passing 12 volts could damage the relay and make it unsafe.

1 Like

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