Candy Tossin Coffin

by MikeTheMaker in Circuits > Arduino

2986 Views, 9 Favorites, 0 Comments

Candy Tossin Coffin

mainrevised.jpg
IMG_5749.jpg

When you flip a switch, the coffin lid opens and a smiling red eyed ghost arises. The ghost flings some candy, pushes the switch back and returns to rest. Then, the coffin lid closes.

schematic.jpg
Major parts include:

4.5 rpm motor  #155821 Jameco.com
1.8 rpm motor  #176050 Jameco.com
Two shaft couplers  #162270 Jameco.com
Servo motor #358635 Jameco.com
Arduino microcontroller  #2121105 Jameco.com
Four limit switches  #275-0016 Radio Shack
One Toggle Switch  #275-652 Radio Shack
Three diodes  1N4004
Two Red LED's
Five White LED's

Wood, wire, screws
3 feet aluminum trim channel for 1/4" plywood (or something else stiff for the ghost spine)

If you choose to build without the "candy flinging arm," you can eliminate the microcontroller and servo motor (everything to the left and above the red line on the schematic).

IMG_5651.jpg
IMG_5649.jpg
Using 1" x 2" wood, assemble the base.  Top and bottom pieces are 18" long.  The widest spot is 24" wide. Use a piece of 1/4 inch wood rod and glue to attach the joint between the upper and lower pieces.

IMG_5652.jpg
IMG_5654.jpg
IMG_5655.jpg
Add 11 1/2 inch upright pieces (using wood screws and glue) to form the shell of the box.

IMG_5656.jpg
Install a cross board to support the motor, 7 1/2 inches from the end.

IMG_5658.jpg
IMG_5657.jpg
Mount the motor on the cross board.

IMG_5690.jpg
IMG_5661.jpg
IMG_5660.jpg
Drill two 3/32 inch holes in the coupling shaft and create threads for 4-40 screws with a tap.

Note that I used a yardstick for the ghost spine. This worked for a while, until (during testing) the yardstick failed to contact a limit switch and the torque from the motor split the yardstick into pieces. I suggest using some sort of aluminum channel or angle for the upright piece (I used trim channel).

Attach the shaft coupler to the spine.

IMG_5664.jpg
IMG_5665.jpg
Cut a 12 inch long section from a yardstick. Attach a piece of aluminum angle in the center and drill the angle to bolt to the "spine" of the ghost. At the end of this arm, using double sided tape, attach a servo motor.

IMG_5668.jpg
Attach this arm to the spine. (Remember, I started with a wood spine and wound up with an aluminum one--I strongly recommend aluminum).

IMG_5673.jpg
IMG_5675.jpg
IMG_5676.jpg
IMG_5747.jpg
Solder the LED's together (as shown in the schematic), then insert them in a 6" diameter foam ball. Push the end of a yardstick into the ball as a "neck." Glue (white glue) the stick to the foam ball. I used the wood neck even when I changed to an aluminum spine--wasn't sure how to glue aluminum to foam.

IMG_5679.jpg
Take an 18 inch by 6 1/2 inch (sloping at the sides) piece of 1/4 inch plywood and mount the DPDT switch in the center close to the edge.

IMG_5683.jpg
25 inches from the bottom, place another cross board.  On this board, mount one of the limit switches (in the center).

IMG_5752.jpg
IMG_5689.jpg
Mount a "switch pusher" to the spine at the right place to operate the toggle switch.

IMG_5698.jpg
IMG_5693.jpg
IMG_5695.jpg
Create another assembly using a 21" long piece of yard stick and the 4.5 rpm motor.  This will be the lid lifter.

IMG_5697.jpg
Because the yardstick is perpendicular to the base (and the motor support board is not--it is mounted to the angled side boards), the lower limit switch for the lid lifter can be mounted to the motor support board.

When working with the limit switches, I had to slightly enlarge the switch's mounting holes with a drill bit as I could not locate screws with a small enough diameter to work.

IMG_5702.jpg
Mount the upper limit switch at a point that prevents the yardstick from standing straight up.

IMG_5706.jpg
IMG_5754.jpg
Cut two pieces of wood about two inches long and mount the roller type limit switch to one side.  Run a rubber band through the roller ball and over to a screw on the second piece of wood.  By adjusting the tension and position of the rubber band (by means of screw placement and switch mounting), you can control when the switch (S3, close delay) activates.

This is an important switch in that it prevents the lid from closing until the ghost is almost at rest--but allows the lid motor to operate before the lower ghost switch disables all power.

IMG_5709.jpg
Wire things together and run a test.

When power is applied (by flipping the DPDT switch), the ghost motor is energized and the ghost begins to rise.  Power flows through D2, the lid motor and S1 causing the lid arm to rise quickly.  When the lid arm reaches the upper position, S1 opens and stops power flow through the lid motor.  The ghost motor continues moving the ghost upward (the LED's on the ghost head are forward biased and on).  When the ghost spine contacts the DPDT switch and throws it, power is reversed and the ghost motor starts to lower the ghost.  The LED's are back biased and turn off.  Although power could get through D1, the lid motor and S2, it can't get through the still open contact of S3 (close delay switch).  When the ghost spine is mostly reclined, power passes through D1, the lid motor, S2 and S3 and the lid is lowered.  S2 opens when the lid lever has reached its lower limit.  Shortly after that, S4 opens and power to the ghost motor is removed.

IMG_5717.jpg
Take a 7 inch long piece of 1/4" wood rod and wire it to the servo motor horn.

IMG_5718.jpg
IMG_5719.jpg
Drill a hole and attach a small plastic cup piece or container to the end of the arm.

Code

IMG_5714.jpg
Mount the Arduino and wire it as indicated on the schematic.


Code for the Arduino is:

#include <Servo.h>
Servo myservo;int valm=0;
void setup (){myservo.attach(5);
}void loop ()
{myservo.write(90);
valm=analogRead(0);if (valm>800) {
myservo.write(85);delay (1000);
myservo.write(80);delay (1000);
myservo.write(75);delay (1000);
myservo.write(70);delay (1000);
myservo.write(65);delay (1000);
myservo.write(60);delay (1000);
myservo.write(55);delay (1000);
myservo.write(50);delay (1000);
myservo.write(45);delay (1000);
myservo.write(40);delay (1000);
myservo.write(35);delay (1000);
myservo.write(30);delay (1000);
myservo.write(25);delay (1500);
myservo.write(20);delay (1500);
myservo.write(15);delay (1500);
myservo.write(10);delay (1500);
myservo.write(5);delay (1500);
myservo.write(0);delay (1500);

myservo.write(90);delay (30000);
}else {
  delay (1000);}
}

The arm should work as shown in the movie.

IMG_5728.jpg
IMG_5729.jpg
Build a coffin "skin" of cardboard and paint it black.

The cardboard "lid" to the coffin is attached with clear packaging tape.  This makes a simple low friction hinge.

IMG_5749.jpg
Take about a yard of flimsy white cloth and drape it over the structure, trying to stay out of the way of wires and switches.


Load the candy "hand," flip the switch and watch it go.