Go to Post We can relate anything back to water, and by anything, I literally mean ANYTHING. Surfing around on Chief Delphi has proven that to me. - karomata [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-01-2002, 17:20
zorro zorro is offline
Registered User
#0292 (PantherTech)
 
Join Date: Jan 2002
Location: Kokomo, IN
Posts: 21
zorro is an unknown quantity at this point
Send a message via AIM to zorro
Auto Air Pump Code

I have seen a lot of auto air pump code out there that is longer and more sophisticated than it should be. I wrote the following code to accomplish the same task but it uses less lines of code and less IF statements. Yes, it includes a delay on turning off the pump.

Just copy and paste the following:

'=============================================
' Auto Air Pump Sub
'=============================================

' pressure is an alias for the pressure sensor
' pressure = 0 when tank is full
' pressure = 1 when tank is empty

' pump is an alias for the relay output to the pump
' When pump=1 the compressor is on.

' num_loops is a byte variable that counts loops until...
' pump_delay which is a constant for the number of loops
' to run the pressure switch after it has been
' toggled

' This code is written as a subroutine. Place the code
' after the main loop and call it by typing:
' "gosub subAutoAirPump" in the main loop

subAutoAirPump:
if (pressure = 0) then pump_check
num_loops = 0
pump = 1
return

pump_check:
if (num_loops = pump_delay) then pump_off
pump = 1
num_loops = num_loops + 1
return

pump_off:
pump = 0
return

' END CODE


Reply if you have any questions.

Greg Szorc

Last edited by zorro : 10-01-2002 at 17:23.
  #2   Spotlight this post!  
Unread 19-01-2002, 14:15
Jnadke Jnadke is offline
Go Badgers!
#0093
Team Role: Alumni
 
Join Date: Jan 2002
Location: Appleton, WI
Posts: 775
Jnadke is on a distinguished road
Send a message via ICQ to Jnadke Send a message via AIM to Jnadke Send a message via Yahoo to Jnadke
"Overfilling" the accumulators accomplishes nothing except stressing the compressor/breaker and wasting electricity.

1. The check valve begins to "leak" at 120PSI. Feel free to overfill, but it will only waste electricity and give our team an easier time. Rules indicate that this must be the first thing in the pneumatics line after the compressor.

2. It's far easier to adjust the pressure sensors instead. I have ours set at 120 PSI (well, the point just before the valve starts to leak) and approx 100 PSI. This creates a buffer zone in case of miniscule leaks.

The code is smaller too...

Code:
Compressor:
  if low_pressure = ON then Compressor_on
  if high_pressure = OFF then Compressor_off
  goto Compressor_return

Compressor_on:
  compressor_relay = ON
  goto Compressor_return

Compressor_off:
  compressor_relay = OFF
  goto Compressor_return

Compressor_return:
  return
Sometimes the simplest approach is the easiest. I'll let you do the reading on how this works. If you just implement it, then it will not get you anywhere.

Anyways, FIRST is about sharing and it's nice to be of help. Just remember the KISS principle. Keep It Simple, Stupid. Another thing: The technical manuals and team updates contain a ton of pneumatics information, READ THEM.

Last edited by Jnadke : 19-01-2002 at 14:20.
  #3   Spotlight this post!  
Unread 19-01-2002, 16:53
Katie Reynolds Katie Reynolds is offline
Registered User
no team (NEW Apple Corps)
Team Role: Alumni
 
Join Date: Nov 2001
Rookie Year: 2001
Location: Appleton, WI, USA
Posts: 2,598
Katie Reynolds has a reputation beyond reputeKatie Reynolds has a reputation beyond reputeKatie Reynolds has a reputation beyond reputeKatie Reynolds has a reputation beyond reputeKatie Reynolds has a reputation beyond reputeKatie Reynolds has a reputation beyond reputeKatie Reynolds has a reputation beyond reputeKatie Reynolds has a reputation beyond reputeKatie Reynolds has a reputation beyond reputeKatie Reynolds has a reputation beyond reputeKatie Reynolds has a reputation beyond repute
Send a message via AIM to Katie Reynolds Send a message via Yahoo to Katie Reynolds
Jnadke - you beat me to it! I was just going to post that!

- Katie
__________________
Team #93 - NEW Apple Corps
Student - 2001-2004
Team #857 - Superior Roboworks
Mentor - 2006-2009
  #4   Spotlight this post!  
Unread 20-01-2002, 18:28
zorro zorro is offline
Registered User
#0292 (PantherTech)
 
Join Date: Jan 2002
Location: Kokomo, IN
Posts: 21
zorro is an unknown quantity at this point
Send a message via AIM to zorro
Woah! I didn't realize we had two pressure sensors. I guess we misplaced the 2nd one last year. Maybe if you loose the second like I did you will need my code, otherwise the other code is easier. Now I can figure out what to do with the 8 bits of variable space I just gained back...
__________________
Greg Szorc
gregszorc@cwru.edu
  #5   Spotlight this post!  
Unread 20-01-2002, 23:17
Lloyd Burns Lloyd Burns is offline
Registered User
FRC #1246 (Agincourt Robotics)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Toronto
Posts: 292
Lloyd Burns is an unknown quantity at this point
Sorry, but last year, people were posting counting routines to keep the pump switched on for a while after the pressure reached rock bottom (the low set point of the *one* pressure switch). This is the first year since we first Firsted that we have been given two pressure switches.

Odd, considering that with one allowed-this-tear IC you could purchase, you could get pressure readings instead of pressure set points, to feed into an analog port, and read it on the dashboard.
  #6   Spotlight this post!  
Unread 21-01-2002, 14:32
kangarue23 kangarue23 is offline
Registered User
#0253
 
Join Date: Jan 2002
Location: Millbrae, CA
Posts: 4
kangarue23 is an unknown quantity at this point
Wiring for the pressure switch...?

Our team just found out that pressure switches actually serve a purpose (from reading this thread) but now we're kind of confused. How do you wire a pressure switch (12v, ground & signal...?) Thanks in advance.

Last edited by kangarue23 : 21-01-2002 at 15:54.
  #7   Spotlight this post!  
Unread 21-01-2002, 15:45
zorro zorro is offline
Registered User
#0292 (PantherTech)
 
Join Date: Jan 2002
Location: Kokomo, IN
Posts: 21
zorro is an unknown quantity at this point
Send a message via AIM to zorro
There is an example in the manual in section 2.1.6. Basically you wire the ground to a ground pin on the digital input (pins 3,6,9,12,13,14,17,20,23) and the other to a digital sensor input pin (1,2,15,16,4,5,18,19,7,8,21,22,10,11,24,25). On the sensor itself, ground is marked as "C" and the signal is "NC."
__________________
Greg Szorc
gregszorc@cwru.edu
  #8   Spotlight this post!  
Unread 21-01-2002, 18:59
Justin Stiltner's Avatar
Justin Stiltner Justin Stiltner is offline
The big guy
no team
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 2000
Location: Blacksburg, Va.
Posts: 305
Justin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud of
Send a message via ICQ to Justin Stiltner Send a message via AIM to Justin Stiltner Send a message via MSN to Justin Stiltner Send a message via Yahoo to Justin Stiltner
But you forget one thing...

software weighs nothing, and takes no sensor input.

BUT the extra switch weighs something..(not a lot i know.. but it can make a difference) and takes an extra sensor input that if you have a very complicated robot with lots of sensor inputs and such, you may not have the extra sensor input to spare.

just a thought
__________________
Justin Stiltner
Lead Robot Inspector, VCU Regional
Unmanned Systems Lab, Virginia Tech
KI4URQ
  #9   Spotlight this post!  
Unread 22-01-2002, 10:41
Tim Skloss's Avatar
Tim Skloss Tim Skloss is offline
Dr. Skloss
FRC #0930
Team Role: Parent
 
Join Date: Jan 2002
Rookie Year: 2000
Location: Waukesha, WI, USA
Posts: 73
Tim Skloss is a jewel in the roughTim Skloss is a jewel in the roughTim Skloss is a jewel in the roughTim Skloss is a jewel in the rough
We used the two switches at the same time to keep the pump from cycling when using only one sensor. It responds instantly to low pressure and does not use a delay. We hope to use sensors to do away with delays since it may be critial for the robot to respond during the delay.

The pump starts when below 110 PSI and stops when above 115 PSI. The fall between 115 and 110 does not cause a pump start. Even for small leaks, the pump only cycles about 2 times per minute not 20 times per minute like before.
__________________
---------------
FIRST Mentor and Team Leader
C.O.R.E 2062 a NASA, GE Volunteers and Rockwell Automation FRC Team
  #10   Spotlight this post!  
Unread 22-01-2002, 12:53
Justin Stiltner's Avatar
Justin Stiltner Justin Stiltner is offline
The big guy
no team
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 2000
Location: Blacksburg, Va.
Posts: 305
Justin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud of
Send a message via ICQ to Justin Stiltner Send a message via AIM to Justin Stiltner Send a message via MSN to Justin Stiltner Send a message via Yahoo to Justin Stiltner
not flameing or anything but i was wondering..

1. how did you hook both pressure switches up to only one input and have it change state
and
2. why wouldent the robot respond during the pump delay?
__________________
Justin Stiltner
Lead Robot Inspector, VCU Regional
Unmanned Systems Lab, Virginia Tech
KI4URQ
  #11   Spotlight this post!  
Unread 22-01-2002, 14:33
Tim Skloss's Avatar
Tim Skloss Tim Skloss is offline
Dr. Skloss
FRC #0930
Team Role: Parent
 
Join Date: Jan 2002
Rookie Year: 2000
Location: Waukesha, WI, USA
Posts: 73
Tim Skloss is a jewel in the roughTim Skloss is a jewel in the roughTim Skloss is a jewel in the roughTim Skloss is a jewel in the rough
I don't think I explained it well. We use two sensors, and two digital inputs. The software determines if the pump is currently running before reading the sensors and deciding what to do.

We will stay with this setup unless we need to save the weight or input channel by removing the one extra sensor.
  #12   Spotlight this post!  
Unread 22-01-2002, 20:20
Justin Stiltner's Avatar
Justin Stiltner Justin Stiltner is offline
The big guy
no team
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 2000
Location: Blacksburg, Va.
Posts: 305
Justin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud ofJustin Stiltner has much to be proud of
Send a message via ICQ to Justin Stiltner Send a message via AIM to Justin Stiltner Send a message via MSN to Justin Stiltner Send a message via Yahoo to Justin Stiltner
yea, thats like i said.. one will save weight and an input.. but the down side to that is you add a bit more code...

there is give and take in everything you do..
__________________
Justin Stiltner
Lead Robot Inspector, VCU Regional
Unmanned Systems Lab, Virginia Tech
KI4URQ
  #13   Spotlight this post!  
Unread 08-12-2002, 23:23
Antonio Antonio is offline
Registered User
#0919
 
Join Date: Dec 2002
Location: Toronto, Ontario, Canada
Posts: 42
Antonio is an unknown quantity at this point
just a question guys what's the difference between having one pressure switch or two pressure switch, is there any advantages?
  #14   Spotlight this post!  
Unread 08-12-2002, 23:40
dlavery's Avatar
dlavery dlavery is offline
Curmudgeon
FRC #0116 (Epsilon Delta)
 
Join Date: Jun 2001
Rookie Year: 1996
Location: Herndon, VA
Posts: 3,176
dlavery has a reputation beyond reputedlavery has a reputation beyond reputedlavery has a reputation beyond reputedlavery has a reputation beyond reputedlavery has a reputation beyond reputedlavery has a reputation beyond reputedlavery has a reputation beyond reputedlavery has a reputation beyond reputedlavery has a reputation beyond reputedlavery has a reputation beyond reputedlavery has a reputation beyond repute
Quote:
Originally posted by Antonio
just a question guys what's the difference between having one pressure switch or two pressure switch, is there any advantages?
One pressure switch weighs less than two.

Ergo, if you can do the job with one switch and some clever code (which weighs no more than stupid code), you can save some weight that can be used elsewhere...

-dave
  #15   Spotlight this post!  
Unread 09-12-2002, 18:35
Animator Animator is offline
Registered User
#0120
 
Join Date: Dec 2002
Location: Cleveland
Posts: 11
Animator is an unknown quantity at this point
Why you should use two sensors

1) The sensor only weighs a couple of ounces. It is not going to cause your robot to be overweight. There are more signifacant things on your robot that will cause it to be overweight.

