Pneumatics HELP

So I know some basic labview like programming a motor, drivetrains, and some sensors. This year my team is using Pneumatics. I have literally no clue how to program that. One of my teachers told me that we are limited to 120psi in the compressor but how are you suppose to limit it. We also want it that when the cRio detects that the pressure is decreasing that it starts the compressor again and stops at 120psi. I have looked at the examples provided by NI but don’t quite understand them. Can someone please upload an example on how to set up Pneumatics and control the PSI in the Compressor and also please define some of these “Pneumatics” terms such as double solenoids, spikes and etc not exactly sure what they are or the role they play. Thxs :slight_smile:

Let’s cover the mechanical and electrical first. The pneumatic system has a high pressure side and a low pressure side. The high pressure side tops out at 120psi. It connects to the low pressure side through a regulator, which limits the pressure on the low side to 60psi.

The high pressure side is limited to 120psi by two things. First is a mechanical pressure relief that will start dumping air at around 125 psi. Second is a pressure switch. This is a normally closed switch that opens when the pressure reaches 120 psi. This switch is what lets your software know when you need to run the compressor more to get back up to 120 psi. It needs to be connected to the signal and ground pins of a digital input on your sidecar.

Programming is pretty easier. The relevant VIs are in WPI Robotics Library->Actuators->Compressor.

In your Begin.vi, you want to “Open” a compressor reference, then connect the created reference to the Start VI. Then the program will automatically monitor the pressure switch, and turn the compressor off and on with the Spike relay. Make sure you Do a Refnum Set to save the reference for later use.

In your Periodic Tasks VI, you need to drop the “WPI CompressorControlLoop” VI and pass it the save reference.

In your Finish VI, you need to get the compressor reference, pass it to a Stop VI, and then pass it to a Close VI. And then you’re done.

Thxs, now I understand better, but how about the double solenoids and a pressure switch(Do I have to program that?, If so how). My team wants it that when you press one button the piston goes forward and when you press it again it comes back down.Also, When i went to the actuators on Labview I saw their is a “Relay” what exactly is this. I also saw an example from team 358 and I’m quite confused. So my team is connecting the Double Solenoids straight to the Digital Sidecar since we don’t have the correct Crio Solenoid Bumper. So I would program it like the “Solenoid connected to Spike/Relay” example correct? One more thing since the example is only using One Solenoid do I have to copy that same code and change some of the constants since were using two solenoids? I’m sorry I’m asking so much questions. Thxs for the help :slight_smile:

Pneumatics-StepByStep-cRIOversion.pdf (1.26 MB)


Pneumatics-StepByStep-cRIOversion.pdf (1.26 MB)

The digital sidecar cannot directly control the solenoids, but if you are using 12 volt solenoids, spike relays can be used for indirect control. However, if you are using 24 volt solenoids, the solenoid bumper MUST be used, and it must be powered by the 24 volt supply on the power distribution board.

Also, all of the pressure switch related code is in the “WPI CompressorControlLoop” VI so there is no need to do anything more with that.

Yes, you’d copy it and use a second relay to control the second solenoid of the double solenoid. There is actually a way to use one relay to control both solenoids, but I can’t recall if it’s legal this year or not.

The best solution is to use the solenoid module and breakout, though. It takes up much less space than a bunch of relays.

So Today I programmed the compressor(Everything is set up by the tutorial provided by team 358,I provided the Vi) and I had a few questions. First, I noticed that when I press the trigger on Joystick one the compressor began to compress air is there a way I can automatically make it compress air until it gets to 120Psi by itself. I only want to use the trigger to control the Solenoids to push the piston forward and back. Also, I had problems programming the solenoids.Since were connecting the solenoid to a spike and from their to a relay on digital sidecar I had to program relays and I wasn’t able to connect the triangle(with the True/False, and Question mark) thing to the RELAY SET VI, I would always get a little red dot on it, So I know something is wrong, how do I fix it? Thxs :slight_smile:

Pneumatics.vi (31.2 KB)


Pneumatics.vi (31.2 KB)

In the Begin vi, use the Compressor functions to Open a compressor and give it a name with a Refnum Set. Specify the relay powering the compressor and the digital input with the pressure switch connected.

In the Periodic Tasks vi, enable the existing bit of code that starts the compressor control loop. Replace the sample name with the one you used in Begin.

That’s all it takes to have a compressor automatically come on when the pressure drops below 90 psi and turn off when it reaches 120 psi.

That red coercion dot is there because the Forward and Off constants you have connected to the Select function are Solenoid constants, and the Relay Set is expecting Relay constants. You can see this if you turn on the Context Help and hover the cursor over the blue wire coming out of them. They happen to be perfectly compatible with one another (Off/On/Forward/Reverse values are represented as 0/1/2/3 in both), so the dot is only a cosmetic issue. But you can fix it by deleting the existing constants and creating new ones based on the RelayValue input terminal of the Relay Set function.

I did exactly as you said about opening the compressor and have enabled the control loop in periodic tasks but I still need to press and hold down the trigger button to make the compressor turn on. Also, I put the Compressor Set(One of the arrow in front I think thats how it is called), Stop, and Close VI in the Finish VI do you think thats why I have to manually press and hold the trigger button to control the compressor? Should I not put any compressor code in the Finish VI? Thxs

Sorry, I forgot a step. You also need to include a Compressor Start in the mix between the Compressor Open and the Compressor Refnum Set.

And you shouldn’t have any other Relay Open functions trying to access the same relay you opened for the Compressor.

Are you seeing any errors on the Driver Station diagnostics output display?

So Today we tested our pneumatic and for some reason the pistons are not working. We think it might be a programming issue since we have check the pneumatic and there’s no problems. The pressure builds up correctly but when I click button 3 on joystick 1 nothing happens. Button 3 is suppose to make this piston push out because we want to manually control it when the piston comes out and comes back in.I don’t know whats wrong with the code can someone please check the codes I have provided thxs :slight_smile:

Begin.vi (38.8 KB)
Finish.vi (18.3 KB)
Periodic Tasks.vi (22.3 KB)
Teleop.vi (31.9 KB)


Begin.vi (38.8 KB)
Finish.vi (18.3 KB)
Periodic Tasks.vi (22.3 KB)
Teleop.vi (31.9 KB)

You have the NI 9472 module in Slot 3 of the cRIO, right? Does its first LED (labeled “0”) come on when you press the joystick button?

Is the green power indicator LED on the Solenoid Breakout lit? Where does its power input connect to?

What kind of solenoid valve are you using, and what is its voltage rating?

Thxs for help we got it fixed! we noticed that the First LED wasn’t turning on but then we did some quick research and saw we were suppose to hold the button down. Now our pneumatics is completely up and running. Thank you so much for the help!!