I built this project a few years ago and now I will update it to make it an instructable. This video is from the original Project 5 years ago. It is very easy to make, the measures are not critical and you can use any scrap material you have, a small servo, an Arduino and a few wires.
Step 1: What Do You Need
As I told before nothing is critical here, you can use any microcontroller that fits your preference, the power source also could be any you have nearby and some servo in your scrap box.
What did I use:
1 Arduino Nano
1 9 gr servo
9 volts battery and connector
1 momentary push button
1 10K ohm resistor
1 piece of perforated PCB
4 1x15 female pin header
A piece of some board, white melamine particle board, plywood, MDF is fine, you choose, another piece of 3mm black melamine MDF board.
Step 2: Preparing the Base
As I told before, you can use any kind of board you have and change the measures as you want. I made mine with a piece of 30cm by 20cm white melamine board. Mark the position for the servo and carve it 10mm deep.
With 12mm wide the servo fits very tight so it is not necessary to screw it in place. I don't like hot glue but if your servo don't fit fine you can glue it in place. There are some holes to drill, one for the push button, another for the button wires and four more to screw the cover in place.
Step 3: Time for the Surprise
This is the hearth of the prank but I assure you that it don't need to be very sophisticated to be effective. I made the spider legs with wire and a wooden body, you can use a plastic spider as well.
The swinging arm is made of the same wire and you can attach it to the servo horn as you see in the photo.
Step 4: Small Board for the Arduino Nano
I guess you can use female jumpers directly to the Arduino Nano pins but I like easy access to the pins so I use to build this kind of board with two double rows of female pin headers. Just connect each pair of female pins with a blob of solder under the perforated PCB and you can easily access all the pins from the front of the board.
Step 5: Wiring
Attach the red wire of the battery connector to Vin pin on the arduino, the black wire goes to any gnd pin. The other wiring is the normal wiring for a button and a servo. One leg of the button goes to digital pin 2, this same leg of the button connects through a pull-down resistor, 10K ohm, to ground. The other leg of the button connects to the 5 volt pin. Connect the red wire of the servo to the 5 volt pin, the other wire, brown or black, goes to any gnd pin and the signal wire, yellow, orange or white, should be connected to digital pin 9 on the board.
Step 6: Put All the Things Together
Now, with some small screws or a piece of double side foam tape put the arduino board in place, also with double side tape attach the 9 volts battery. Put the push button in the center of the board and pass the wires through the hole near the servo. With a 20cm by 10cm piece of 3mm black melamine MDF board and two pieces of 10cm by 3cm build a cover to hide everything but the button, screw it in place from behind the main board.
Step 7: The Code
The code is very simple, you push the button and the servo moves the spider down.
These lines of code allows you to change the spider position:
int pos = 80; //this value change tha lower position of the spider
int posUp = 30; //this value change the upper position of the spider
This line of code allows you to change how longer the spider stay down:
delay(500); //change this value to control how longer the spider stops
And you are ready. A note aside, the scream in the video is post production, in this version I tried to add it as a .wav file through a SD card module but I'm not good at code, when I got the scream to work the servo didn't work, so, maybe next year I will try again.
Participated in the
Halloween Contest 2018