loading
Picture of Arduino Airsoft Turret
National Robotics Week Robot Contest: Age Group 13-18 

Whether you are fighting in an airsoft battle, or defending your desk at work, an airsoft turret is a must have.  In this Instructable I will explain how to make a relatively cheap and simple turret based off of an Arduino Mega.  Once you have the basic turret built, there are many cool things to add that can make the turret a lot more complex and fun to play with.



Here is an example video of what you can do with the turret:

 
Remove these adsRemove these ads by Signing Up

Step 1: Materials and Tools

Picture of Materials and Tools
While it seems that there are a lot of parts required, this project can be done on a relatively cheap budget depending on where you buy the parts.  The following parts are what I used to make my turret, they do not have to be exactly the same.

Parts:

Crossman R-71 Airsoft gun
Airsoft bullets

Electronics:
Arduino Mega
Arduino Mega Protoshield from Sparkfun
BlueSmirft-Bluetooth Modem
VEX 9.6V battery
(2) VEX Continuous Rotation motors
VEX Extension Cables
Assorted electronic parts *See airsoft gun electronics page

Structure:
Assorted VEX metal
Assorted VEX screws and nuts
(2) VEX 84-tooth gears
VEX 12-tooth gear
VEX 36-tooth gear
VEX axles

Miscellaneous:
FoamCore board
Wire
RoboRealm Software
Joystick
(optional) Laser pointer
(optional) Wireless Camera


Tools:
Hot glue gun
Saw
Soldering iron
X-Acto Knife
Wire cutters/strippers
Solder
Computer



Step 2: Constructing the Base

Picture of Constructing the Base
crossbeam.jpg
The base is one of the most important parts of this project.  It protects all of the electronics and gives the main turret a surface to operate on.  I recommend making the base out of foamcore board because it is very sturdy and relatively easy to work with.  In essence the base is just a cardboard box.  The dimensions are not exact, you just have to make sure the box is big enough to hold all of the electronics and batteries. 

The following steps are a rough plan on how to make a sturdy base:

Cut out 4 pieces of foamcore board 5"x9.5"-These will act as the walls.  One key step that makes the turret work a lot smoother is cutting out a notch to rest the cross beam in.  In the photo you can see where the cross beam sits in the middle of the box.

Cut out 2 pieces of foamcore board 9.5"x9.5"-These will be the top and bottom of the base.  On the top piece make a hole in the very middle of one of the pieces.  This is where the main axle will go.  Make another hole 2.5" away for the drive axle.

Hot glue all of these pieces together making a strong and sturdy box. 

The base is finished!

Step 3: Modify Airsoft Gun

Picture of Modify Airsoft Gun
airsoft gun cuts.JPG
In order to make the turret move smooth and quickly, we need to make the gun lighter and less bulky.  I started out with the Crossman R-71.  I took off the rails from the side to make it lighter and I cut off the handle to make it mount easier to a piece of VEX metal, by doing so I also removed a lot of weight from the gun.

To control the gun from a microcontroller you have to use a special circuit.  The following diagram lets you turn the gun on and off by using a digital port on any microcontroller.

In order to hook this circuit up  you have to open up the airsoft gun and find the motor that fires the actual bullets.

Step 4: Build theTurret Frame

Picture of Build theTurret Frame
To build the actual turret frame you need the VEX motors, gears, screws, and nuts.  I recommend using a long piece as the crossbeam to support the turret from underneath.  This piece has the pan motor and gears attached to it.  The entire turret rides on the 84-tooth gear. 

On top of the 84-tooth gear, build a simple U-shaped bracket out of the VEX metal.  This is going to be the bracket that allows the gun to tilt up and down.  On one of the sides of this U-bracket, attach the motor and 12-tooth and 84-tooth gear.  By using a small gear to drive a larger gear, the turret can tilt very precisely and smoothly.

Attach the airsoft gun to the 84 tooth tilt gear.  I did this by hot gluing the gun to the gear and to a piece of metal attached to the tilt axle.

Step 5: Electronics Set-Up

Picture of Electronics Set-Up
The electronics in this project are pretty simple.  The base configuration involves 2 motors, an Arduino Mega, and a Bluetooth adapter.  Nothing else!  But if you wanted to really jazz up your turret you can add all kinds of great accessories, such as a laser pointer, a bumper switch to act as a "kill switch", an ultrasonic sensor to determine how far away a target is, and much more.

The Arduino Mega is perfect for this project because it is a very flexible microcontroller.  There are more than enough analog and digital ports to handle all the accessories that you might use.  While a Bluetooth adapter is not necessary, it makes the turret a lot more functional.  Without the adapter you have a turret wired to your computer, with the adapter you have a wireless sentry gun that can go anywhere in your house(with in range of the Bluetooth).  For information on how to hook up the BlueSmirf adapter see the SparkFun website.

As for batteries, I used the battery that came with the airsoft gun to power the gun.  I just removed it from its plastic case and put it in the box.  I used the VEX 9.6v battery to power the Arduino, the motors, and the BlueSmirf adapter.

Step 6: Talking to the Computer

In order to control the turret and use its full potential, we need to have the Arduino Mega communicate with the PC.  This is done over a virtual serial port using the BlueSmirf adapter.  While there are many different programs that let you communicate over a serial port, I like to use RoboRealm.  RoboRealm is a great software that lets a user analyze video and do different things with webcams, such as motion tracking, tracking a red ball, and much more.  Another great feature of RoboRealm is it supports communication between the PC and many different microcontrollers.  This is accomplished by loading a special program onto the Arduino Mega to communicate with RoboRealm. This attached program should be loaded onto the Arduino Mega.


