Introduction: Candypult--Computer Controlled Candy Catapult

About: I am an author and a maker. My current project is Santa's Shop. I'm working on a science fiction type book--more later. @EngineerRigsby


This project is designed to appeal to people who like candy and are lazy--a large group (in more ways than one?).

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:

Let's start with the parts list and schematic.

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:

Start with a 17" x 18" x 1/2 inch piece of plywood.  Paint it red.  Cut yellow circles from a craft foam sheet and glue them randomly to the board (leaving spaces where things will be mounted).

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:

Insert a servo motor into the rotating base plate.

Step 4:

Drill holes and secure the servo with 2-56 x 1/2" machine screws.

Step 5:

Add a lazy susan bearing (4 inch) to the base using 4-40 x 3/4" machine screws.

Step 6:

Bolt the ends to the rotating base.

Step 7:

Insert the servo horn onto the servo motor on the rotating base.  Drill two holes through the base to match where #4 x 1/2" wood screws will be used to fasten the servo to the wood base.

Step 8:

Be certain that the servo and horn assembly is in one of the extreme positions and is capable of rotating where you want it to go before fastening screws through the holes.

Step 9:

Secure wood base to rotating platform using (4) 6-32 x 1 1/2" machine screws. Attach the catapult guide using wood screws.

Step 10:

Add the catapult stop using wood screws.

Step 11:

Insert a 1/4" diameter wood dowel through the catapult arm.

Step 12:

Secure the spring to the catapult lever using wire (I used magnet wire).

Step 13:

Add a 3" long bolt to the stop tower.

Step 14:

Attach the other end of the spring to the servo horn extender (printed piece) using magnet wire.

Step 15:

Attach the servo horn extender to the servo horn using magnet wire.

Step 16:

Place the high torque servo motor in a motor base (printed) and fasten that to the catapult board with machine screws.

Step 17:

Attach the latch servo to the latch servo mount (printed) and screw the assembly to the catapult base.

Step 18:

Drill a 3/8" hole in the catapult wood base.

Step 19:

Using wire guides (printed) bring the servo cables through the wood base.

Step 20:

Take a servo horn and the spring from a ballpoint pen. Attach the spring to the horn using magnet wire--this extends the reach of the servo "candy pusher."

Super glue the servo motor holder to the candy tower.

Step 21:

Using the "Candy" base and the adapter (printed), friction fit the candy tower assembly to the "Candy" support base.

Step 22:

Things may get messy, just keep working.

Step 23:

Add the "anti-escape guide" to the candy tower (friction fit).

Step 24:

Take apart your remote control toy.

Step 25:

Save the spare pieces for a future project.

Step 26:

There should be two wires from the battery, one to the antenna, and four to the motors controlled.

Step 27:

Slide the antenna through the printed antenna holder.

Step 28:

Place the receiver electronics on the electronics mount (printed) and attach it and the antenna to the main plywood board.

Step 29:

Wire everything together according to the schematic.

Note the use of servo extension cords and a wire guide to protect the wires that move through the rotation process.

Step 30:

Add the power supplies, software and Hershey's miniature candy and give it a try!

Software:

#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!

If you're here, you must want to do things the hard way.  Let's adapt the machine to respond to the clap of hands--left, middle or right.

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:

This requires amplifiers; I used a simple one transistor model.

Microphones are Jameco #320179

Step 33:

Sound has to be picked up with an emphasis on direction.  I should have made the cones larger, shielded them more from stray sounds and mounted the microphones on felt rather than the plastic ring.

Step 34:

I mounted the microphones at the top of a 16 inch high tube.

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:

#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;

}}}}}

Remote Control Contest

Participated in the
Remote Control Contest

Toy Contest

Participated in the
Toy Contest

3D Printing Contest

Participated in the
3D Printing Contest