Friday, December 12, 2014

Last Post (Again)!

So, unfortunately, we couldn't keep up with the various kinks and goofs that eventually crippled the launcher. When we got to the expo, everything was great except the valve at the back through which air was pumped didn't stay sealed. We suspect that the cold air weakened the budget epoxy we used to seal it, and that spelled its demise.

Overall, however, the project is salvageable. Alex will probably take it home with him this winter, much to the dismay of his cats that it will inevitably torture. We had a blast working together and the fact that we had something even partially functional counts as a success to us. So long!

Last Post!

So, here we are, the day of the presentation and the launcher is complete. It's still got a few kinks but overall, it works.

Rather than 3D print the original part, we've opted to go the simpler route and use a PVC Wye joint to load the ping pong balls in from the top. A servo motor is mounted to the tube to only allow one ball in at a time. From there, a solenoid valve opens to release air pressure built up in a 2L bottle.

We got a little bored and coded in a shot counter, too. We're going to try to work out a few kinks before we head to the expo. Hopefully we'll have it completely functional when we get there!

#include <Servo.h>

Servo Bolt;
const int buttonPin = 2;  
const int valvePin = 4;
const int latchPin = 8;
const int clockPin = 12;
const int dataPin = 9;

int fireState = LOW;         
int buttonState;            
int previousButtonState = LOW; 
int ammo=9;

unsigned long lastDebounceTime = 0;  
unsigned long debounceDelay = 50;

byte digits[11]= {0x77, 0x44, 0x6B, 0x6E, 0x5C, 0x3E, 0x3F, 0x64, 0xFF, 0x7E, 0x00};

void setup() {
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  
  Bolt.attach(11);
  pinMode(buttonPin, INPUT);
  pinMode(valvePin, OUTPUT);
  
  digitalWrite(valvePin,LOW);

  reload();  
}

void loop() { 
  guage(ammo);
  
  int x = digitalRead(buttonPin); 
  
  if (x != previousButtonState) {
    lastDebounceTime = millis();
  } 
  if ((millis() - lastDebounceTime) > debounceDelay) {
    if (x != buttonState) {
      buttonState = x;
      if (buttonState == HIGH) {
        fireState = 1;
      }
    }
  }   
  if (fireState == 1){
    if (ammo == 0){
     for (int j=0; j<5; j++){
         guage (0);
         delay (250);
         guage (10);
         delay (250);
         fireState = 0;
     }
  }
  else {
      digitalWrite (valvePin, HIGH);
      delay (300);
      digitalWrite(valvePin,LOW);
      delay (1500);
      reload();
      delay (500);
      ammo--;
      fireState = 0;
      }
    }
  previousButtonState = x;
  }

void reload (){
  Bolt.write(0);
  delay(55);
  Bolt.write(20); 
}

void guage(int y){
  digitalWrite(latchPin, LOW);
  shiftOut(dataPin, clockPin, LSBFIRST, digits[y] );
  digitalWrite(latchPin, HIGH); 
}

It's long. But so far, so good!

Monday, December 8, 2014

Alright, good news. The design is finalized, the parts are on their way in and with any luck, the launcher will be ready to go by the end of the week.

Alex and Trevor have revised the final design. Originally, the ball was going to be launched by a solenoid motor. They've decided to go with a pressure system instead. A bike pump hooked into a 2L bottle attached to a solenoid valve, controlled by an Arduino board (perhaps a bit of overkill, no?). The code is being finalized, and should be posted soon.

The part design for the launcher isn't going to change much, the dimensions will be altered to accommodate the side of the solenoid valve, other than that, the chute is still the same.

At the end of all this, we will have an easy-to-use launcher that can be used to fire lightweight projectiles a decent distance.

Here are a few shots of the model after it was "finalized". It looks a lot fancier now!