Lab 3, Group 14 (Team Chewbacca) – Catapult

i. Karena
Stephen
Jean
Eugene

ii. Group 14

iii. Short Description

We built a catapult that detects when something is nearby. Upon sensing something, the catapult will launch a small object in the direction of where the thing was sensed. We wanted to make something that reacted to a proximity sensor mounted on a rotating arm, and we thought a catapult was a fun and creative way to have a system that reacted to a nearby object. An inspiration for our project was defense mechanisms, that may be employed in preventing unwanted people or objects from nearing a certain range. Our original plan was to make a robot that moved in the direction of an object that it detected, but after multiple iterations, we could not get the robot to move forward effectively.  The forward motion was not effective because the motors weren’t powerful enough, and the servos would resume to their original position after moving, which canceled the forward motion. In the end, we ultimately decided to launch something at the target instead of moving towards it. With additional motors or materials, we might have been able to achieve our original idea. We thought we were successful in creating a robot that moved in reaction to its surroundings. The catapult accurately launched an object at considerable speed towards the target, and the proximity sensor responded immediately to targets it touched. One improvement we would have liked to make to our project would be to make our proximity sensor more powerful.  Because we didn’t have a 10 MegaOhm resistor, the catapult would only detect an object that was touching the proximity sensor. We would be able to improve our catapult if we had access to this resistor.

iv. Brainstorm
– smart window-blind motor (more light lowers blind using motor, less light raises blind using motor)
– flying robot that increases the motor speed depending on it’s proximity from the ground
– catapult; propels an object at different speeds
– tilt the arduino controller to move the robot
– a segway (with a servomotor fowards/backwards movement controller)
– mono-segway (hard)
– impulses depending on acceleration from accelerometer
–  temperature-sensing fan
– linear sensor with FSR – fsr controls speed, linear controls turning
– line follower/wall avoider
– moves towards light in its field of vision (servomotor wiggles the light sensor from side to side to get the max light reading)
– disk-shooting robot
– sweeping robot – spins around and pushes dirt around
– a top robot – spins around and balances itself
– a two stage system – first catapults itself using a heavy weight controlled by a servo (wires detach from the force), and then moves around
– a paddling robot for land and water
– kicking robot using proximity
– a monocycle – aka hamster bot
– hopping robot
– throw out a bunch of stuff on the robot to push it backways
– advances the lead on a mechanical pencil to push it forward
– inchworm robot (servos)
– underwater propeller
– a rocking robot
– hovercraft – propeller downwards, then another propeler sideways


v. photos of design sketches

20130331_180930 20130331_192759 20130331_192811

 

20130331_195708-1

vi. video of final system

http://youtu.be/R2p-HGOnCgA


vii. list of parts

  • two servomotors
  • proximity sensor (using tin foil)
  • arduino uno
  • breadboards
      •  
  • a lot of tape
  • wires
  • some cardboard
  • straw
  • foil

viii.instructions

Attach two servo motors to the arduino, and attach these to the straw by attaching one servo to the straw, and the second servo is attached to the first servo. The first servo acts as the “turning servo” which will turn the straw around to look for an object within its proximity, and the second servo  acts as the “shooting servo” to fire the catapult when something is detected.

ix. source code

/*
Adafruit Arduino – Lesson 14. Sweep
*/
#include <CapacitiveSensorDue.h>
#include <Servo.h>
int servoPin = 8;
int servoPin2 = 7;
Servo servo;
Servo servo2;
int angle = 0;   // servo position in degrees
int motorPin = 3;
CapacitiveSensorDue cs_4_2 = CapacitiveSensorDue(4,2); // 10M resistor between pins 4 & 2, pin 2 is sensor pin, add a wire and or foil if desired
void setup()
{
  pinMode(motorPin, OUTPUT);
  Serial.begin(9600);
  servo.attach(servoPin);
  servo2.attach(servoPin2);
}
int readCapacitor() {
  long start = millis();
  long total1 = cs_4_2.read(30);
  Serial.print(millis() – start); // check on performance in milliseconds
  Serial.print(“\t”); // tab character for debug windown spacing
  Serial.println(total1); // print sensor output 1
  return total1;
}
int threshold = 100;
void moveforwards () {
     // scan from 0 to 180 degrees
   int maxangle = 0, maxvalue = 0;
   servo2.write(180);
  // now scan back from 180 to 0 degrees
    maxangle = 0, maxvalue = 0;
  for(angle = 180; angle > 0; angle–)
  {
    servo2.write(angle);
    delay(5);
  }
}
void loop()
{
  // scan from 0 to 180 degrees
  int maxangle = 0, maxvalue = 0;
  for(angle = 60; angle < 180; angle++)
  {
    servo.write(angle);
    if (angle % 1 == 0) {
      int proximity = readCapacitor();
      if (proximity > threshold) {
         moveforwards();
         delay(500);
      }
    }
    delay(15);
  }
  // now scan back from 180 to 0 degrees
  maxangle = 0, maxvalue = 0;
  for(angle = 180; angle > 60; angle–)
  {
    servo.write(angle);
    if (angle % 1 == 0) {
      int proximity = readCapacitor();
      if (proximity > threshold) {
         moveforwards();
         delay(500);
      }
    }
    delay(15);
  }
}