Automatic Munching Pumpkin

by athiel217 in Circuits > Arduino

155 Views, 0 Favorites, 0 Comments

Automatic Munching Pumpkin

For halloween I created this automatic munching pumpkin, it opens and closes it's mouth using an arduino and servo. My inspiration was to create a fun and scary decoration that incorportates moving parts.

Supplies

Pumpkin:

The pumpkin I used was quite small and wider than tall. The diameter was approximately 20cm.

Electronics:

Arduino UNO R3

Servo from a hummingbird robotics kit (FEETECH FS5103B Servo), a stronger servo would benefit, but you would have to customize the 3D printed design to fit

A cable to connect the Arduino to USB

Jumper wires to connect Arduino to Servo

Any computer to program the arduino on

3D printing:

Used a 3D printer (Bambu Lab P2S) to print supports and gears used in the project

Tools:

For carving, dry erase marker, knife & spoon

Screwdriver, puzzle saw (for cutting plywood)

Superglue (Hotglue works, but comes apart after some time)

Other:

2in narrow fixed pin hinge from everbilt (1 hinge + 4 screws)

Three 1.5in screws

Two cutouts from a sheet of plywood, sized to your preference, used as the platform for the pumpkin (Mine were 0.5cm x 20cm x 20cm)

Preparing to Cut the Pumpkin

I started by drawing dots around the pumpkin all approximately the same height.

I adjusted them until I got a nice flat line all around. I drew the teeth on the pumpkin, largest at the front and 2 on the sides (to hold the pumpkin in the same position when cut).

Cutting and Gutting the Pumpkin

Once you've cut all the way around with a knife, it won't want to open. The guts inside hold the top and bottom together.

First, make sure the knife passes easily through every part of the pumpkin, then pull apart the two halves (You will have to use alot of force, you can try and cut the guts to make this easier if you want). Once you get them apart, simply gut the pumpkin.

Setting Up the Arduino & Servo

Materials: Arduino, Servo, USB-Arduino Connection, Jumper Wires, Computer

  1. 3D printed attachment on the servo (in the video) was only to test connections

1: Attach the Arduino to the Servo using 3 Jumper Wires

WIRE 1 // PIN 9 arduino - WHITE wire on the servo

WIRE 2 // 5V arduino - RED wire on the servo

WIRE 3 // GROUND arduino - BLACK wire on the servo

2: Attach the Arduino to the computer using the cable

Plug the square end of the wire into the arduino, attach the USB to your computer

3: Download the Arduino IDE app on your computer

Go to this link to set it up on your computer

Continue to the next step once you have the app ready on your computer

4: Upload code to the Arduino

Make sure the Arduino IDE app has your attached Arduino selected in the top

Paste this code into the app (if you did not plug the jumper wire into pin 9 of the arduino, change SERVO_PIN to the pin you chose)

#include <Servo.h>

const int SERVO_PIN = 9;
int SERVO_DIR = 0;

Servo servo;

void setup() {
servo.attach(SERVO_PIN);
servo.write(0);
}

void loop() {
SERVO_DIR = 180 - SERVO_DIR;

servo.write(SERVO_DIR);

delay(2000);
}

Click the "Upload" button at the top left while everything is still plugged in (circle with an arrow pointing right)

The servo should move (takes a moment to start up) aslong as the arduino is plugged into power

Decreasing Weight & Adding Hinge

Carve out the top half of the pumpkin as much as possible, keep it strong enough that it holds together but is very light. I would suggest carving out the back less and focusing more on the very front.

Attaching the hinge, make sure it will open and close the pumpkin as straight as possible, simply screw it in without pilot holes, this should hold for minimum a few days due to rotting. (Mine held for 4 days before i had to change the angle the screws went in)

Setting Up the Opening Mechanism

Below you can find the .gcode (ready to print), or the .3mf if you want to edit it further (Such as if you use a different sized servo). 3D print and remove supports carefully (may have to use adhhesive on the printer bed if not sticking).

The image is the same exact mechanism, but the "table" has been slightly modified since for easier construction.

1: Putting the gear attachment onto the servo, it will not go on easily, the method I used was to use another object to hit it in. The reason behind this is to hold it really tight, by creating it too small, you carve out the shape of the servo's teeth in the 3D print when putting it on the first time.

2: Place the two pieces of wood under the pumpkin, resting the servo in the position it will be held at. (View images for reference)

3: Placing the "table" looking 3D part ontop of the servo, should fit very nicely around it. Stick the legs into the pumpkin until the screw holes are touching / almost touching the pumpkin base.

4: Screw in the "table's" designated screw holes, through the pumpkin and into the wood, if you screw too far it can go through the wood and scratch surfaces below.

5: Rotate the servo using your hand counter clockwise till facing fully towards the back.

6: Place the large gear (axle resting on the table) with the teeth meshed into the servo's gear, with the arm resting on/as close as possible to the bottom of the pumpkin's teeth. Mark where the axle goes and remove the large gear.

7: Glue down (superglue works best for permanent adhesion) the horse-shoe shaped pieces to hold the axle in place. Make sure it fits perfectly, do not superglue before you've double checked everything. If you don't do it properly, it will either not fit from little space, or will skip teeth on the gears from being too far away.

8: Once you've tested the gear fits properly and you want to attach the large gear in permanently, use the axel end piece and push it in (or glue if it falls out)

Finished!

Now that you've finished your pumpkin, you can plug it in using an extension cord and show it off to all your neighbours! I put candy inside the pumpkin (aswell as giving it out by hand) and tons of kids loved it.