Need Help With General Pneumatics

This year is the first year that our team has used pneumatics, so I have never had a need to look into how to program the system. I looked on the other forums, but they only gave disconnected pieces. Any help in this area would be great.

Pneumatics programming is pretty straightforward. The pneumatic solenoids and the compressor are connected through Spikes, which are in turn connected to the Relay pins on the RC. You will turn them on and off just like any other Spike, but you will want to talk to your pneumatics designer to figure out which combinations of on and off will give you the desired behavior. You will need to wire the pressure switch to a digital I/O, and then if that switch is triggered, you have to turn off the Spike that runs the compressor (per <R103>). If you have any more questions, feel free to ask.

Also, to make pneumatics programming easier, I’ve whipped up a quick set of macros you can use in your project to control the relays.

Changing a relay’s state requires you to set a 0 to one variable and a 1 to another, if you forget, they jam, not such a good thing, these macro’s will automate the process a bit and neaten up your code.

Example of the old way:


	relay1_fwd = 1; // This sets relay 1
	relay1_rev = 0; // to forward

	relay2_fwd = 0; // This sets relay 2
	relay2_rev = 1; // to reverse

	relay3_fwd = 1; // This makes relay 3
	relay3_rev = 1; // get stuck!

	relay4_fwd = 0; // This sets relay 4
	relay4_rev = 0; // to off

Example of my way:


	RELAY1_FWD; // This sets relay 1 to forward

	RELAY2_REV; // This sets relay 2 to reverse

	// No way to get stuck!
	
	RELAY4_OFF; // This sets relay 4 to off

All you need to do is add


        #include "relays.h"

at the top of whatever file uses these macros, and that file is attached to this post: http://www.chiefdelphi.com/forums/showthread.php?p=455507#post455507

Good luck!

Thanks for the adivce. I really appreciate it. One problem we still have is that we’ve never used pneumatics, and so don’t have a pneumatics person. However, I think we’ll be able to figure out the wiring. The only remaining problem is the digital sensor thing. I tried to wir up the gear tooth sensor last year, and it coused the camera to freak out, something about it being a costant hardware interrupt or something. How would you make it so the signal doesn’t kill the camera?

That sensors doesn’t need to be on an interrupt, it can be polled. Just connect it to a digital input then every loop just have an if() statement check it, if the sensor is on, turn off the compressor. I think the default code has stuff for this towards the end for digital input 18 and relay 1, but I’m not sure.

You don’t even need an if statement, it can be done in a single line:

COMPRESSOR = 1 - PRESSURE_SENSOR;
where COMPRESSOR is the compressor’s output, and PRESSURE_SENSOR is the pressure sensor input.

Hi again, the programming itself is going well. However, today we tried to wire up teh compressr and sensor to test the code to turn the compressor on and off, and as you probaly can guess it didn’t work (I hate Murphy). Here’s the code and what happened:

In two header files, the following was written:

#define Comp_fwd relay5_fwd
#define Comp_rev relay5_rev

#define P_Sensor rc_dig_in18

#define ON 1
#define OFF 0

in a .c file, with the subroutine being called sucessfully from default routine, and default routine definately being called:

void Pressure_Upkeep(void)
{
if((LD_Sensor == NOT_TRIPPED) && (P_Sensor == NOT_TRIPPED)) {
Comp_fwd = ON; Comp_rev = OFF;
}
else
{
Comp_fwd = OFF;
Comp_rev = OFF;
}
}

The spike was wired as the following:
Ground wire(black) to small metal plate on board
12V wire(red) to 20 amp fuse on the same board
M- wire(black) to black compressor wire
M+ wire(red) to red compressor wire
pwm cable from spike to relay 5, directions checked and correct
pressure sensor wired and connected to digital input 18, direction correct

The results were:
The spike’s LED was on and solid orange
the compressor remained off

Variations:
The sensor was unplugged to test for false reading: no change
a different spike was used to test for faulty hardware: no change

It is unlikely that the sensor was tripped, since the pneumatic circuit had just been constructed and had not yet been pressureized, and the sensor does not trip until 115psi

Does anyone know what could be causing this?

Ryan,

I don’t know what an “LD_sensor” is and I don’t know what you defined “NOT_TRIPPED” as…

Have you looked at the default code from IFI? The compressor control is a single line of code:

relay8_fwd = !rc_dig_in18;  /* Power pump only if pressure switch is off. */

Why are you making it more difficult?

Mike