2) You need to have two sensors in order to establish a hysteresis. Hysteresis is used to prevent wear and tear on the air pump.

The code is at the bottom of the post

a) You could use one sensor that would turn the air pump on and off whenever the air pressure drops below 120 PSI, but this will cause the battery to drain very quickly and it will steal vital current from your drive motors (the battery can only deliver so much current. Try running the drive motors and the pump at the same time. You should notice a difference) plus your pump motor will eventually burn out.

b) You could use one sensor to indicate a minimum pressure of 80 - 100 psi, then turn the pump on for a set amount of time aka: x number of program scans, and then turn it off after that amount of time. The problem with this is that you need to make sure that the pump turns off before the accumulators (The silver cylinders included in the kit that attach to the pump) reach 120psi. This means that you MUST use a freshly charged battery and time how long it takes for the pump to go from your minimum pressure to 120 psi. As the battery drains down and the amount of voltage at the terminals decreases, the pump will need more time to fill the accumulators with air, but if you are using one sensor you will need to sacrifice that the acculmulators will not fill all the way. You CANNOT depend upon the safety valve to bleed off your excess air. Will it work, yes, but it is a safety hazard. A few years ago, a steam engine at the Cuyahoga County Fair blew up and killed several people. The reason: the safety valve did not release when the pressure reached a critical pressure. The safety valve included on the pump is meant to be a safety precaution, a last resort, a oh my goodness my sensor is not working please save me. It is not meant to be used for general purpose use.

Using two sensors compensates for the degradation of voltage as the battery wears down, while allowing you to maintain your desired pressures and minimizing wear and tear on the pump motor.

FIRST posted code last year for the air pump. It is excellent:
---------------------------------------------------------------------
Pump = (HighPres & ~PumpMan) & (LowPres | Pump)
Pump_rev = 0
---------------------------------------------------------------------
HighPres = High Pressure Sensor
Low Pres = Low Pressure Sensor
PumpMan = An override switch that I can use to disable the pump for any reason (SAFETY)
Pump = The Pump Relay switch
Pump_rev = The relays included in the kit have a forward and a reverse output. The reverse output on the relay must be set to 0 at all times when using the air pump.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Does your team use the Default code. Jeff McCune General Forum 2 09-01-2003 14:46
What are pneumatics? Aignam Pneumatics 23 16-10-2002 21:17
Need help with 255 Variable Joseph F Programming 18 26-02-2002 14:49
Error found in programming for the pump and pressure switch sjharobotics Programming 4 06-02-2002 17:46
Pneumatics pump allowed on robot? bigqueue Pneumatics 5 06-01-2002 12:30


All times are GMT -5. The time now is 14:48.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi