Skip to content

Pneumatics

In the field of FRC robotics, pneumatic systems provide a wide range of opportunities for robot functions, including (but not limited to) actuating cylinders, changing robot mechanisms, and gear shifting. The backbone of a robot's pneumatic system is the Pneumatic Control Module (PCM) and the solenoids. This lesson will provide an overview of the PCM and solenoids, including how they work, how to wire them, and how to program them using WPILib.

Pneumatic Control Module (PCM)

The PCM is an FRC-specific electronic component that controls the operation of the pneumatic system. It has a series of ports for connecting and controlling solenoids, and it also monitors the system's pressure switch to regulate compressor operations.

The PCM communicates with the RoboRIO over the CAN bus, allowing it to be addressed and controlled from software. Through the PCM, the RoboRIO can enable and disable the compressor, read the current pressure switch state, and control individual solenoids.

Solenoids

Solenoids are the actuators that convert electrical signals from the PCM into mechanical action. In the context of FRC, solenoids usually control the flow of air to pneumatic cylinders, thereby controlling the movement of those cylinders.

There are two types of solenoids in FRC: single and double solenoids. A single solenoid has one output, and will send the cylinder out when activated, and let the cylinder retract when deactivated. A double solenoid, on the other hand, has two outputs: activating one sends the cylinder out, and activating the other retracts the cylinder.

Wiring

To wire a PCM, connect the power input to a dedicated WAGO connector on the Power Distribution Panel (PDP), and connect the CAN bus terminals to the rest of the robot's CAN bus.

Solenoids are connected to the ports on the PCM. Single solenoids use one port, while double solenoids use two adjacent ports.

Programming

In your robot code, you'll need to create an object for each solenoid you want to control, and use the methods provided by WPILib to control the state of the solenoids.

For example, to control a single solenoid on port 0:

import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.TimedRobot;

public class Robot extends TimedRobot {
    // Initialize a solenoid on port 0
    Solenoid solenoid = new Solenoid(0);

    @Override
    public void teleopPeriodic() {
        // Set the solenoid to true to activate it
        solenoid.set(true);
    }
}

And to control a double solenoid on ports 0 and 1:

import edu.wpi.first.wpilibj.DoubleSolenoid;
import edu.wpi.first.wpilibj.TimedRobot;

public class Robot extends TimedRobot {
    // Initialize a double solenoid on ports 0 and 1
    DoubleSolenoid doubleSolenoid = new DoubleSolenoid(0, 1);

    @Override
    public void teleopPeriodic() {
        // Set the double solenoid to forward to extend the cylinder
        doubleSolenoid.set(DoubleSolenoid.Value.kForward);
    }
}

Tasks

  1. Use the provided examples and the WPILib documentation to implement code for a solenoid. Experiment with controlling the solenoid in different ways, such as having it activate when a button is pressed.

  2. Create a system that uses multiple solenoids. For example, you might use one to extend and retract an arm, and another to open and close a claw at the end of the arm.

  3. Continue exploring the WPILib documentation to learn about other aspects of the PCM, like controlling the compressor and reading the pressure switch.

Additional Resources

WPILib Solenoids