Make your own, custom AUTONOMOUS SENTRY GUN!
A Microcontroller Contest Finalist and Runner Up Winner.
This instructable is out-of-date. For the most recent version of the tutorial, see the website . Cheers!
This sentry gun autonomously tracks, aims, and shoots at targets, using:
-An airsoft or paintball gun
-A webcam to find targets
-A computer to process the video feed and aim the gun
-Servo motors to physically aim the gun and squeeze the trigger
-A sturdy tripod base
-A microcontroller to interface between the computer and the servo motors
-Lots of camo paint
The end result is a paintball/airsoft spewing robot, that can turn the tides of any match.
Video if it in action here .
Want to build your own?
You’re in luck! All the help and information you will need is here, and the software is free and open-source. Lots of people have already used this system in their own sentry guns, with successful results.
So go ahead, make your own, and soon your own backyard will be no-man’s land, too!
P.S. take pictures during the project, and when you are finished, send me a picture, and a description of your project, and I will feature it on the Successful Projects page of my website. Thanks!
Step 1: Parts List
Airsoft / paintball gun, or other ‘projectile dispenser’
$25 Arduino (or equivalent)
$27 3 Servo motors (pan, tilt, trigger) $9 ea.
$10 Assorted screws, nuts and bolts
$9 Wood/metal for construction
$5 USB A to B cable
$2 Some 22 gauge solid wire
$2 Servo battery box
Also, you will need a laptop or computer to run the sentry gun program. $250 for a cheap netbook, if you don’t have anything else…
Step 2: Arduino
What’s an Arduino? …and how do you pronounce that, anyway?
An Arduino is a microcontroller. It plugs into a computer with a USB cord. On the Arduino board, shown below, there is an ATMega328 microchip, as well as 14 digital input/outputs, 6 analog inputs, and a USB port.
That’s not all, but it’s everything that you will need to know about, to build a sentry gun. For complete details on the Arduino board, go to http://arduino.cc/en/Main/ArduinoBoardUno.
You will use the Arduino board to take commands from the computer, and drive the servo motors as the commands dictate. Also, it will provide you with hookups for expanding your own ciruit easily afterwards.
Step 3: Servo Motors
The “pan” servo controls the side-to-side movement of the gun.
The “tilt” servo controls the up-down movement of the gun.
Your remaining servo motor will be used to squeeze the trigger of your gun.
For heavy guns, such as the paintball gun shown below, you might want to get some stronger servo’s
Step 4: Constructing the Base
Now is time to put everything together. How you do this is largely up to you.
Some design considerations:
The gun should be balanced on the tilt servo. Find the gun’s center of gravity, and mount it at that point. This is so the servo dosn’t have to waste energy trying to keep the gun level. IMPORTANT: when the servo has no power supplied to it, the gun should tilt freely, and when you move it with your hand it should not return to level – rather it should stay right where you let go. Spend a lot of time getting this balance just right, it is a major factor in the effectiveness of your finished sentry.
Stability is key. You want a strong, solid sentry. Vibration will cause a lot of issues with the camera later, if you don’t suppress it now. I’m not going to teach you how to build well, but keep in mind that screws and bolts are better than nails, nails are better than zip ties, zip ties are better than staples, and even staples are better than duct tape.
The webcam must be solidly mounted to the base. You want it close to the gun, but the gun barrel can’t ever move into the camera’s view – it will see that as a target. Also, the webcam should be as solid as possible – vibration from the servo’s and gun firing will mess it up.
Depending on the expected use for the sentry (airsoft? paintball? water jet? laser?), you may need to add a durable compartment to hold the electronics.
Finally: tripods are cool, but they can be prone to a lot of shaking if built badly, or if you use a flimsy camera tripod. Surveyor’s tripods are great for sentry guns – they are heavy, stable, and often adjustable too.Step 5:
Step 5: Wiring
The Arduino connects to the computer through the USB A to B cord. This also powers the Arduino. Various other things wire to the Arduino:
Here’s a wiring schematic , and you can get a sentry shield if you want an easy solution
box color=”#985D00″ bg=”#FFF8CB” font=”verdana” fontsize=”14 ” radius=”20 ” border=”#985D12″ float=”right” head=”Major Components in Project” headbg=”#FFEB70″ headcolor=”#985D00″]
$5 USB A to B cable
$2 Some 22 gauge solid wire
$2 Servo battery box[/box]
For more detail: Autonomous Paintball Sentry Gun using Arduino