Halloween Pumpkin With a Moving Animatronic Eye | This Pumpkin Can Roll Its Eye!




Introduction: Halloween Pumpkin With a Moving Animatronic Eye | This Pumpkin Can Roll Its Eye!

In this Instructable, you will learn how to make a Halloween pumpkin that terrifies everyone when its eye moves.

Adjust the ultrasonic sensor's trigger distance to the right value (step 9), and your pumpkin will petrify anyone who dares to take candy from your house!

In the above video, you will see a demonstration of the movements that this eye is capable of. The first 2 clips show the random twitchy movements that the eye can be programmed to do, and the 3rd and 4th clips show how the pumpkin can roll its eye in the same way that a human might when annoyed.

This was a Halloween rush-project for me, so I took most of the pictures after my project was done. This was also why rather than buying a universal joint for the eye, I designed a joint that doesn't require any hard-to-source non-3D printable parts. This is why you can complete this project in just one day!

Here is the link to the folder with the necessary files.


1. 1x Arduino Nano (or similar)

2. 2x SG90 9G Micro Servo

3. 1x Pumpkin (at least ~20cm in diameter)

4. 2x Wood Skewers

5. 4x AA Batteries (or a similar 5V setup)

6. ~Jumper Wires (or 1m of 22 AWG Wire)

7. ~15cm Bend-and-Stay Wire (paper clips work fine)

8. A Few Markers or Paint (red, blue, and black colors)

9. White (PLA) Filament


1. 1x HC-SR04 Ultrasonic Distance Sensor

2. Soldering Iron and Solder

3. Electrical Tape

Step 1: 3D Print the Files for the Eye Mechanism

First, you will need to 3D print the attached STL files in white PLA filament.

Download the "2020_Halloween_Pumpkin_With_Moving_Animatronic_Eye_MASTER" folder. This folder has all of the 3D and code files, as well as links.

The 3D files are already oriented in the direction that best suits 3D printing. It is important to note that "OuterEye" will need to be printed with the round side down, and "InnerEye" with the flat side down. Although this means you will need supports for the Outer Eye, you should not print either of these files in the opposite orientation. This is because the inside of the Outer Eye and the outside of the Inner Eye needs to be as smooth as possible to prevent the eye mechanism from binding.

I printed the Outer and Inner Eye parts at a 0.1mm layer height because that would reduce the stairsteps effect, thus resulting in a smoother surface. I printed the other files at a 0.2-0.3mm layer height.

When the project was ready to be displayed, I placed a flashlight directly behind the eye mechanism so that the eye would glow. If you want to achieve this glowing effect, I would recommend using low infill and perimeter settings for the Outer and Inner Eye parts.

Step 2: Basic Post Processing for the 3D Printed Parts

The only part that needs work is the Outer Eye.

Because supports were used on the visible side of the Outer Eye, the surface will be a little rough. Using ~120 – 240 grit sandpaper, smooth out the surface until it looks good (I know no one likes sanding, so just smooth it out until you are happy with the look, or completely skip this step).

Step 3: Make the Eyeball More Realistic

After sanding the eyeball to a relatively smooth finish, I used red, black, and blue permanent markers of varying widths to add an iris and blood vessels to the eye. (You can tell that I am no artist and that this instructable is not going to cover how to make a hyper-realistic eye).

I imagine you could make a hyper-realistic eye by priming and painting the eye, but I didn't bother with any of that; No one will see those finer details when your pumpkin is placed in the dark!

Step 4: Form the Linkages

Now that you have all of the 3D printed parts ready, you are almost ready to assemble the mechanism. You just need to bend 3 pieces of bend-and-stay wire (I just used a standard paperclip) to form the linkages.

Using needlenose pliers, bend the wires until they have the same dimensions as the above picture.

Step 5: Assemble the Eye Mechanism

Now you have everything that you need to assemble the eye mechanism.

