Animated Spider Trap With Sound
by eighteen18 in Circuits > Arduino
562 Views, 8 Favorites, 0 Comments
Animated Spider Trap With Sound
This Halloween, bring your decorations to life with an Arduino-powered spider trap!
Once someone walks underneath the trap and sets off the motion sensor, a realistic-looking spider will drop down, and a spooky sound effect will play to frighten your victim!
This guide covers each step, from 3D printing to wiring, to help you create a heart-attack-inducing Halloween decor!
Supplies
To begin, you'll need the following things:
Electronics:
- Arduino UNO (or similar board, I used an Arduino Mega)
- 5V Stepper Motor with ULN2003 Driver
- DFPlayer Mini MP3 Module
- PIR Motion Sensor
- Speakers (2 small speakers)
- Amplifiers (2 small amplifiers that are compatible with the speakers)
- Small Breadboard and Jumper Wires
- 1kΩ Resistor (for the RX pin on the DFPlayer Mini)
- 1000μF Capacitor (to stabilize power to the DFPlayer)
Other Parts:
- Realistic Toy Spider
- Fishing Wire
- 3D Printer
Power:
- 3*AAA Batteries + Holder
- 9V Battery + Holder
Fasteners:
- Screws:
- 8 M3x12 screws for securing speakers to the lid
- 2 M3x12 screws for mounting the stepper motor
- 4 M4x8 screws for securing the lid to the housing
- Hot Glue
3D Printing
To begin the project, first print out the attached 3D files!
Print Settings and Tips:
I would recommend having an infill of around 15-30% for most of the pieces and 100% for the Locking Piece in order to ensure it's strength. You won't need to print supports for most of models except for the Main Housing which requires some support under the screw mounts.
I also decided to print the models out in white PLA but I believe black PLA would match the aesthetic better.
Once you've printed it out, make sure everything fits and you'll be good to go!
Loading the Reel
Once you've printed out the Reel, you can load it up with your fishing wire!
To begin, feed the fishing wire through the small central hole in the reel while leaving a long enough tail to reach your target drop length for your spider.
Then, wrap the fishing wire around the reel once and tie a knot.
Afterwards, grab the end of the fishing wire and tie your fake spider to it. Make sure it's well-tied and also balanced properly!
Finally, wrap the reel a few times with the fishing wire until there is only a few centimeters left between the spider and the reel.
Uploading the Code
The code of this Halloween decoration is quite simple!
To begin, it initialises all of the modules, stepper motors and sensors.
The PIR sensor then constantly checks for motion and when motion is detected, it sets off the sequence by lowering the spider via the stepper motor.
The stepper motor then spins for 10 seconds, lowering the spider. Afterwards, the motor pauses while a random sound is chosen and played using the DFPlayer Mini. Then the motor spins back in reverse to retract the spider and the sensor begins scanning for movement once more!
To upload the code, first plug in your Arduino board into your computer using a USB cable and then upload it through the Arduino IDE software. Make sure that the correct board and port is selected before pressing on 'Upload' to transfer the code to your Arduino.
Downloads
Preparing SD Card
In order for the DFPlayer to be able to read our SD Card, we need to make sure it is prepared properly.
To begin, first, insert your microSD card (Maximum of 32GB) into your computer and format it as FAT32.
This is essential for the DFPlayer Mini to read the files.
Then, copy your spider sound effect files to your SD card. I've also attached the audio files that I used in case you wanted to have the same ones! You can then also optionally name them in a simple, format like “0001.mp3”, “0002.mp3”, etc. for easy playback.
Finally, place the formatted SD card with the sound effects into the DFPlayer Mini. Double-check that it clicks into place!
Gluing Components
Once you've done that, you can begin to glue all your components to the housing in order to make sure everything stays secure.
You can follow the attached images in order to place each component in its respective space!
Stepper Motor Assembly
Once you've done that, you can then install your stepper motor!
First, insert the two M3x12 screws through the stepper motor mounting holes.
Then position the reel in its designated spot inside the housing, with the fishing wire facing outward.
From the inside of the housing, carefully insert the motor, aligning its shaft with the reel and then push it through until the shaft sits snugly in the reel, making sure they are both aligned and move smoothly.
Then, fasten the two M3 nuts onto the screws from the inside of the housing to secure the motor. You might want to add some extra hot glue (Like I did later!) to stop vibrations and ensure the motor stays snugly on.
Finally, push the 3D-printed locking piece into place on the opposite side of the reel. This locking piece helps reduce the load on the motor and also stops the reel from moving horizontally.
Wiring
Once you've done that, bring your breadboard, resistor, capacitor and jumper cables in order to wire everything together!
Wiring Connections:
Stepper Motor Wiring:
- Connect the motor to the ULN2003 driver board, then wire the driver’s input pins to the Arduino’s digital pins (D2, D3, D4, and D5).
PIR Sensor:
- Connect the PIR’s VCC to the power rails on the breadboard, GND to the ground rails on the breadboard, and OUT to digital pin D7 on the Arduino.
DFPlayer Mini:
- Connect the DFPlayer’s VCC and GND pins to the power and ground rails on the breadboard respectively.
- Attach a 1kΩ resistor between the DFPlayer’s RX pin and digital pin D10 on the Arduino.
- Connect the TX pin directly to digital pin D11 on the Arduino.
Speakers and Amplifiers:
- Connect one of the amplifier's 5V pin to the power rails of the breadboard.
- Connect one of the amplifier's Audio + pin on the amplifier to either DAC_L or DAC_R on the DFPlayer Mini.
- Connect one of the amplifier's Audio - (GND) pin on the amplifier to the ground rail on the breadboard.
- Connect one of the amplifier's Speaker + pin on the amplifier to the + terminal of the speaker.
- Connect one of the amplifier's Speaker - pin on the amplifier to the - terminal of the speaker.
- Repeat the same connections for the other amplifier but use DAC_L if you connected to DAC_R and vice versa!
Finally, place the 1000μF capacitor between the positive and ground pins of the breadboard to avoid audio distortion when the DFPlayer begins!
Screwing on Lid + Power
Now we're almost done!
1. Securing the Speakers
- Place each speaker over its mount on the 3D-printed lid and align the holes.
- Then screw in each speaker with 4 M3x12 screws (8 total) and their respective bolt while tightening gently to hold them in place.
1. Power:
Afterwards, connect your 3xAAA battery pack to the breadboard's power and ground rails in order to power everything.
Then use a 9V battery connected to the ULN2003 driver to power the motor, with the negative terminal also connected to the Arduino’s GND to make sure there is a common ground.
3. Attaching the Lid
Finally, position the lid over the main body of the prop and secure it with 4 M4x8 screws. This will fully enclose the components and keep everything sealed and stable during operation.
With power connected, speakers secured, and the lid attached, your spider trap is now complete and ready for testing!
Complete and Test!
Your spider trap is now complete!
Walk in front of the PIR sensor to check if the spider drops down and the sound plays. If the spider doesn’t drop far enough, adjust the fishing wire length or motor steps in the code!
For a temporary setup, I used hot glue to mount the prop to a table edge. For outdoor installation, drill a few holes in the inside housing and securely attach it to a wall or mount!
Now, enjoy your creepy Halloween addition and watch as it gives your guests a fright and heart attack!