Candypult--Computer Controlled Candy Catapult

by MikeTheMaker in Living > Toys & Games

4909 Views, 45 Favorites, 0 Comments

Candypult--Computer Controlled Candy Catapult

cover1.jpg
 

 

 
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)



 


 

schematic1.jpg
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

catapult06.jpg
catapult05.jpg
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.

catapult01.jpg
Insert a servo motor into the rotating base plate.

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

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

catapult07.jpg
Bolt the ends to the rotating base.

catapult48.jpg
catapult49.jpg
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.

catapult51.jpg
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.

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

catapult11.jpg
Add the catapult stop using wood screws.

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

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

catapult19.jpg
Add a 3" long bolt to the stop tower.

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

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

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

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

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

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

catapult28.jpg
catapult52.jpg
catapult25.jpg
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.

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

catapult44.jpg
Things may get messy, just keep working.

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

catapult55.jpg
catapult58.jpg
Take apart your remote control toy.

catapult57.jpg
Save the spare pieces for a future project.

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

catapult60.jpg
Slide the antenna through the printed antenna holder.

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

catapult66.jpg
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.

catapult63.jpg
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;

    }}

 

 

EXTRA CREDIT!

catapult41.jpg
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.

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

Microphones are Jameco #320179

catapult34.jpg
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.

catapult39.jpg
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;

 

}}}}}