Skip to content

Halloween automatic pumpkin

sensorondoorMichael Seppanen shows us how to use a Basic Stamp microcontroller combined with a Park Zone Stoplight, and a hacked Epson printer to make a pumpkin pop up automatically when a trick or treater comes to the door. A nice way to use your microcontroller talents to scare some kids!

This article was submitted by Michael Seppanen as part of the “Hobby parts for articles” program. Michael receives a Modern Device Company Bare Bone Arduino Kit for this great article.

parkzoneI wanted a way to make a pumpkin pop up out of the column every time a trick or treater came to the door. I ended up using a Park Zone parking stoplight to sense the trick or treaters. I used this because they are cheaper than buying an ultrasonic sensor, easy to set up, and this was the sturdiest sensor that I had at the time that could sense people.




printerheadMy setup included the parking stoplight with a photo resistor attached to the red LED. The BASIC stamp waits for the photo resistor to return the value of the light turning on and then starts the stepper motor. The stepper motor lifts the printer head which holds a metal shaft that is attached to the pumpkin.



When the printer head reaches the end stop switch, the stepper motor holds its position and then reverses direction to send the pumpkin back down again. All of the parts to lift the pumpkin came from an old Epson dot matrix printer. I used the printer head assembly and the stepper motor that moves the printer head. The printer also had the end stop switch built in.

In very simple terms, a photo resistor changes the amount of resistance between the two leads as the light changes. This change is detectable by a microcontroller with a resistor-capacitor time circuit. The resistor in this case is the photo resistor and the capacitor is .01uF. The capacitor is filled with electricity by the ‘HIGH’ command. As the resistance changes in the photo resistor, the amount of time that the capacitor takes to discharge is measured by the command ‘RCTIME’. This process has to be repeated over and over to get multiple readings over time. In this case, the light value is read until the red LED turns on.

steppercloseupA stepper motor differs from a standard motor since the stepper motor has five or six wires coming from it as opposed to two wires. A standard motor is very easy to run, just hook up the two wires to a positive and negative of a power source and the motor turns. A stepper motor requires positive voltage to be applied to either one or two wires (depends on the stepper) and then the common voltage is cycled rapidly through the other four pins to make the shaft rotate. A stepper motor cannot be directly attached to the outputs of BASIC stamp because the stepper requires 12V to operate. I used an ULN2003 in between the outputs of the BASIC stamp and the 12V required for the stepper motor. A more in depth explanation of how steppers work can be found here and here


layout1The parking stoplight sensor is straight forward to setup. First, attach the photo resistor to the red LED with some tape and use wire to attach it to two points in the breadboard.

photosensorThe wires attach the photo resistor to the rest of RC time circuit (see the schematic for the circuit). Attach the sensor part to wherever the kids will be walking toward. I duct taped mine to the front door. To set up the sensor, push the button on the top of the stoplight to turn it on. The yellow LED will flash which means it is currently sensing where the point at which it changes to red is. Stand where you think the red light should turn on to activate the circuit. Once the stoplight stops flashing yellow, it has the distance. Walk toward the sensor a few times to make sure it activates when you want it to. If the sensor is sometimes missing you as you walk toward it, it is probably because you walked in between two of the pulses. If it is possible, try to make the sensor so it stays on green by having the sensor sense something farther away. The sensor does not sense very often when it does not see anything to save battery, so if it always sees something in the green range, it will send out pulses more frequently. The sensor also does not reactivate red after a cycle if there are objects close to it. This makes it so the circuit it is activating does not repeat over and over again until nothing is in the red zone.

Parts List with Jameco part numbers.

Part                  Jameco    Cost
ULN2003               34278     .39
1N4001                35975     .4 for 10
220 ohm resistor *(2) 690700    $1 for 100
10k ohm resistor      691104    $1 for 100
Photo resistor*       Any       $1-$2
.01uF*                15231     .67 for 10
BASIC stamp**                   $99.95

* Only these parts are needed for using the stoplight sensor without the stepper motor.
** You could use a different microcontroller, such as the Arduino chip, however the code provided works with the BASIC stamp.

BaiscstampcircuitThis schematic shows the connections for the end stop switch, stepper motor, and photo resistor circuit. Since there are many types of photo resistors, the value for sensing the red LED might be different. The DEBUG statement reads what the value of the LED is so make the value in the do while statement so that it is greater than the value.

Get the Basic Stamp Source for this project here.

Posted in Electronics Links, Microcontroller, Projects.

7 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. johnrdupree says

    Gandalf Parkerf, your idea gave me an idea. The walk leading to my door is flanked by a couple of bushes. I could use a similar rig to trigger a vibrating motor and a speaker in the bushes so when the trick or treaters approach, they get a scare from “the monster in the hedge.” Ohh, and a couple of glowing LED eyes would cap it off nicely.

  2. Chris says

    Very nice setup! I can se a lot of applications for this one. 🙂

  3. Michael S says

    Here is a video of it:

    note: I made this video before I adjusted how fast the strobe light went, so the strobe looks a little strange.

  4. sveden says


    Nice idea, BTW. 😉

  5. Gandalf Parkerf says

    Very cool.
    I might use some of this for an idea which I have had for a long time. I have a large rose bush which is determined to grow across the path leading up to the front door. I have been thinking of putting in a motion sensor to spot people coming up the walk, and then motor a line which would constrict around the plant pulling it back so that people can pass easily.

  6. Michael S says

    A pressure switch may be easier to hookup, but you might need more than one so that it doesn’t matter what path the people take (eg. they walk on the left vs walking on the right of the mat). Also, a pressure switch would have to be placed further away from the door in order to have the effect occur at the proper time. I used the ultrasonic sensor because the sidewalk leading to my door is wide (I would probably need more than one pressure sensor) and the placement of the sensor is close to the column. Depending on your setup, it may make more sense to use a pressure switch.

    Heres a picture with the complete setup (sidewalk, path leading to door, etc.):

  7. Bill Coleman says

    I like the effect, but it does seem very complicated though. Wouldn’t a pressure switch under a door mat or runner be a lot easier?