กลับไปหน้ารวมไฟล์
scary-halloween-pumpkin-0da4b7-en.md

Project Description

In this article, you will learn how to build an interactive scary pumpkin right in time for Halloween. The only things you need are an UNO R4 WiFi, a small breadboard, a mini MP3 player, and a speaker. With these components and some code we provide later on, you will be able to control the pumpkin remotely, change the color of the eyes, and trigger an evil laughter.

This project uses Arduino Cloud and if you are completely new to it, we recommend you read Getting Started with Arduino Cloud .

Spooky Animatronics: The Scary Jack-O-Lantern

The standard candle inside a pumpkin is outdated. The Scary Halloween Pumpkin project elevates holiday decorations into theme-park-level animatronics. It sits completely dormant, looking like cheap plastic, until an unsuspecting trick-or-treater crosses its invisible tripwire!

The Ultrasonic Activation Trap

The element of surprise is entirely handled by an HC-SR04 Sonar Sensor, sneakily embedded into the pumpkin's eyes or nose.

  1. The loop() continuously fires silent ultrasonic pings into the dark yard.
  2. The baseline distance of the sidewalk might be 200cm.
  3. The State Change: A person walks up to the door. if (distance < 50cm) { WakeUpTheDead(); }
  4. The Arduino instantly snaps out of its idle state and executes a terrifying cascade of sensory outputs.

Fusing Light, Sound, and Motion

To make an effective scare, you must overwhelm the senses simultaneously.

  • The Light: Inside the pumpkin, two WS2812B NeoPixel Jewels (7-led clusters) act as the eyes. Using the FastLED Fire2012 mathematical algorithm, the eyes begin to violently flicker deep blood-red!
  • The Sound: A DFPlayer Mini MP3 Player receives a serial command: myDFPlayer.play(3);. It instantly blasts a digitized zombie scream through a hidden 3-Watt speaker.
  • The Motion: A heavy-duty MG996R Metal Gear Servo attached to a plastic linkage violently smashes the lid of the pumpkin up and down 10 times in one second!
  • After 5 seconds, the entire system resets: the lights die, the lid drops shut, the sound stops, and it waits for the next victim.

Creepy Components

  • Arduino Nano (Small enough to fit inside a hollowed-out gourd).
  • HC-SR04 Ultrasonic Distance Sensor.
  • DFPlayer Mini + 8-Ohm Mini Speaker.
  • WS2812B NeoPixel LEDs for programmable fire simulation.
  • MG996R Heavy Servo Motor.
  • An actual pumpkin (real or plastic) heavily modified with a Dremel tool.

Circuit

Connect the components according to the circuits below:

  1. 220 Ohm resistor for TX line.
  2. 10K Ohm resistor for A0 line.
  3. Connect the Diode with the silver strip towards the resistor.

Code Template

This project uses Arduino Cloud to activate the pumpkin remotely, change the laughter and keep track of how many people you have scared. To make it as easy as possible you can import a template we created for this project here. The template will automatically upload the code and create a dashboard.

Upload Sound

For the project to work correctly you need to download the mp3 files attached for this project and place them on the SD card. The files are already in the correct folder structure so you won't need to change anything. If you want to add more sounds or creaste your own it's import to name the folders 01, 02, 03, 04 and the files must be named (0001mp3, 0002.mp3, ...). That's it!

Dashboard

Once you have placed the mp3 files in the correct folder structure and uploaded the template you should see the following dashboard. If you want to change the sounds name or add more to them click the pen (edit) icon in the top left corner and change the number of each field to correspond with the number of your mp3 file.

References

DFRobot. (n.d.). DFPlayer Mini SKU DFR0299. DFRobot. Retrieved October 11, 2024, from https://wiki.dfrobot.com/DFPlayer_Mini_SKU_DFR0299

ข้อมูล Frontmatter ดั้งเดิม

apps:
  - "1x Arduino Cloud Editor"
author: "Arduino_Genuino"
category: "Audio & Sound"
components:
  - "1x DFPlayer - A Mini MP3 Player"
  - "1x 40 colored male-male jumper wires"
  - "1x Powerbank"
  - "1x 1N4007 1A 1000V Diode"
  - "1x Mini breadboard - White"
  - "1x Speaker 3 Ohm 0.5W"
  - "1x Arduino® UNO R4 WiFi"
  - "1x Micro SD Card Module (Generic)"
  - "1x Box 525 1% precision resistors - 17 values"
  - "1x Arduino Plug and Make Kit"
description: "Trick or treat robotics! Embed terrifying, motion-activated animatronics inside a Jack-o'-Lantern using ultrasonic tracking, NeoPixel flaming eyes, and MP3 screaming modules."
difficulty: "Intermediate"
documentationLinks: []
downloadableFiles:
  - "https://projects.arduinocontent.cc/f54255d0-50a9-4496-89d4-42713ac98bf2.ino"
encryptedPayload: "U2FsdGVkX183GL9aGFLSTaVsc1CrSnQxv6i/iej4mQ5bo6UXGhatq++igz1/eRKCsZWW5aB0VzYJDXqF4Ng33E3CnMUJ57hzLEgdxUW7MNA="
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/scary-halloween-pumpkin-0da4b7_cover.jpg"
lang: "en"
likes: 1
passwordHash: "4829118b955fdedfb670367db17fee4f15038f9e448f95dd94b03624b0b72b36"
price: 699
seoDescription: "Create a Scary Halloween Pumpkin using Arduino UNO R4 WiFi, Modulinos, an mp3 module, and an 8 ohms speaker."
tags:
  - "Arduino User Group"
  - "Audio"
  - "Garden"
  - "Kids"
  - "Lights"
  - "Toys"
title: "Scary Halloween Pumpkin"
tools: []
videoLinks: []
views: 7863