loading
We're running a special series of custom Instructables for Ace Hardware, an advertiser on Instructables. This is the first of three awesome projects we've created in-house using parts from our local Ace store.



I wanted to create a motion-activated spider to put on my door for Halloween. It drops down when visitors approach the entryway, activates a spot light to draw their attention to the spider, gives them a scare, then automatically retracts and resets itself, waiting to prey upon its next victim.

I used a basic motion sensor light from Ace Hardware to activate my spider. Of course, I could have just bought a commercial product from the store, but this is a great excuse to learn about some basic electronics and programming procedures, and this platform allows me to drop anything I'd like on unsuspecting visitors, with complete Arduino-controlled customization!



Click Here

Step 1: Materials

Our local Ace Hardware has a section full of motion activated lights, which seemed the perfect actuators for a Halloween surprise.

I settled on a simple project that would help me get some basic electronic experience, and started searching for parts. Ace is close to home, and there's a Radio Shack in the same plaza, so the materials I needed were easy to find. Most of the stuff I had lying around the house, but I'll try to provide links so it makes more sense.

In addition to the Motion Activated Light, my materials included the following:
Lightbulb Socket to Female Wall Plug Connector (referred to as light plug from now on)
Electrical Tape
Solderless Breadboard
Assorted Solid Core Wires
Wire Connectors
ULN2003A IC (ordered from Jameco)
Arduino Diecimila (and USB Cord)
Circuit Board
Box Cutters
Drill
1 LED
Super Glue
Double Sided Sticky Tape
A Sewing Bobbin (craft store)
[http://www.acehardwareoutlet.com/(4cmx3x5521lr3m5544z52zrs)/ProductDetails.aspx?SKU=8004285 Fishing Wire]
Wall Power Adapter to power Arduino (or 9V Hookup)
Wall Power Adapter to trip Arduino
Basic Extension Cord
3x5 Note Card Box (that I had broken and lying around for housing)
Stepper Motor (Mine is from an old disk drive)
Spider

Feel free to substitute anything you need...a lot of these are very general and can easily be switched with another tool.

My end goal: to program the Arduino to slowly lower the spider when someone walked up to the house, light it up when it was at eye level, and then raise it back up into its web, awaiting its next victim.
Click Here

Step 2: Prepping the Light Part 1

The first thing I needed to do was prep the Ace motion-sensor light to send a signal to trip the Arduino.

Since I didn't want to permanently affix my light to my door, I decided to attach a wall plug to it. I cut the end off of an extension cord, and attached the extension cord leads, to the open leads of the motion light.

The motion sensor has one black wire, and one white wire, and the extension cord has two wires that are the exact same. However, the extension cord has one plug that is fatter then the other plug, only allowing it to fit in the wall outlet one way. I wanted to make sure I got the leads hooked up right, so I searched around online and found the following quote:

"Some modern plugs make the neutral blade wider than the live blade."

According to the directions that came with my light, the black wire was hot and white was neutral. In attempting to keep like with like, I marked the skinny wire (live) of my extension cord with a black sharpie. I then attached the marked wire of the extension cord with the black lead of the motion light. (live to hot) I also attached the lead of the extension cord that I didn't mark with the white lead from the light (neutral to neutral).
Click Here

Step 3: Prepping the Light Part 2

Once that was finished, I realized that when plugging in my light plug, the plugs didn't make it past the casing of the light. I wasn't able to plug anything in. The light socket is held in place by two screws behind where the light screws in, that I took out, I then unscrewed the bottom light adjuster that help the assembly in place. There are two wires attaching the socket with everything else, they were red and white, and the easiest way I found to get the socket out, was to clip those at a point that I would easily be able to reattach later.

With those cut, the light slid right off, and then I slid the socket out of the casing. When that done, I threw the casing in the scrap pile, and ran the wires for the socket back through where I had pulled them out of. I stripped the red and the white wires, soldered them all back to their correctly colored counterparts, and wrapped them with electrical tape.

Once all of that was finished, I decided to do a quick test, plugged in a light bulb for verification, turned it on and it worked great.
Click Here

Step 4: Test the Circuit

Next I built the circuit.

The pictures should explain everything on this one, but I'll do my best...

Arduino Pins 8,9,10,11 go to ULN2003A pins 1,2,3,4
Arduino Gnd goes to ULN2003A pin 8
Arduino 5V goes to ULN2003A pin 9
Arduino 5V also goes to Stepper Motor Voltage In
ULN2003 Pins, 13,14,15,16 go to Stepper Motor Step Inputs
Arduino Pins 13&GND (adjacent to each other) will be used to light up the LED.

Arduino Pin 3 will be used to trigger the program later. In order to activate the pin, it requires a voltage input, right now, it's set up to the 5V coming out of the Arduino to test it.

Once everything is connected, and working, you'll need to decide on a power source for the Arduino (unless you want to keep using a USB cord). I opted for a 9V Wall Power Adapter from an old electronic piece that has long since been thrown away. I cut the end off, and tinned the wire tips. (Tinning is applying a thin coat of solder to keep all of the wires together when working, it make it easy to shove into a breadboard).

To power the Arduino without the USB adaptor, I connected the Wall Adapter to the Vin and Gnd in the POWER section on the Arduino. To run the power this way, make sure the power select is set to EXT and not USB (located right next to USB connector, marked PWR_SEL).
Click Here

Step 5: Code

Steppers are very touchy, and you need to figure out what order your stepper needs to be stepped in. I found that mine preferred pin 8,11,10,9, so I labeled my motorpins so I wouldn't get too confused later. You can find excellent directions on how to figure out your base stepper set up at the following two websites.

http://electronics-diy.com/electronics/stepper_motors.php
http://arduino.cc/en/Tutorial/StepperUnipolar

Once you have that, apply the following code to your arduino, and test. I've given //notes to give you some idea of what I was thinking when I wrote it.

int buttonPin = 3; //labels pins for ease later
int motorPin1 = 8;
int motorPin2 = 11;
int motorPin3 = 10;
int motorPin4 = 9;
int ledPin = 13;
int delayTime = 20; //sets a base delay, my stepper motor twitched
//if I used less then 20ms

void setup() {
pinMode(motorPin1, OUTPUT); //lets arduino know how to treat each pin
pinMode(motorPin2, OUTPUT);
pinMode(motorPin3, OUTPUT);
pinMode(motorPin4, OUTPUT);
pinMode(ledPin, OUTPUT);
beginSerial(9600);
pinMode(buttonPin, INPUT); //your trigger/switch

}

void loop() { //sets a loop
if (digitalRead(buttonPin) == HIGH) //will only lower spider IF condition is met
{
for (int i=0; i<=120; i++) //will repeat following code 120 times
{
digitalWrite(motorPin1, HIGH); //code provides one step
digitalWrite(motorPin2, LOW); //repeating it 120 times lowers
digitalWrite(motorPin3, LOW); //spider around 2 feet
digitalWrite(motorPin4, HIGH);
delay(delayTime);
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, HIGH);
delay(delayTime);
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);
delay(delayTime);
digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, LOW);
delay(delayTime);
}

