Candypult--Computer Controlled Candy Catapult
Intro: Candypult--Computer Controlled Candy Catapult
An electrically powered catapult automatically loads a piece of candy from the tower dispenser. Upon command from the radio control, the rotating base swings to point in the desired direction. Push another button and the candy is fired toward the recipient--then the catapult reloads.
I'm toying with the idea of making a few of these available through a "Kickstarter" project--any comments?
For extra credit, you can build the "clap controlled catapult" (start at step #31)
STEP 1:
Parts:
Arduino
(2) Hitec HS-311 servo motors (Amazon.com)
(1) Hitec HS-645MG servo motor (high torque)--Amazon.com
(1) mini Servo YKS SG90 (Amazon.com)
(1) Two channel remote control toy--I got a car for $11.99 at a local pharmacy
(3) 5 volt relays--Jameco.com #139977 (these are polarized so that positive voltage on one coil lead causes it to pick up, but the other polarity doesn't; you can produce the same result with a 5 volt relay and a diode. Relays "B" and "C" only operate one at a time--based on the polarity provided.)
1/4" x 3 1/4" x .025 spring (available at Lowes)
(6) 12" servo extension cables
Spring from a ballpoint pen
4" lazy susan http://www.amazon.com/Capacity-Bearing-Turntable-Bearings-VXB/dp/B002TIKEQ6/ref=sr_1_2?ie=UTF8&qid=1372692771&sr=8-2&keywords=lazy+susan+4+inch
9 volt, 500 ma DC power supply
6 volt, 1 amp DC power supply
3D printed parts, design and print files at:
http://www.thingiverse.com/thing:110350
Wood, screws,paint, wire, jumpers
STEP 2:
Take a 4" x 15" x 1/2 inch piece of plywood and paint it orange. Diagonally wrap painters tape to make the stripes.
STEP 3:
STEP 4:
STEP 5:
STEP 6:
STEP 7:
STEP 8:
STEP 9:
STEP 10:
STEP 11:
STEP 12:
STEP 13:
STEP 14:
STEP 15:
STEP 16:
STEP 17:
STEP 18:
STEP 19:
STEP 20:
Super glue the servo motor holder to the candy tower.
STEP 21:
STEP 22:
STEP 23:
STEP 24:
STEP 25:
STEP 26:
STEP 27:
STEP 28:
STEP 29:
Note the use of servo extension cords and a wire guide to protect the wires that move through the rotation process.
STEP 30:
Software:
p.MsoNormal, li.MsoNormal, div.MsoNormal { margin: 0.0in; font-size: 12.0pt; font-family: Times New Roman; } div.Section1 { page: Section1; }
#include <Servo.h>
Servo candy;
Servo rotate;
Servo latch;
Servo spring;
int fire=2;
int right=4;
int left=6;
int val=0;
int val1=0;
int val2=0;
int val3=0;
void setup()
{pinMode(fire,INPUT);
pinMode(right,INPUT);
pinMode(left,INPUT);
candy.attach(13);
rotate.attach(12);
latch.attach(8);
spring.attach(7);
rotate.write(45);
delay(500);
rotate.write(30);
latch.write(60);
spring.write(200);
candy.write(25);
candy.write(140);
delay(500);
candy.write(25);
}
void loop()
{
val=digitalRead(left);
val1=digitalRead(right);
val2=digitalRead(fire);
if(val==HIGH or val1==HIGH or val2==HIGH)
{
if (val==HIGH)
{val3=(val3+5);}
if (val3>=145)
{
val3=(val3-5);
}
if (val3<65)
{
val3=65;
}
rotate.write(val3);
delay(50);
}
else
val=digitalRead(left);
val1=digitalRead(right);
val2=digitalRead(fire);
if(val1==HIGH)
{val3=(val3-5);
if(val3<65)
{val3=(val3+5);
}
rotate.write(val3);
delay(50);
}
else
if(val2==HIGH)
{spring.write(50);
delay(1000);
latch.write(200);
delay(1000);
spring.write(200);
delay(500);
latch.write(60);
delay(1000);
rotate.write(50);
delay(500);
rotate.write(30);
candy.write(140);
delay(500);
candy.write(25);
val3=0;
}}
STEP 31: EXTRA CREDIT!
This is about 60% reliable, so more work needs to be done (probably in shielding the microphones).
The concept is this--when a loud sound arrives, it will probably be louder at the microphone pointed in the direction of the sound.
STEP 32:
Microphones are Jameco #320179
STEP 33:
STEP 34:
In a room without a lot of people and clutter, I can achieve very high accuracy; but I think the machine trained me instead of the other way around.
Software:
p.MsoNormal, li.MsoNormal, div.MsoNormal { margin: 0.0in; font-size: 12.0pt; font-family: Times New Roman; } div.Section1 { page: Section1; }
#include <Servo.h>
Servo candy;
Servo rotate;
Servo latch;
Servo spring;
int led2=3;
int val2=0;
int ledcenter=6;
int ledPin=5;
int valm=0;
int val1=0;
void setup()
{pinMode(ledPin, OUTPUT);
pinMode(led2,OUTPUT);
pinMode(ledcenter,OUTPUT);
candy.attach(13);
rotate.attach(12);
latch.attach(8);
spring.attach(7);
rotate.write(45);
delay(500);
rotate.write(30);
latch.write(60);
spring.write(200);
candy.write(25);
candy.write(140);
delay(500);
candy.write(25);
}
void loop()
{
valm=analogRead(0);
val2=analogRead(3);
val1=analogRead(1);
if(valm>400 || val1>400 || val2>400)
//val1=val1-60;
{if(valm>val2 && valm>val1)
{digitalWrite(ledPin, HIGH);
rotate.write(130);
delay(500);
rotate.write(145);
spring.write(50);
delay(1000);
latch.write(200);
delay(1000);
spring.write(200);
delay(500);
latch.write(60);
delay(1000);
rotate.write(50);
delay(500);
rotate.write(30);
candy.write(140);
delay(500);
candy.write(25);
digitalWrite(ledPin, LOW);
delay(1000);
valm=0;
val2=0;
val1=0;
}
else
{
if(val2>valm && val2>val1)
{digitalWrite(led2,HIGH);
rotate.write(75);
spring.write(50);
delay(1000);
latch.write(200);
delay(1000);
spring.write(200);
delay(500);
latch.write(60);
delay(1000);
rotate.write(40);
delay(500);
rotate.write(30);
candy.write(140);
delay(500);
candy.write(25);
digitalWrite(led2,LOW);
delay(1000);
valm=0;
val2=0;
val1=0;
}
else
{if(val1>valm && val1>val2)
{digitalWrite(ledcenter,HIGH);
rotate.write(110);
spring.write(50);
delay(1000);
latch.write(200);
delay(1000);
spring.write(200);
delay(500);
latch.write(60);
delay(1000);
rotate.write(40);
delay(500);
rotate.write(30);
candy.write(140);
delay(500);
candy.write(25);
digitalWrite(ledcenter,LOW);
delay(1000);
valm=0;
val2=0;
val1=0;
}}}}}
4 Comments
PeckLauros 10 years ago
MikeTheMaker 10 years ago
ptipirneni 10 years ago
MikeTheMaker 10 years ago