1. The first step is to glue the "25mmEyeConnector" to the inner eye and the side of the base.

2. Next, glue 2 "BaseSkewerMount1"s to the bottom of the base as shown above. You will need to be able to slide a standard wood skewer through the holes in the skewer mounts, so drill out the holes if you need to.

3. Mount the 2 SG90 Micro Servos to their slots in the base and secure them with 1 screw per servo. These servos should both be aligned with their wires coming out of the open side of the slot.

4. Connect the 3 links to the outer eye and the servo horns. The largest link goes on the top hole of the eye, and the bottom hole is left unconnected. Then, slide the outer eye over the inner eye. See the above pictures.

DO NOT CONNECT THE SERVO HORNS TO THE SERVOS YET. This is because the servos need to be homed, first (explained in a later step).

Step 6: Wire Everything Up

We need to wire things up before we can home the servos and connect the servo horns.

If you are using the Arduino Nano case files that are included:

1. Desolder the 6 male header pins from the top of the Nano. They will get in the way of the case's lid, but the 2 rows of male headers of the bottom on the Nano are designed to be accommodated, so they can remain.

2. Push the board into the lower portion of the case, guiding the 2 rows of headers through the slots in the bottom of the case until the board sits flat.

3. Connect the horizontal-axis servo's (servo mounted lower and closer to the eye) signal wire to pin D8 on the Arduino Nano.
4. Connect the vertical-axis servo's signal wire to pin D9 of the Nano.

5. Connect the trig pin of the ultrasonic sensor to pin D3.

6. Connect the echo pin to pin D2.

7. Finally, connect two wires to the Nano's 5V and GND pins.

8. Wire the Nano's, horizontal-axis servo's, vertical-axis servo's, and ultrasonic sensor's power wires in parallel to the AA battery pack (I glued 2 2SAA cases together and wired them in series to make a 4SAA case). Make sure a common ground is established. See the completed circuit and schematic, above.

9. Wrap the connections with electrical tape. This helps to make the connections water-resistant while also minimizing the chance of loose connections.

4. The lid for this case features a button extension so that you can push the reset button without needing to open up the case. Before closing the lid of the case, push the "buttonExtender" into the hole, with the thinner side sticking out, and snap the lid into place. I've found the button useful for quickly stopping the program, but if you don't care about accessing the reset button and don't mind having a small hole in the lid, skip this step.

Step 7: Home Your Servos and Finish the Eye Mechanism

Servos move from 0 – 180º, so it is important that the middle of the servo's range in motion constitutes the middle of the eye's range in motion.

You need to center your servos to 90º before connecting the servo horns, and this can be done by uploading the "Home_Servos1" sketch to the Nano. This sketch will make it so that when a servo is connected to any digital pin, the servo will be commanded to go to 90º.

With the servos centered, you can carefully press the servo horns onto their respective servos. See the last of the above photos for the approximate angle the servo horns should be at when the servos are centered.

Secure each servo horn with one screw through its center.

Step 8: Carve Your Pumpkin and Mount the Eye in the Pumpkin

Carve a pumpkin with what-ever you want! This is not an instructable of how to carve a pumpkin, so I will skip over most of those details.

The only important thing about your pumpkin carving is that the eye hole must not be too high, or the servo links will be obstructed by the 'ceiling' of the pumpkin.

When making the eyehole, gradually make the eyehole larger until the eye can pop out by just the right amount. You should chamfer the inside of this hole, so the diameter of the side of the hole inside of the pumpkin is larger than the side of the hole outside the pumpkin.

To mount the eye mechanism:

1. Cut a skewer short and insert it into one of the mounts that we glued to the bottom of the base. Now, hold the whole thing inside the pumpkin so that the eye is in the right place, and push the short skewer through the inside of the pumpkin until it pokes out of the other side. This is how you will accurately mark the placement of the skewers, rather than just jabbing a skewer from the outside of the pumpkin and hoping that you reach the right spot. Repeat for the other skewer mount and the other side of the pumpkin.

