Introduction: Motion Sensing Arduino Halloween Pumpkin

The goal behind this Instructable was to create a cheap, and easy way to make Halloween decorations at home without any prior skill or any fancy tools. Using easy to source items from the internet, you too can make your own simple and personalised Halloween Fright Night.

This build is based on the use of a 3D printer (okay, one fancy tool), however, this isn't a necessity, as the instructions to follow can still work with a real pumpkin that you have lovingly handcrafted or a shop bought Halloween decoration that you have butchered, sorry, reverse engineered. You could pretty much choose to animate anything you can find as long as you can access inside with at least enough space to store the kit.

Happy Haunting


To build this Halloween Pumpkin you will need the following:

  • A hollow decoration (preferably a pumpkin to fit with the theme of this Instructable)
    • If you do have access to a 3D printer we have attached the .stl for the pumpkin which has been split into three sections for ease of printing.
  • An Arduino Nano (with pre soldered headers) - we used an Elegoo Nano to save costs
  • A DFPlayer Mini MP3 Player
  • A HC-SR501 PIR Motion Sensor
  • A small breadboard
  • A Micro SD Card
  • Selection of Jumper Cables
  • A 1k Ohm Resistor
  • A Speaker - we used 1 x 1.5" 40 Ohm 3W speaker (EK1794)
  • An audio file - preferably high pitched screaming or deep laughing (or if you really want to scare people...coughing and sneezing) we used a WAV file from here
  • Super Glue - to bond the Pumpkin together (if 3D printed)
  • A USB Mini-B to USB A Cable

Step 1: Prepare the Enclosure

Either get carving or printing. Feel free to farm this activity out to someone else in your household.

If you are carving, please be careful and feel free to be as creative as you possibly can.

If you are printing, tweak the settings to your own preferences but we would recommend using a brim.

Once the parts have been printed you need to bond the top half to the bottom half. We have added tabs to hopefully provide some assistance whilst aligning the parts. Do not glue the Lid in place, as with any pumpkin this will be your access.

Whilst we allow the glue to set, lets start assembling the electronics.

Step 2: Assemble the Electronics

In keeping with the simplicity of Arduino, we kept the assembly as plug and play using jumper cables and a small breadboard. Check out the system layout and connect each of the required pins as shown.

The aim of the system is as follows

  1. Motion sensor is triggered by our unsuspecting victim
  2. A HIGH signal is sent through to the Arduino
  3. The Arduino passes the command onto the DFPlayer
  4. The DFPlayer retrieves the stored audio file from the SD card and sends it on its merrily way out of our speaker.
  5. Let the screaming and crying commence.
  6. After our victim has either vacated the scene or just stands still long enough in awe (usually at this point retrieving sweets from a bucket; it is Halloween after all), the motion sensor switches back to a LOW signal, returning the system to its calm and armed state.

In simpler terms, motion sensor input and sounds output.

To assemble:

  1. Place the Arduino Nano and the DFPlayer Mini onto the breadboard
  2. Using jumper cables connect the:
    1. Nano 5V to 5V Rail
    2. Nano GND to Ground Rail
    3. Nano D11 to 1k Ohm resistor
    4. 1k Ohm resistor to DFPlayer RX
    5. Nano D10 to DFPlayer TX
    6. Nano D9 to HC-SR501 OUT (middle pin)
    7. HC-SR501 VCC to 5V rail
    8. HC-SR501 GND to Ground Rail
    9. DFPlayer VCC to 5V Rail
    10. DFPlayer GND to Ground Rail
    11. DFPlayer SPK_1 to Speaker +
    12. DFPlayer SPK_2 to Speaker -

Step 3: Upload the Code

To upload the code, you first need to download and install the Arduino IDE.

Information on the DFPlayer can be found here.

You can find the Arduino Code below. Simply download it and store in a relevant folder before importing it as a new sketch.

Ensure you have the SoftwareSerial and DFRobotDFPlayerMini Arduino libraries installed.

Step 4: Assemble the Final Product

With the pumpkin assembled or carved, the electronics plugged together and the code installed, its time to simply place all the components inside the pumpkin. Lower the speaker in first, aligning it with the speaker grill in the base and gently place the rest around it.

Pumpkin Challenge

Participated in the
Pumpkin Challenge