Controlling Pneumatics Using Buttons on Your Controller

Controlling pneumatics with your V5 controller requires a customized project. This article will described how to create a VEXcode V5 project.


Configuring Your Project

Diagram illustrating V5 Pneumatics components and their connections, showcasing various parts used in VEX robotics systems for pneumatic functionality.

Select the Devices button to open the Devices window.

Diagram illustrating V5 Pneumatics components, including various parts and connections, used in robotics applications. The image provides a visual reference for understanding the layout and functionality of pneumatic systems in V5 robotics.

Select ‘Add a device.’

Diagram illustrating V5 Pneumatics components, showcasing various parts and their connections, relevant to the V5 Category Description.

To start your VEXcode V5 project to control your pneumatics you will need to configure two devices.

You will need to add the Controller device.

For more information on configuring a Controller device, see the Configuring the V5 Controller in VEXcode V5 article from the VEX Library.

Diagram illustrating V5 Pneumatics components, including various parts and their connections, used in robotics applications. Diagram illustrating V5 Pneumatics components and their functions, showcasing various parts and connections used in VEX robotics systems.

 

You will also need to add the 3-Wire device Digital out.

For more information on configuring a Digital out device, see the Configuring 3-Wire Digital In and Digital Out Devices in VEXcode V5 article from the VEX Library.


Control Your Pneumatic Cylinder With Two Controller Buttons

There are two commonly preferred methods drivers use to control pneumatics on their robot. 

One way is to use two different buttons on the controller: one button to extend in the pneumatic cylinder and one button to retract the pneumatic cylinder. The following can be added to your VEXcode V5 project to control your pneumatic cylinder using 2 buttons on the controller.

Diagram illustrating the V5 Pneumatics system components and their connections, highlighting the functionality and layout for educational purposes in robotics.

From the sensing toolbox add a set digital out block to the [when started] block.

The [set digital out] block should be set on ‘low’. This will ensure your pneumatic cylinder starts the project fully retracted.

Diagram illustrating V5 Pneumatics components and their connections, showcasing various parts and their functions in a robotics system, designed to enhance understanding of pneumatic systems in VEX robotics.

From the Events tool box add a [when Controller button pressed] block.

Select the controller button you prefer to use to extend the pneumatic cylinder.

Button L1 is used in this example.

Diagram illustrating V5 Pneumatics components and their arrangement, showcasing various parts and connections for effective robotic pneumatic systems.

Add a [set DigitalOut] block.

Select ‘high’ for the digital out setting.

This will cause the pneumatic cylinder to extend when button L1 on the controller is pressed.

Diagram illustrating the components and setup of V5 Pneumatics system, showcasing various elements such as valves, cylinders, and connections, relevant to the V5 Category Description.

From the Events tool box add another [when Controller button pressed] block.

Select the controller button you prefer to use to retract the pneumatic cylinder.

Button L2 is used in this example.

Diagram illustrating V5 Pneumatics components and their connections, showcasing various parts and their arrangement within the V5 robotics system.

Add a [set DigitalOut] block.

Leave it as ‘low’ for the digital out setting.

This will cause the pneumatic cylinder to retract when button L2 on the controller is pressed.

Save the project, download it to the V5 Robot Brain, and run the project to test your control of the pneumatic cylinder using your controller.

For more information on saving, downloading, and running VEXcode V5 projects, please see the Open and Save Blocks Projects section of the VEX Library.


Control Your Pneumatic Cylinder with a Single Controller Button

Another preferred method drivers use to control pneumatics on their robot is to use a single button: the button extends the pneumatic cylinder when pressed and then retracts the pneumatic cylinder when pressed again. The following can be added to your VEXcode V5 project to control your pneumatic cylinder using a single button on the controller.

Diagram illustrating the V5 Pneumatics system components and their connections, highlighting the functionality and layout for educational purposes in robotics.

From the sensing toolbox add a set digital out block to the [when started] block.