For more information on communicating with the Arduino Mega click here.


Step 7: RoboRealm Set-Up

Picture of RoboRealm Set-Up
 Using VBScript code you can convert any input into motor commands.  This is the code I used to convert a USB joystick (range:-1000 to 1000) to motor commands(1400 to 1700):

xvalue = GetVariable("xvalue")
yvalue = GetVariable("yvalue")


motorx=round( (xvalue*.2)-1500)*-1
motory=round((yvalue*.3)+1500)

SetVariable "motorx", motorx
SetVariable "motory", motory

Using this simple code you can make the turret do many different things.  For example, if you wanted the turret to track motion you could use the Movement module in RoboRealm to eliminate everything that doesn't move.  Then you could use the Center-of-Gravity Module to find the coordinates of the movement.  Using the above code you could then have the turret track the motion. (You might have to change the middle 2 lines to depending on the range of the input).  The middle 2 lines is where the math is done to convert between the two ranges. The next step shows some different ideas on what to do with the turret.

I attached my code that moves the turret with a joystick.  There are some special features in my code such as a bullet counter, a low bullet warning, and a laser pointer control.

Step 8: Video Example

Picture of Video Example
This is a video of  the turret in action.  The first part of the video demonstrates the turret  controlled by a joystick. You can really see the full range of motion the turret has.  The next part of the video shows the accuracy of the gun.  Surprisingly, the turret is very accurate.  In the video you can see that the gun is so accurate that the 4th bullet doesn't even stick to the target because it hits the previous bullet.  One of the cooler uses of the turret is color tracking.  Using a wireless camera mounted to the front of the turret, I can track a green circle taped to my hand.  The last part of the video shows how this tracking is accomplished in RoboRealm.


In conclusion there are many amazing things that are possible once you have the basic turret built.  Some of the future things I want to do with my turret are:
Wiimote controlled
iPod Controlled
Attach the turret to an autonomous car
Track a laser pointer
r0b0t143 months ago

i like it but why do you have too take off the barrel?

(great aim!)

schulbusl7 months ago

next project: face detection :D

clistul7 months ago

can you make me one, i have no clue what these words mean

marios85431 year ago
Where do you explain how to connect the servos??? Also is it necessary to use VEX servos??? Great ible by the way. Thanks
lpsk2 years ago
It was beautiful. I hope good luck on the next project
rtw17012 years ago
I liked that scene in Aliens where they had the auto turrets killing them off. Also played this lesser know game called Fireteam and u could find auto turrets in there for protection. Looks pretty nice but work places I've worked don't allow weapons even toy ones these days :( Nice accuracy.
could you use a paintball gun for this turret with the same electronics? such as a spider pilot ACS, get back with me on this ASAP PLZ!!!
Mostly yes you will probably need better motors for moving the gun around
Check out this link: https://sites.google.com/site/projectsentrygun/home
A lot of cool stuff, helpful to.
I am currently working on a Paintball Sentry as well so I can tell you don't base it off this instructable as this is built for a much lighter weapon to be mounted. Yes the electronics are the same but as for the same turret very unlikely.
sentryGun534 years ago
Great work! I'll trade you some autonomous code for some joystick code... https://sites.google.com/site/projectsentrygun/
man that amazng work u did i really want to build one i have a question if all i do is use the joy stix will i have to have the pc to power it . what im meaning is if i took it to a air soft game just have the joy stick and mount a laser on on the gun can t run without the pc
Mavamaarten4 years ago
That was awesome :D
bkrause4 years ago
omg, thank you sooooooooo much for that diagram and showing the actual required components , lol, sometimes saying u need a transistor is not enough, but you have shown which ones, so thanks again
Does it have to be an Arduino Mega or can it be any other Arduino because I kind of have a tight budget.

-TheWaddleWaaddlle
12grahamb (author)  TheWaddleWaaddle4 years ago
It can be any Arduino. Changing Arduinos could potentially cause some unforeseen changes though. I chose the Mega just because it has a lot of ports and chances are you won't run out.
Where does the red wire from the Arduino Digital Out Prt go to or is it just not used?

-ThewaddleWaaddle
12grahamb (author)  TheWaddleWaaddle4 years ago
It is not used. You can simply cut it off.
iputra14 years ago
wow it's cool project....
how about using openCV ?...its can more interesting, i think
transuranic4 years ago
SMIRF lol
Did you modify the VEX radio receiver to become a housing for the BlueSMIRF? How did you attach a duck antenna onto a BlueSMIRF?
12grahamb (author)  frank260801154 years ago
Yes, I opened up the VEX radio receiver and took out the electronics. Then I mounted the BlueSmirf in the "hollowed out" radio receiver. I did this just to make it easier to mount the BlueSmirf on any VEX metal. As for the duck antenna, I bought this adapter which fits perfectly with this duck antenna.
CrLz4 years ago
Nice!

Love to see a subsequent ible incorporating autonomous control- robot sentry bot!
Great work!

This is the first of the sentry ible's that can actually convince me to build one!

Although perhaps it would be more accesible if you could perhaps make a "sentry for dummy's" ible because some of the steps like building the gear frame and the electronics aren't really accesible for an amateur noobie like me...

Also a tip, put the video also on the first page ;) with it on the first page you'll avoid show us a video of it comments and it'll generate more attention and traffic :)
your dog4 years ago
Wow really cool! Can't wait to get an Arduino and try this myself!