How you can use Arduino and 3D printing to create a scary-eyed pumpkin this Halloween
This Halloween we all love spooky, creepy, and generally ghoulish ideas. But how about making your pumpkins come to life?
I wanted to share with you how I built the pumpkin, and some of the technical aspects that went into it.
The basic concept is to control servos to randomly move plastic eyes back and forth. A similar build I saw used fake eyeballs pierced with a nail, hot-glued to short sections of PVC pipe. Since I had a 3D printer available, I decided it would be a fun project to design and print my own holders for the eyes.
- Arduino Uno or compatible microcontroller board
- Plastic eyes
- 10 servo motors
- Wires for connecting the Arduino and servos
- A small breadboard
- Paper clips
- And of course a pumpkin!
Designing the eye holders
For me, the most time consuming and most satisfying part of this project was figuring out the mechanism for holding the eyes. It would need to have the eye connected to an axis, then a way for the servo to tilt it back and forth from behind. I went through several designs. The great thing about a 3D printer is that it is relatively easy to print off an idea, hold it in your hand, and see what does and does not work well. There were many failed iterations:
The eyes I am using are hollow half-spheres. At first I designed a rod that would come out of the back of the eye so that the servo had something to move. A downside is that I didn’t want to rotate the eye very far or the viewer would see where the eye ends. It was one of those moments where I must have been thinking about it while I slept. In the morning it hit me that I could 3D print the spherical back half of the eye that would perfectly snap inside the eye! Add a hole for an axis to go through and a small protrusion for the servo to attach to, and I had spherical eyeballs.
There was also an outer ring that was designed for the eyes to rotate in. There were several variations while attempting to get the size correct, creating holes where toothpicks could attach to the pumpkin, and figuring out how to attach the servo. I used straightened paper clips as the axis connecting the eye and outer ring as well as for connecting the servo to the back of the eye. After assembly, I found a little hot glue assisted in holding everything together tightly.
I had never worked with servo motors before this project. I have however experimented with the Arduino platform, usually for blinking some lights. I was concerned about the power requirements for 10 servos, so I decided I would only move one or two servos at any given time. The program is almost trivial. I was able to use an existing library to control the servos. All the logic had to do was set a random servo to a random value, wait a small amount of time, and repeat. The source code can be found on GitHub.
Each servo has an input for signal, 5 volts, and ground. The program is using pins 3 through 12 for the servo signal lines. I used a half breadboard to wire everything up. Flash the program to the Arduino, connect the signal, 5 volts, and ground for each servo, power on the Arduino, and you should have some randomly moving eyes!
Putting this mechanism inside of a pumpkin was easy but time consuming. It involved cutting precise holes and whittling away enough of the inner skin of the pumpkin so that the eyes protrude slightly from the outside. Rotating each eye to look in different directions gives the end result a creepy look! A few toothpicks per eye keep the holders securely in place. A small hole in the back allows for a cord to power the Arduino.
I hope you feel inspired to create something of your own! If you do, please share with me. I have the 3D models and source code that I used hosted at https://github.com/aoneill01/Pumpkin.