Using a PIR sensor, the pumpkin senses motion and when triggered, plays a WAV file from a microSD Card while flashing an internal light, causing an eerie glow inside. You can place this project on your porch or in your yard on Halloween night and scare trick-or-treaters. Position the pumpkin in a path where trick-or-treaters come to your door, preferably a dark location. It looks like an ordinary pumpkin until it plays your preset sound file at your preset volume. This project could also be used in a fun-house setting.
To build the Halloween Pumpkin Project start with the pumpkin itself. It can be a real pumpkin or a plastic one. The one I used was plastic, and I got a few of these at my local Walmart for $4.99 each (See Figure 1).
These each had a 120VAC light bulb inside that would light up when the cord was plugged into an outlet and the cord switch was turned on.
Building the Pumpkin
Figure 2 shows what the internal light looked like when removing the base from the first pumpkin. Not only did I remove the light and cord, but I had to remove the molded base for the old light as well. A Dremel tool was used to remove the extra plastic.
Figure 3 shows some automotive marker lamps, which can be purchased at any auto parts store. These make a great internal light that can run off the batteries that power the pumpkin. You could also use a high-intensity LED, however, the filament bulb brightens and dims more slowly, giving a better glow effect with less flicker. You can even add a small capacitor in series with the bulb to slow things down a little more.
The speaker covering the lamp a little was intentional so the light appears more reflective and less direct (being seen through the holes in the pumpkin). The speaker I used gave ample volume for the project.
Once the lamp and speaker are mounted to the base and the wires run down through you can reassemble the pumpkin.
There’s not enough room inside to really hold the control board and power supply so running the wires out the bottom lets us mount the pumpkin onto a project enclosure that holds these items.
Next complete the Propeller Project Board USB by soldering the microSD Card Holder to the back side of the board. Once this is done you will need to connect the pads for the 4 signal lines to the I/O pins that will be used by the code. You can find these connections in the schematic diagram along with the details of the connections for the PIR Sensor, Audio Amplfier, Speaker and FET. Figure 7 shows a picture of my board.
As you can see, I mounted the LM386 Amplifier IC in a socket to make changing it out easy if I needed to. I had a set of PCB mount terminal blocks in a junk drawer so I used them to connect the speaker and bulb. The FET was also able to be mounted in the proto board area on the Propeller Project Board USB. I mounted a 3-pin header in the bottom left corner to connect the PIR sensor. I used this connection method so I could easily disconnect the PIR sensor from the board. The FET is on the right side and the 10K pull-down resistor above it prevents it from turning on at startup when the gate would be floating.
This is a simplified schematic in that it only shows the connections to the components you’re adding to the Propeller Project Board USB. It does not include all the components that are a part of that board. There is a much larger (higher resolution) schematic in ZIP file at the link below.
In Figure 8 you can also (barely) see the microSD card below the USB connector. The microSD card must be formatted in FAT32 and have your WAV files copied to the root directory. In the code I am playing “4.wav”, which was one of 5 WAV files I copied to the card to test for use in this project. You can find free WAV files online in many categories, including Halloween. I wasn’t able to distribute the ones I used. In Figure 8 you can also see a red wire running from the positive voltage input over to the optional power switch. I didn’t run a ground terminal because I am using the Li-ion Power Pack and it is connected via standoffs to the control board providing a common ground.
A Suitable Enclosure
I decided that all of my project enclosures were too small to hold the pumpkin stable so I grabbed a 2-pack of Rubbermaid Take-Along containers for <$3.00 and mounted the control board under the inside of the lid. The PIR sensor was mounted in the bottom section and secured with some bell wire.
Once the lid is placed on the bottom section you have a stable platform for your pumpkin and the electronics are protected. It doesn’t really matter what you use, but you’ll want to choose an option that can hold the electronics and the pumpkin itself, as well as provide a place to mount the PIR sensor.
The Rubbermaid container is a good height to hold the pumpkin up so you can put a “cape” around it. The cape serves to hide the storage container, electronics and PIR sensor. When power is applied the pumpkin may immediately respond to motion from you. This is because the PIR sensor usually false triggers on power-up.
Place the pumpkin in a location where people will walk by it and trigger it. It should also be dark so the glowing from the internal lamp can be easily seen lighting up the inside of the pumpkin. The code is written so that each time the PIR sensor is triggered it will wait 6 seconds before checking again to give it a chance to settle. This should prevent it from going off constantly. If you want to make it wait longer just change the constant for the delay to the number of seconds you want it to wait and download the updated code to the board.
The volume setting is one thing you will have to experiment to get right. Valid values range from 1-100, but the exact level you want will also be dependent on your speaker size, position inside the pumpkin, etc. I positioned my lamp behind the speaker so it would shine up and back, illuminating the inside of the pumpkin, but not be seen from the front through the openings.
If you would like to change any of the I/O pin assignments used due to placement of components on your board, just be sure to reflect the change in the constants section of the code. This project is completely expandable and easy to modify. There is room on the board to add more sensors, etc.
Below is the parts list for this project. As is typical, many parts are no longer available from Parallax. The ones I can find on the site have part numbers next to them. You can find schematics and source code at the download link below.
- Propeller Project Board USB (#32810)
- microSD Card Holder, SMD, Push-Pull (#452-10017)
- 1 GB microSD Card (You don’t need a large card for a few WAV files)
- PIR Sensor (#555-28027)
- 10″ Extension Cable with 3-pin Header
- Li-ion Power Pack Full Kit
- (2) 10K ¼W Resistors (R1, R2)
- 1 µF Tantalum Capacitor (C1)
- 0.01 µF Ceramic Disc Capacitor (C2)
- 220 µF Electrolytic Capacitor (C3)
- LM386 Audio Amplifier (U1)
- 8Ω Speaker (SP1)
- IRL520 MOSFET (Q1)
- 12VDC Lamp (LP1)
- 22 Gauge Solid Wire
- Toggle Switch (SW1)
Two Heads Are Better Than One
Here’s a quick modification that will trigger two pumpkins when either one senses motion. This is great if you have two pumpkins, one on either side of your porch and you want them to both trigger when either sees motion. By building two pumpkins, adding an XBee Module to each one, and making a simple code change, the pumpkins will now trigger together when either senses motion. Optionally you can disable one, making the other the master so that one always triggers both. Two identical built Halloween Pumpkin Projects are required for this expansion project.
What Else Is Required
- (2) Completed Halloween Pumpkin Projects
- (2) XBee Adapter Board (#32403)
- (2) XBee Wireless Module (Such as #32416)
- ¼” Standoff (for mounting adapter board)
- XBee USB Adapter Board (#32400) (only if you need to configure your XBee)
Connecting The XBee Module
To add XBee capability to your two Halloween Pumpkins, start by getting access to the Propeller Project Board. If you’re adept with a soldering iron, you may be able to get away with just removing the Li-Ion pack to get it out of your way. If not, or you’re not sure, just remove the Propeller Project Board completely from the project temporarily so you can attach four wires as shown below.
These wires connect as follows:
GND (Black) on the QuickStart header to VSS on the XBee Adapter Board.
3.3V (Red) on the QuickStart header to VCC on the XBee Adapter Board.
P26 (Blue) on the QuickStart header to DOUT on the XBee Adapter Board.
P25 (Yellow) on the QuickStart header to DIN on the XBee Adapter Board.
Refer to the schematic if needed, but note that the schematic symbol is for an XBee Module, while the connections in Figure 12 are for the XBee Adapter Board, so the ground is PIN 1, rather than PIN 10. This is because you’re not connecting directly to the module.
As you can see in Figure 13, we use the first 4 holes on one side of the XBee Adapter Board.
Now we can re-install the boards and secure the XBee Adapter Board to the Li-Ion Power Supply. In my case I removed one of the screws holding the board and replaced it with a 1/4″ Hex Standoff and the used the screw to secure the adapter board to the standoff, as shown in Figure 14.
Once the XBee Adapter Board is secure, you can install your XBee Module (See Figure 15). The XBee Modules shouldn’t require any configuration, however if you wish to configure them or customize their settings, you should do that using the optional XBee USB Adapter Board prior to installing them.
Master / Slave Option
There is one optional thing you can do when putting the pumpkins back together. As mentioned previously, if you only want one pumpkin to be a trigger for motion, then on the other you can jumper a wire between the GND and signal pins of the PIR header as shown in Figure 16.
What this will do is disable the motion sensing for that pumpkin, making the other one the trigger / master. This connection should be made on the slave unit only. Be sure to jumper the correct pins! Do not connect the middle (power) pin. You want to connect the PIR GND pin to the PIR signal pin. This will keep it low. Note: The PIR is disconnected in this configuration. The PIR should be connected on the triggering (Master) unit.
Load the code onto the Propeller Project Board USB and set your pumpkins up. If you’ve left the PIR sensor connected on both pumpkins, then when either of them senses motion, they will both play their sound file.
Figure 17 shows the XBee Module installed and everything put back together. The XBee module being upside down does not affect operation in this project.
This project could be easily adapted to Halloween props other than pumpkins. The concepts could also be used to synchronize other Halloween props to each other. You can always get creative with this project and use LEDs or NeoPixels instead of the 12V lamp. You could also add more sounds and rotate the SFX. You could add motion. There are plenty of available cogs and I/O pins left for expansion.