delay(480); //480+20=500ms or 1/2 second delay
digitalWrite(ledPin, HIGH); //before light activates
delay(2000); //stays lit for two seconds
digitalWrite(ledPin, LOW); //turns off
delay(500); //waits another half second

for (int i=0; i<=120; i++) //repeats above code in reverse
{
digitalWrite(motorPin1, HIGH); //raising spider back up
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, LOW);
delay(delayTime);
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);
delay(delayTime);
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, HIGH);
delay(delayTime);
digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);
delay(delayTime);
}
}
else //if conditions aren't met (no high)
{

}

delay(1000); //wait one second and try again

}
Click Here

Step 6: Solder Circuit

If everything works up to this point, grab your circuit board, and transfer everything from the breadboard to it, one component/wire at a time. Solder accordingly.

I started with the ULN2003A, and bent the leads out so it would be easier to solder everything to it in the end, whatever your methods, I'm sure they'll be fine.

Once everything is soldered onto the new circuit, ensure everything works.

After making sure everything worked, I figured this would be a good time to use the Ace Motion Detector to trigger the Arduino. I found another wall power adapter that it could use to trip the board to start the program. It used to charge a cell phone I don't own anymore, so I figured that would work nicely. I cut the ends off, and checked them with a multimeter to see which was sending out positive and which was sending out ground. If you test voltage DC with your multimeter, which ever way comes out with the positive voltage, the black multimeter lead is touching the ground.

