Introduction: Building a Sentry Gun With Laser Trip Wire System and Arduino
*NOTE* THIS PROJECT IS DONE BY A GROUP OF STUDENTS FROM SINGAPORE POLYTECHNIC UNDER FYP SUPERVISOR TEO SHIN JEN. DONE BY CHAN KAI CHI AND 2 ANONYMOUS.
Concept:
Trigger gun when laser is blocked by intruding object.
Note:
Tilting is included for expandability but not used in this project.
Skill Level:
Basic soldering and basic metal works
Things You Need:
Toy Gun(Any will do, preferably a semi-auto)
Continuous Rotation Servo Motor
Servo Motor
Servo Arms and Wheels
Arduino
Metal Sheets
Ball Bearings
Bolts
Nuts
Screws
Rubber Washers
Cable Tie
Copper Wire
Copper Strip Board
Pins
Sockets
Resistors(1K Ohm)
Light Dependent Resistor
Potentiometer(20K Ohm)
NPN Transistor(2N2222)
Step 1: Building the Frame
Cut the metal sheets into 6 rectangular pieces(4 of equal length, 1 long, 1 short) and 2 square pieces.
Below are the dimensions we used:
4x 6”(inch) by 2”
1x 10.5” by 2.4”
1x 2.5” by 2.4”
1x 10” by 10”
1x 9” by 9”
Feet(6” by 2”):
Bend the 4 metal piece 90 degrees at the 2” mark and make screw holes(at least 2) at the shorter end.
[Image 1]
Base(9” by 9”):
Make screw holes that match your feet’s at 4 corners of the metal piece to mount the feet and a hole in the center for the pivot(the hole size depend the bolt you’re using).
[Image 2]
Gun Support(10.5” by 2.4”):
Bend the metal piece 90 degrees at the 2” mark and the 6.5” mark to form a deformed U. Make screw holes(at least 2) at shorter end and 4 holes at the other end to mount your servo.
[Image 3]
Turning Panel(10” by 10”):
Make screw holes that match the gun support’s at one corner of the metal piece and one hole in the center for the pivot(should be slightly larger than the pivot but smaller than your ball bearings).
[Image 4]
Servo Mount(2.5” by 2.4”):
Make a hole at one end to fit into the pivot and 4 holes at the other end to mount your servo.
[Image 5]
Step 2: Trigger of the Gun
Mount one of the servo to trigger the gun
We secure a small servo with a short servo arm onto toygun.
Step 3: Putting Everything Together Part 1
Mount the gun onto a continuous rotation servo[Image 1].
Secure it onto the gun support[Image 2 & 3].
Secure another continuous rotation servo with wheels[Image 4] onto the servo mount[Image 5 & 6].
Step 4: Putting Everything Together Part 2
Mount the feet to the base using screw and nuts[Image 1].
Do the same for the gun support and the turning panel.
Then put everything together[Image 2-6].
Step 5: Soldering
Circuit Diagram[Image 1]
LDR: Pin 2, 4, and 7
Servo for trigger: Pin 3
Servo for tilting: Pin 5
Servo for panning: Pin 6
LDR Circuit:[Image 2]
The potentiometer is to calibrate when it detects the laser is blocked off.
Make sure to calibrate the LDR Circuit to the surroundings.
When laser is shine on the LDR, the output should be 5V.
When laser is blocked off, the output should be at 0V.
Step 6: Code
There are alot of values at the top of the code which can be tweak and play around with.
Things needed to be changed based on the servo you're using:
SERVOPANSTOP, SERVOPANMSFOR180, SERVOTILTSTOP, SERVOTILTMSFOR90, SERVOTRIGON, SERVOTRIGOFF
There are also some codes for calibration of LDR Sensors.
Just use the serial monitor on arduino(57600 baud rate) to see the current output the LDR are producing.
Attachments
Step 7: Setting Up for Action!
Make sure the LDR is calibrated and the laser is pointing at it.
Panning:
This video shows the gun turning to the preset angle when my hand block the LDR from sensing the laser.
Gun In Action:
This video shows the gun moved to the preset angle and trigger being pulled when the trip-wire system senses an obstacle.

Participated in the
Arduino Challenge
12 Comments
10 years ago on Introduction
use this with: https://www.instructables.com/id/Arduino-Controled-Nerf-Vulcan/ and chaos is sure to follow
11 years ago on Introduction
I hate this there are lots of good or funny ideas but i don't find any part of the project i hate germany -.-
11 years ago on Introduction
Would like more/better video. This is unclear about what's happening in the vid. Great project, we'd like to see it working fully!
Reply 11 years ago on Introduction
Thanks for your comments. I have added a small description for each of the video to help the viewer better understand what I'm trying to show.
Reply 11 years ago on Introduction
Thanks, that is helpful. You may consider setting up something of a more complete example of the project working. Something where a person walks in front of the wire and is squirted with water or illuminated with light. While I can see that your project works, it would be more satisfying for a few of you to put together a video that shows it working in a more dynamic way.
Are there any film students at your school or a school nearby? Maybe they need a sentry gun for a spy video...
11 years ago on Introduction
Very well done.
11 years ago on Step 5
How do you make these nice pictures with the broadboard and servo pictures? Is there a program to make them?
Reply 11 years ago on Step 5
http://fritzing.org/
Reply 11 years ago on Step 5
Thank you very much !
Reply 11 years ago on Step 5
;)
11 years ago on Introduction
*NOTE* THIS PROJECT IS DONE BY A GROUP OF STUDENTS FROM SINGAPORE POLYTECHNIC.
Since owning a gun in that country is illegal and more likely if caught with one would be either dead or a very long prison sentence.
I did similar project and used a toy robot arm to hold the paint ball pistol and used a video camera using software that detects motion and the gun would point at where the motion is detected and fire.
This project you do the same with a radio shack light beam used in stores at their doors..
11 years ago on Introduction
@ rinusdamen: It is Fritzing. Go to - fritzing.org