Just 5 days before Halloween I decided I wanted to make a prank to use at the front door for trick-or-treaters. My kids had seen one of those candy buckets at my work where a motion-activated skeleton hand falls down to grab your hand when you reach for the candy. They thought it was so cool! Of course, I thought, I can make something like that, right? Not much time though. I quickly hopped on Amazon prime and ordered a servo. With 2-day delivery I had just 3 days to create my prank. Now an ugly spider makes a creepy entrance around a door-step package for any unsuspecting Halloween visitor!
Step 1: Parts and Tools
- Fake Spider (dollar store?)
- Servo - Amazon / Aliexpress
- A Sensor (Pick 1 - I show both ways in this instructable)
- Breadboard and Jumper wires
- Popsicle sticks
- Scrap pieces of wood
- Empty shipping box
- Knife or box cutter
- Glue gun
- Wood glue (or just use the glue gun)
Step 2: Testing the Servo, Ultrasonic Sensor, and PIR Sensor
First things first. If you are like me and have never used a servo or these sensors, you may want to quickly peruse a few tutorials to figure out how they work. Below is an overview and example of each that I used to make sure my servo and sensor(s) worked and would get the job done. I've also included my simplified test code you can use to make sure each component works. Again, you can pick the type of Sensor (Ultrasonic or PIR).
- Basic servo lesson on Sunfounder
- Example code on Hobbytronics
- My simplified test code below - servo_test.ino
- How it works on RandomNerdTutorials
- Example code on same page of RandomNerdTutorials
- My simplified test code below - Ultrasonic_Distance_check.ino
Step 3: Combining the Compents
Next, depending on whether you choose the PIR or Ultrasonic route, below is combined spider code for detecting a person coming in range and then turning the servo to move the spider out and back. Wire up the sensor and servo to the Arduino using jumper wires and breadboard as indicated in the options below.
- This code checks if an object is within range of a certain distance and summons the spider.
- In the code you can change the triggerDistance variable to closer or further than 48 inches (4 ft) depending on your situation.
- Connect Servo to 5v, Gnd, and Pin 10
- Connect Ultrasonic Sensor to 5v, Gnd, A0 (Trig), and A1 (Echo)
- This code checks if an object is in the field of vision and summons the spider.
- For the PIR you can adjust the sensitivity using the sensitivity potentiometer (normally orange) and turn all the way to the right for the least sensitivity.
- Connect Servo to 5v, Gnd, and Pin 10
- Connect PIR Sensor to 5v, Gnd, and Pin 2
After wiring up one of the two options, play around with it to make sure it works, triggering the servo with the sensor.
Step 4: Creating a Base for the Servo
Next, you need to mount the servo so it can stay in place while swinging the spider around. For this you will want to use a saw to cut a piece of scrap plywood or wood board to about 4" x 12" or so. Then, take two smaller 1" x 2" wood blocks and cut them down to the size of the servo height. Screw from the bottom or wood glue (or glue gun) the two blocks to the plywood on one end, then screw the servo in between the blocks.
*Note: I also cut a notch out of the bottom of one block for the servo wires to pass through.
Step 5: Adding the Spider
Next step is to get an ugly spider (or some other creature - please nothing living or it probably moves on its own). Something lightweight is preferable so the servo doesn't have to do too much work. Using a glue gun, attach two Popsicle sticks to each other and then to the servo arm/horn as pictured. (You may want to color the Popsicle sticks black with a sharpie first so they are less noticeable.) Then mount the spider to another Popsicle stick using one of the small screws that came with the servo. Glue the spider on a stick to the rest of the Popsicle stick arm at about a 90 degree angle.
*Note: I just glued these fast, I didn't think about the height of the spider off the ground. You may want to try having the sticks and spider angle down closer to the ground so it looks more like the spider is right on the ground.
*Note: After gluing this all together, you can unscrew the servo arm with the spider on it to position the spider's starting position lined up with the edge of the block.
Step 6: Shipping Box and Finishing Touches
After testing out your moving spider a few times to get a feel for the arm's path, find a used shipping box that is big enough to fit the base and spider.
*Note: Do not remove the flaps from the box as you will glue the base to one of the bottom flaps.
Setting the base next to the side of the box, estimate and cut out using a box knife the length of the arm and area or the spider to come out of the box as shown. Then glue the base on the bottom flap, enclosing the box on the top and check to see if the arm/spider can freely come out of the box when summoned. Cut more of the box as needed.
At this point you need to determine where to put the sensor. Options are cutting a hole in the front of the box, or setting the sensor somewhere outside the box. Since my prank was to be used on the front doorstep, the lighting isn't the best for someone to see the sensor so I simply cut holes in the front of the box using a 5/8 drill bit and mounted with glue.
Step 7: Complete!
You're all set! Set the trap on your porch like it is a delivered package and either plug in or connect to a USB battery pack. Let the fun begin!!!