Log in

View Full Version : COMPRESSOR & PRESSURE SWITCH HELP...


programmr
15-02-2008, 07:21
Does anyone know how to program in mplab the compressor and pressure switch, compressor at relay7_fwd and the pressure switch connected at rc_dig_in02??? I need the compressor to go on and then stop once it has reached its max pressure. SOMEONE PLEASE HELP ME!!!!

SuperBK
15-02-2008, 08:27
One line of code:

/* Power pump only if pressure switch is off. */
relay7_fwd = !rc_dig_in02;


Put it in both the teleop code (usually Default_Routine) in in autonomous if you are doing autonomous (in User_Autonomous_Code())

Brian

Racer26
15-02-2008, 08:29
The Nason pressure switch is a normally closed switch, which means it will normally pull your digital input to 0, except once it reaches 120psi, it will switch to 1. All you do to run the compressor knowing that, is set whichever relay you have it connected to, to the opposite of the input.

In your case, I believe this is:

relay7_fwd = !rc_dig_in02;

programmr
15-02-2008, 09:29
still nothing someone please help

Team 135
15-02-2008, 09:30
We used the digital input #7 to do our because of the different way that the digital IOs work. You should look at a wiring diagram of the digital IOs and determine witch is best for you.

Mark McLeod
15-02-2008, 10:48
Add

relay7_rev = 0;

to the previous answers.

These answers assume you are using MPLAB w/IFI or Watson default code.
What are you using?

Tell us what is happening.

--Is the compressor turning on, but not off?
--What color is the compressor Spike light?
--Is your pressure switch wired with only the ground and signal lines (black & white usually), NOT the red wire?
--Is the Spike fuse replaced with a 20a snap-action breaker?

Jon Stratis
15-02-2008, 10:50
still nothing someone please help

First a clarification question - do you have the compressor hooked up through a spike to relay 7?

Next, check a few things:
- does your compressor run if you hook it up straight to the 12V battery?
- Can you get the compressor to run through the system (ignoring the pressure switch for right now)? Just set relay7_fwd = 1; and see if it turns it on (make sure the hoses are disconnected so you don't blow something up)
- Can you get a reading from the pressure switch? throw in a printf("pressure switch = %d\r\n", rc_dig_in02); somewhere, hook up the hoses, and manually control the compressor to see it run through the full range 0-120psi and back down. Watch the input from the pressure switch on the terminal window, and see how it changes as the pressure changes.

Assuming all of that works out, you should be able to see pretty clearly how to wire in the pressure switch to turn on/off the compressor.

Racer26
15-02-2008, 12:24
The code that has been given by myself and others WILL work. So if that code has been flashed into your robot, you must make sure that your compressor is working, and that the pwm cables and spikes and everything are set up properly. There is some point in the system that is not working, and its not the code.

eugenebrooks
15-02-2008, 12:33
The connection between the male PWM cable and the
socket in the spike is a frequent source of problems.
If you have inspected the code and find it to be in proper
order, you can try another spike and/or pwm cable. You
should also carefully check that the pwm cable is seating
all the way into the socket on the spike.

Eugene