The [set digital out] block should be set on ‘low’. This will ensure your pneumatic cylinder starts the project fully retracted.

Diagram illustrating VEX V5 Pneumatics components and their connections, showcasing various parts and their arrangement for educational purposes in robotics.

From the Variables toolbox select Make a Boolean.

For this example we are going to call the Boolean: digitaloutON.

Diagram illustrating V5 Pneumatics components, showcasing various parts and their connections for educational purposes in robotics.

Add a [set digitaloutON] block.

Leave the Boolean set to <true>.

Diagram illustrating V5 Pneumatics components and their connections, showcasing various parts and their functions in a robotics system, designed to enhance understanding of pneumatic systems in VEX robotics.

From the Events toolbox add a {when Controller button pressed} block.

Select the controller button you prefer to use to extend the pneumatic cylinder.

Button L1 is used in this example.

Diagram illustrating V5 Pneumatics components and their functions, including cylinders, valves, and air supply systems, showcasing the setup and connections for effective pneumatic operations in robotics.

From the Control toolbox add an [if then else] block

Diagram illustrating V5 Pneumatics components, showcasing various parts and their connections, relevant to the V5 Category Description in robotics.

Add a <digitaloutON> Boolean to the if.

Diagram illustrating the components and functionalities of V5 Pneumatics system, showcasing various parts and their connections, relevant to V5 Category Description.

Add a [set DigitalOut] block to the ‘then’ portion of the C block.

Change the [set DigitalOut] block to ‘high’.

Diagram illustrating V5 Pneumatics components and their connections, showcasing various parts and their functions in the V5 robotics system.

Add a [set DigitalOut] block to the ‘else’ portion of the C block.

Leave the [set DigitalOut] block as ‘low’.

Diagram illustrating V5 Pneumatics components and their connections, showcasing various elements such as cylinders, valves, and tubing, relevant to the V5 robotics system.

Add a [set digitaloutON] block.

Change the Boolean to <false>.

This will change the Boolean so the next time the L1 button is pressed the condition will go to the ‘else’ of the control C block.

Diagram illustrating VEX V5 Pneumatics components and their connections, showcasing the layout and functionality within the V5 system.

Add another [set digitaloutON] block.

Leave the Boolean as <true>.

This will change the Boolean so the next time the L1 button is pressed the condition will go to the ‘then’ of the control C block.

Diagram illustrating VEX V5 Pneumatics components, including cylinders, valves, and air tanks, used in robotics applications for controlling movement and force.

From the Control toolbox add a [wait] block to both sections of the [if then else] C block.

Change the value to (0.1) seconds in each [wait] block.

This will allow a brief period of time for the condition to detect the button being pressed.

The button will extend the pneumatic cylinder when pressed and then retract the pneumatic cylinder when pressed again.

Save the project, download it to the V5 Robot Brain, and run the project to test your control of the pneumatic cylinder using your controller.

For more information on saving, downloading, and running VEXcode V5 projects, please see the Open and Save Blocks Projects section of the VEX Library.

Diagram illustrating VEX V5 Pneumatics system components, including cylinders, valves, and air tanks, showcasing their arrangement and connections for educational purposes.

The blocks to control your pneumatic cylinders will need to be recreated in an example project for the Competition Template before your robot will be ready to use in a competition utilizing a field control system.

For more on the competition template, see the Using the Blocks Competition Template in VEXcode V5 article in the VEX Library.

These projects can be used to control both the Single acting and the Double acting pneumatic cylinders. If two pneumatic cylinders are attached to a Solenoid valve using a “T” fitting, both cylinders will be controlled by the same set of blocks.

Note: The 3-Wire port on the V5 Robot Brain will revert back to a Digital in port when the project is stopped. This may, if there is enough residual air pressure, cause the pneumatic cylinder to extend. To avoid this, release the air pressure by either switching the Finger Valve to the off position or depressing the core of the Schrader Tire Valve before stopping the project.

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: