The inspiration for this project:
My cat is a jerk. One of his favorite things to do is to alarm me that he is hungry every morning at 4am by sitting on my dresser and knocking random things over until I wake up. Unfortunately, my dresser is also parallel to my craft table, so he has turned my dresser into a work of art by walking across my oil paintings and jumping up there (and also throughout the rest of the house). I could lock him out of my room, but then he cries outside the door all night, so I've been trying to come up with a solution to this problem.
After looking through Instructables and finding out what is possible with the arduino, I decided to make a motion sensing device for my dresser that will play cat repelling noises until Mr. Moe is trained out of his annoying behavior.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Materials You Will Need:
The Motion Sensor:
V battery clip
2.1mm power plug
Various lengths of wire
PIR motion sensor
Piezo buzzer alarm (9V or lower)
Heat Shrink Tubing
USB cable (to arduino)
Tools for Motion Sensor:
The Speaker Case:
Phillips Panhead screws - 1/4" (2)
Phillips Panhead screws - 1/2" (4)
Interior Construction Adhesive
Black paint (flat)
Tools for Speaker Case:
Drill (with various bits)
Step 2: Program the Arduino:
The first thing that you should do is to upload the motion sensor code to your arduino.
I found a good code here: http://make-documents.s3.amazonaws.com/fv1fYSLfy6QRgANM.pdf
Open the pdf and copy the code into a new sketch in the arudino program.
I found one small error in the code where a comment stating " numbers 10, 11)" ran into the program. Just delete this or cut and paste it in it's proper place right above the line.
Compile, and then plug in the arudino with the USB cable and upload it.
Next you can begin to construct your motion sensor circut.
Step 3: Attach the PIR Sensor:
First you will connect the arduino to the PIR motion sensor. Gather your wires and cut three to about 6 inches and strip the ends so that they can easily be plugged into the slots of the arduino. I recommend using wires of different color or shrink tubing to make things easier to remember.
Once your wires are cut, you will need to solder your wires to your PIR sensor.
The wires with the tubing in the picture (black, red, and yellow) are the wires I attached to my PIR.
Wire 1: Plug into the second GND slot in the arduino and twist the opposite end of the wire to the GND peg of the PIR. (black in the picture)
Wire 2: 5v slot of the arduino to VCC of the PIR. (red in the picture)
Wire 3: Slot 2 to of the arduino to OUT peg in PIR. (yellow in the picture)
WARNING: Do not connect VCC to VIN. I burned out my arduino this way.
Step 4: Attach Your Piezo Buzzer:
Now you are ready to hook up your piezo buzzer.
Most piezo buzzers have wires attached to them: the black wire goes to GND and the red wire to pin 10. If yours doesn't, don't worry. The polarity in this case isn't integral.
(In the picture the buzzer's wires are solid black and solid red)
Step 5: Attach the LED:
Next connect the LED's anode (longer leg) to peg 13 on the arduino and the cathode to GND (ground). You don't need this for function, but it is good to have in order to see that your alarm is working properly in case the buzzer is busted (it lights up when alarm is activated).
Step 6: Assemble the Battery:
Take the battery clip and the 2.1mm power plug. If you unscrew the top of the plug you should see that inside are two metal pieces, one short and one long.
Now pull out your shrink tubing, solder, and soldering iron. Take a piece of shrink tubing and fit it over the red wire of the battery clip.
Then, take the battery clip's red wire (+) and put the metal through the hole on the short leg of the power plug. Once it looks well connected, solder the connection and then pull the shrink tubing over it. Use the barrel of the soldering iron (not the tip!) to heat the shrink tubing so it fits nice and snug over your connection.
Next repeat all of this with the black wire and the long leg of the power plug. Don't forget to add the shrink tubing first before you solder.
Once everything is connected, plug it in and attack your 9V battery. If it is working correctly, it should look like this:
Step 7: Build the Case: Prepare the Wood
You need to begin by priming the wood you are using and set it aside to dry. Once that is done, CAREFULLY measure out the walls of your speaker (yea I made a few errors there).
I used the measurements 4x6" for the sides and 4x4" for the top and bottom. Also you will need an additional piece that will act as the front of the speaker that should be about 5 1/2" x 3 1/2 " and a piece for the insides later to hold down your arduino that is 5 3/4" x 3 1/2".
For extra support, also cut four 1x1 x 6 inch rectangles of wood for the inside of the box.
To make things simpler to follow, lets call:
side pieces (4x6) - A
top and bottom pieces (4x4) - B
speaker front piece (5 1/2 x 3 1/2) - C
arduino support piece (5 3/4 x 3 1/2) - D
rectanglar support pieces (1x1 x 6) - E
Cut all the pieces out with a power saw. Then, after making sure that they fit together, sand them.
Step 8: Further Box Preparation: PIR Sensor Slot and Front Piece
Next take piece C and draw a rectangle inside it that is 1/2" away from each side. Then use your drill to cut holes in the corners so it is easier to use your power saw (mine was hand-held). After that, cut out the rectangle so pice C is hollow in the middle. Sand it so everything looks smooth and set it aside.
Then you will need to measure out and draw where the PIR sensor will be. I placed mine at 3.5" high and centered. Don't forget to add a space for the node on it's side.
I used the drill and the dremel tool (and it's multiple heads) to cut out the slot for the sensor.
WARNING: Dremel tool heads can break very easily.
Make sure the PIR sensor fits. I had to repeat this step twice to get it right.
Next, drill tool to put holes in the bottom of the panel for the PIR sensor so that the sound of the buzzer can travel out easier. I also put some holes in the lid of the box later when I noticed my buzzer wasn't loud enough, but that it optional.
Step 9: Put It Together:
Now it's time to glue! Put a thin strip of Interior Construction Adhesive (glue) on one of the rectangle supports and then on one of the sides and hold for about 10 seconds.
The nice thing about this glue is that it takes about 15 minutes to set, so if you make a mistake you can fit it.
Put together your box as shown (making sure to leave the top piece off ) and then leave the glue to dry for at least an hour.
Step 10: Paint:
Now that the box is dry, it's time to sand it again. Making sure that there are no rough edges or glue sticking out, then dust it off and paint it. I used Royal Exterior's flat black (acrylic latex) . It took about 3 coats to have a solid finish.
Step 11: Secure the Arduino and Attach the PIR:
Next put the arduino into the center of peice D and use at least two small screws (1/4") to secure it.
Then slide it into the box and put a big screw (1/2") into the top of it going into one of the rectanglar supports (piece E) opposite of the PIR sensor side.
Now put your PIR sensor in place and hot glue it down.
Step 12: Finishing It Up:
Now get out the panty hose and cut out a rectangle. This is going to pull over piece C to make it look like the front of the speaker. Super glue or hot glue the hose in place and then center it attach it to your box over the PIR sensor via hot glue (or Interior Construction Adhesive).
Now you need to put on the top. If you drilled holes in it to let that extra noise through like I did, I would recommend also covering this with panty hose. Then take your large screws (1/2") and screw it into the box.
And viola!! You now have a discrete motion sensor device to deter, alarm, or annoy the subject of your choosing.
Step 13: Project Revisions:
In order to make the screws blend into the box paint them black. It definately makes it look more like a speaker that way.
Also, since this project is held together with glue it would be wise to secure it into place. I used stick on velcro and it held together VERY STRONGLY. The nice thing about this is that you can add it to multiple locations and as an adhesive it is very cost-efficient and effective.
I also added a larger buzzer to the project, but I included this in my steps to make it. This was my original buzzer:
1 Person Made This Project!
ConductorX made it!