I taped the ground multimeter lead up, and taped it to the side of the active one I was going to use. Then I tinned the one I was going to plug into the Arduino.

I plugged the light plug into the Ace Motion Detector, plugged the old phone charger into the light plug, and plugged the tinned end into the Arduino's Vin (in the POWER area on the Arduino)

I turned on the light, set it to test, and everything worked perfectly.
Click Here

Step 7: Form the Case

Next, I needed a case.

I had an old broken 3x5 card case lying around my house that I wasn't using, so I decided to give it a new purpose. Look around - you've probably got something that would work equally well.

I cut a hole large enough to fit the stepper motor through.

Then I placed the stepper motor on the outside of the box and drilled through the screw holes, into the box. I figured it would be easier then marking, and was hoping it would work.

It did work, and I screwed two screws I had lying around into the motor to hold it in place.

I test fit everything, and it seemed nice, so I drilled a large hole on the opposite side of the box to bring the wires in. I plugged the wires in through the hole and tested it.
Click Here

Step 8: Time for the Spider

Next I needed to get my spider set up.

I found a nice scary spider that seemed nice, and drilled two holes in his body to run wire to hold him up.

I slipped the fishing line through a hole in the bobbin, and wrapped it until I felt comfortable. I taped off the loose end, and cut the end I had pushed through the hole. (I had pushed it through the hole to make wrapping easier)

I tied the loose end of the fishing line to the spider:
http://www.rbff.org/uploads/Resources_section/Tip_Sheets/Knots.pdf
a PDF] with a good fishing line knot that I used.

I dabbed the knot with glue (which isn't necessary in any way, but I didn't want to have to deal with it again), and left it alone.

The hole in the bobbin was a little too small for the stepper motor, so I decided to super glue it to the outside of the motor. My spider isn't that heavy, and I figured it would be able to hold without any trouble. It did.

With that finished and dried, I just had to finish up.
Click Here

Step 9: Finishing Up

I soldered each foot of the LED I've been using to about six feet of solid core wire.

The goal to be able to place the light wherever I need to, should I need to change the code or go around some object. I ran the wires through the same hole in the box as all the other ones, and plugged it into the same pin I've had it plugged into. I tested it when plugged in, and it still worked perfectly. With everything connected, it was time to test out my creation.

Overall, I really liked this. The stepper motor is a little slow, but it's extremely quiet - perfect for sneaking your spider down to an unsuspecting victim.

If you want to get more speed out of it, you can use a larger stepper motor, or a bi-directional motor. With a bi-directional motor, you'll have to write a sightly different code for the arduino.
Click Here

Step 10: Installation

Since I don't want to leave this up year round, and doubt my landlord would like such a permanent installation above my door, I decided to use the double-sided sticky tape (you can get this from Ace as well) to adhere the 3x5 card box and the Ace motion sensor above the door.

I would recommend sturdier and more permanent methods if possible - this prevents a surprised visitor from knocking the whole thing down when they shriek and attack the spider!

Camouflage:
I didn't want people to get suspicious, I decked it out with cobwebs to make it a bit more nondescript. The spider hangs just under the cobweb, and at first glance, it looks like that's all it's supposed to be, and I'm hoping it'll get little attention with all of the other distractions around, making the dropping and the lighting a bit more fun.

