Introduction: Arduino Airsoft Turret
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:
Step 1: 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
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
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
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
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.
Attachments
Step 7: 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.
Attachments
Step 8: Video Example
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

Second Prize in the
National Robotics Week Robot Contest

Participated in the
Microcontroller Contest
29 Comments
6 years ago
I should make one in my room, but somehow it hsould now me, this way my brother won't get into my room again!
Reply 6 years ago
I will take this to the paintball next time :) Just sit back in the cover and watch them scream!
6 years ago
Great Pal, congratulations for your effort.
7 years ago
Nice idea! When did the idea came up to you?
8 years ago on Introduction
i like it but why do you have too take off the barrel?
(great aim!)
8 years ago on Introduction
next project: face detection :D
8 years ago on Introduction
can you make me one, i have no clue what these words mean
9 years ago on Step 5
Where do you explain how to connect the servos??? Also is it necessary to use VEX servos??? Great ible by the way. Thanks
9 years ago on Introduction
It was beautiful. I hope good luck on the next project
10 years ago on Introduction
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.
11 years ago on Introduction
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!!!
Reply 10 years ago on Introduction
Mostly yes you will probably need better motors for moving the gun around
Reply 11 years ago on Introduction
Check out this link: https://sites.google.com/site/projectsentrygun/home
A lot of cool stuff, helpful to.
Reply 11 years ago on Introduction
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.
12 years ago on Introduction
Great work! I'll trade you some autonomous code for some joystick code... https://sites.google.com/site/projectsentrygun/
Reply 11 years ago on Introduction
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
11 years ago on Step 8
That was awesome :D
11 years ago on Step 3
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
12 years ago on Introduction
Does it have to be an Arduino Mega or can it be any other Arduino because I kind of have a tight budget.
-TheWaddleWaaddlle
Reply 12 years ago on Introduction
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.