2. Now you can push 2 skewers from the outside of the pumpkin, through the skewer mounts, and then back out the other side of the pumpkin. Now the eye mechanism should be mounted securely enough. See the above pictures. (You will notice the black tape that I used when the glue failed).

3. I placed the electronics and batteries in a plastic bag to keep them clean and set this inside the pumpkin.

4. Cover the lens of an electric flashlight with translucent yellow plastic, and place this flashlight directly behind the eye so that the eye will glow in the dark. In order to mount the flashlight level with the eye, I set it on top of a jar.

I think the best way to use the ultrasonic sensor would be to extend its wires so that you can place it somewhere next to the pumpkin, rather than on the pumpkin. I decided the sensor wasn't necessary for my application, so I skipped the sensor, leaving four extra wires. The same code will work regardless of whether or not you have an ultrasonic sensor connected, and no parameters need to be changed.

Step 9: Upload the Code

You're almost done!

Download the code, and open the Arduino IDE.

I will walk you through the settings of the code that you might need to adjust:

int Repeats = 40; // define the number of eye movements to do before waiting for another sonar ping

Adjust this value if you want the eye to repeat its movements greater or fewer times after the ultrasonic sensor is triggered. As I said earlier, using the ultrasonic sensor is optional, and does not require any different code. Just leave this setting untouched if you do not want to use an ultrasonic sensor.

#define hLeftLIMIT 55
#define hRightLIMIT 110
#define vTopLIMIT 6
#define vBotLIMIT 155

These values determine the end stops of the servos and prevent the mechanism from binding. I created the rollEye function mainly to test the max range of the servo's motion, so run the rollEye function and adjust these values if necessary.

#define hServoCenterTrim -3
#define vServoCenterTrim -13

These values allow you to precisely set the home position of the eye for when the pumpkin is waiting for the ultrasonic sensor to trigger again.

const int hServoPin = 8; // define the pin to connect the horizontal servo to
const int vServoPin = 9; // define the pin to connect the vertical servo to

These lines of code define the pins to assign the servos to.

const int ultrasonic1[] = {3, 2}; // defines trig and echo pins, respectively

This line of code creates an array that tells the program which pins the ultrasonic sensor is connected to.

const long triggerDistance = 1000; // set the max distance (mm) before the ultrasonic sensor is triggered

This line of code sets the maximum distance until the ultrasonic sensor is triggered and the function is called.

const byte whatFunctionToCall = 1; // (0-1) tells the program which function to call
// rollEyes = 0
// randomTwitching = 1

These lines of code allow you to chose if you want the pumpkin to roll its eye, or to move in a random, jittery fashion. The value must = 0 or 1. If the value = 1, the program will execute the randomTwitching function. If the value = 0, the program will execute the rollEye function. If the value ≠ 1 or 0, the program will not execute any function.

Step 10: You're Done!

And with those simple steps completed, you've just built your own pumpkin with an animatronic eye!

Please leave a comment if you have any questions or would like to provide feedback.

Halloween Contest

Participated in the
Halloween Contest

1 Person Made This Project!


  • Robots Contest

    Robots Contest
  • Pumpkins & Gourds Speed Challenge

    Pumpkins & Gourds Speed Challenge
  • Organization Contest

    Organization Contest



11 months ago

NICE! I really like the anxious, twitchy nature. Inspired design and execution.


Reply 11 months ago

It is really nice!! It should be in a horror movie!


Tip 11 months ago

i did it


11 months ago

Epic! Kinda looks like a pumpkin-coloured Cacodemon from the Doom series, with a great beady, twitchy eye, bulbus body, and such a smirk. 0 : ]

Nice job fitting the dual-servo mechanism to fit in there, too. Spooktacular all around!


11 months ago

Woah. That's a creepy pumpkin.