The end result was extremely creepy! There's nothing quite like an unexpected spider appearing silently over your shoulder to complete the Halloween experience.

I plan to experiment with different locations, and try dangling different scary creatures. Adding sound, and coordinating the motion-trigger with a larger haunted house would also be fun!
Click Here
<p>Nice project! Where did you find the gear for the motor?</p><p>thanks!</p><p>marC:)</p>
all that extra code just to run the stepper motor. for this task a stepper motor is sorta a waste, you don't need the torque it produces and it doesn't have great reliability, it would have been simpler to use a continuous rotation servo, using pwm for speed control and direction is simple ( pwm, dutycycle) . if they are harder to use a simple "H" bridge and a cheap hobby motor would also work with some trial and error for settings.
I used your suggestion and created an H-bridge to power a DC motor. The problem I'm having is to do with accepting the input from the motion sensor wall-wart.<br/><br/>I found a wall-wart that outputs DC 4.2V-5.3V @ 0.5A-0.95A and it has a tiny connector that a 22AWG fits perfectly inside... and it's center is positive to boot! So I hooked up a piece of copper wire to pin #3 and before I even hooked into the power cable, my motor went off. With just the wire in the pin #3 socket the motor randomly fires up.<br/><br/>I changed my &quot;buttonPin&quot; to other pins with the same result. As soon as the wire is inserted into the connector the motor fires up... the pin goes high.<br/><br/>Here is my code:<br/><pre>int buttonPin = 3;int forwardPin = 4;int reversePin = 5;int ledPin = 13;void setup() { pinMode(forwardPin, OUTPUT); pinMode(reversePin, OUTPUT); pinMode(ledPin, OUTPUT); pinMode(buttonPin, INPUT);}void loop() { if (digitalRead(buttonPin) == HIGH) { digitalWrite(ledPin, HIGH); digitalWrite(forwardPin, HIGH); digitalWrite(reversePin, LOW); delay(750); digitalWrite(forwardPin, LOW); digitalWrite(reversePin, HIGH); delay(3000); digitalWrite(reversePin, LOW); digitalWrite(ledPin, LOW); } delay(2000);}</pre>I originally had the &quot;beginSerial(9600)&quot; call before declaring the pin as INPUT but I removed it to see if it made any change.<br/><br/>Any reason to explain why the pin goes high as soon as a wire is inserted that isn't connected to anything?<br/>
So the problem I was encountering was solved by placing a pull-down resistor between the wall-wart from security light and to pin #3. I also share the ground from that wall-wart and the microcontroller instead of wrapping it up. Excellent idea and tutorial!
the microcontroller is looking for any change or delta on the line, your best best is to wire the button so that while open the microcontroller gets grd or low, and when closed it gets +5v or high, for engineering this is the standard way to run buttons. if you like i can draw a schematic in paint if you dont know how to do what im telling you. this way there is no way for the line to be questionable whether its on of off.
This is really cool!
Nice work!!<br/><br/>I see we both share an enjoyment, of the eight legged kind. ;)<br/><br/><a rel="nofollow" href="https://www.instructables.com/id/LeD_SPIDIES_Halloween_CRAFT_for_KIDS/">LeD Spidies</a><br/>
Wish I could "Digg Up" good comments on here. Thanks marc92 for voicing what I am sure many of us were thinking... :) The Instructable is great BTW, don't get me wrong, just the product placement is the issue.... But hey, if it helps pay the bills and keeps this site strong, I guess we may have to look at it as a necessary evil... As an aside, I genuinely do wish this site could "take inspiration from" (i.e., copy) the Digg idea of letting us Digg (or Bury) useful (or lame) comments. Instructables is well on it's way to be 2nd in my heart for web sites. (I'll let ya guess what #1 is... it's not difficult....)
Personally, I would <em>not</em> call this spam, as its not unwanted. <br/>Its perfectly on topic, and its a great project. They also disclose their bias, so its not like they're trying to pull something over you. After the intro &amp; materials steps, however, they never mention Ace Hardware again. And, in the materials step, they also link to <em>other sites</em> for materials, not just Ace.<br/><br/>Earlier, we had a realsimple contest, in which the company submitted <a rel="nofollow" href="https://www.instructables.com/member/RealSimple.com/">eleven</a> instructables, and <a rel="nofollow" href="https://www.instructables.com/member/stasia-realsimple/">took part in the community</a>. Those were <em>excellently</em> done instructables, and they should not be labeled as spam just for having a sponsor. <br/><br/>Spam, however, would probably be me mentioning that there (kind of) <em>is</em> a way to &quot;digg&quot; comments, using <a rel="nofollow" href="https://www.instructables.com/community/Who-wants-to-test-a-new-GM-Script/">a greasemonkey script</a> I wrote. ;-)<br/>
A.) Wow, you make your own Greasemonkey Scripts! That is wild! (GM is one of the main reasons that I rave about Firefox. Love the browser itself, but FF's support of plug-ins such as GM is, to me, one of it's greatest features.) B.) I notice that no one has done a single script directly FOR Instructables. That seems odd. C.) I agree with everything you posted in disagreement of my comment. :P I tried to be clear that the instructable itself was great. Guess I was NOT clear enough....
In reverse order...<br/>C) Oh well. I guess I was more replying to marc92, but your comment was a bit more <em>in depth</em> with more to reply to.<br/><br/>As for my greasemonkey scripts... yes, I have written a few. I do a fair amount of JS work so GM scripts weren't a big leap. <br/>I don't know what you mean by &quot;<em>...no one has done a single script directly FOR Instructables...</em>&quot;, I've written 3 big ones, 2 of which I'd consider obsolete. Before you could set a preference to default to allsteps, I wrote a GM script to do so (and then fungus amungus improved upon it). <br/><br/>Anyway, I really liked the idea of this comment rater, but it won't become truly amazing unless enough people used it (which I'm not too hopeful about...). Still, the handful of people who <em>do</em> use it allow it to still be useful...<br/>
I don't know.. I think it's much less obnoxious than other forms of advertisement. Letting sites 'sponsor' an Instructable is much better than lots of places with irritating flash ads all over their pages. I usually call something spam if it is posted with no intentions of contribution to a conversation or community. This definately has contributed. As for the Instructable.. very nice. Though it's a pretty expensive spider.. $75 just for the arduino, breadboard, and light you linked to. Still a cool gadget, and an excuse to hack things up, and steal their parts. :P
WOW congrats on this awesome project, you did a good job. And that model is the bomb!! -- magri
I love ACE Hardware. I do think it's allright to have them listed on the site as an instructable sponsor. There is roughly a precedent with the Popular Mechanics instructables. Personally, I support ACE as they have all manner of unusual parts that you can't get from big box stores. And to make matters better, you can buy just a couple of bolts, screws, etc for an excellent price. I hate going to Home Depot and having to spend $2 for 8 bolts when I only will use two.
for (int i=0; i&lt;=120; i++) //will repeat following code 120 times<br/><br/>121 times actually<br/>&lt;/codeNazi&gt;<br/>;)<br/>
You might want to put your code in triple curly brackets, which is used for preformatted text:<br/><br/><pre>Like this Keeps spaces intact, and special characters aren&apos;t escaped []&apos;&apos;&apos;^,,{{{Your text here }}}</pre>
This is cool but could be considered spam for a certain hardware store.
wow I love what you have done! Great work!
...you guys just find any reason to use a microcontroller, huh?

About This Instructable

7,772views

26favorites

License:

Bio: You can see my personal website at sneezingturtle.com.
More by StumpChunkman:Italian Meatballs Rubik's Cube Throwie Instructions Making a Stop Motion LED Throwie 
Add instructable to: