Whenever Halloween comes, people will wear scary costumes, trick or treat, go to a hunted house, or scare people. If you are the kind of person that prefer latter, you can try making this Halloween Spider machine to scare people.
- 1 Arduino Leonardo
- 1 HC-SR04 Ultrasonic Sensor
- 1 Stepper Motor
- 1 Breadboard
- 12 wires
- 1 USB cable
- 1 Box with its cover and at least its length, width, and height need to be at least 20cm*15cm*8.5cm
- 1 Foam core board
- 1 String
- 1 Fake spider
- 1 Utility knife
- 1 Scissor
- 1 Tape
Step 1: Build Up the Parts(Breadboard)
1. Connect the stepper motor's wires to Arduino
IN1 to D pin 11
IN2 to D pin 10
IN3 to D pin 9
IN4 to D pin
"-" to negative electrode
"+" to positive electrode
2. Connect the ultrasonic sensor to Arduino
VCC to positive electrode
TRIG to D pin 5
ECHO to D pin 4
GND to negative electrode
Positive electrode to 5V
Negative electrode to GND
Step 2: Import the Code
Here's the code for the machine:
Copy and paste the code in the link to your Arduino app/program.
Next, connect your computer and Arduino Leonardo with the USB cable
Then, upload your code to your Arduino Leonardo.
If the stepper motor starts working when the ultrasonic sensor detects something approaching, then you can move to the next step!
Step 3: Make a Reel
You can just buy a reel that has a string around it, but its thickness will have to be no more than 2cm since it's going to be stuck on the stepper motor.
If you can't find the kind of reel that did not meet the requirements above, you can make your own one.
- cut the foam core board into 2 circles with a diameter of 8cm and another circle that is smaller than the other 2 circles with a scissor(photo1)
- glue the 2 big circles while the smaller circle is placed between them.(photo2)
- After the glue is dry, you can wrap the string in the middle(around the smaller circle) (photo3)
Then you have your Reel!
Step 4: Make Your Outer Case & Combined Everything
- place your Arduino against the side of the box(photo1)
- Then cut a big hole with a utility knife so the ultrasonic sensor can detect something approaching not the box itself(photo2)
- Cut another hole so the USB cable can connect the Arduino through the box(photo3)
- Make the stepper motor's moving part connect to the hole of the reel and place them on the other side of the box(photo4)
- Make the reel flat surface "rely on" the "wall" of the box(photo4)
- Cut a small hole so the string can come out from the box when the reel is turning(photo5)
- pull out the string(not too long) that is enough to tie the fake spider(photo5)
- Then tie the spider with the short part of the string(photo5)
Finally, you are done! And you can connect your Arduino and the USB cable to see if it works!