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
Crossman R-71 Airsoft gun
Arduino Mega Protoshield from Sparkfun
VEX 9.6V battery
(2) VEX Continuous Rotation motors
VEX Extension Cables
Assorted electronic parts *See airsoft gun electronics page
Assorted VEX metal
Assorted VEX screws and nuts
(2) VEX 84-tooth gears
VEX 12-tooth gear
VEX 36-tooth gear
(optional) Laser pointer
(optional) Wireless Camera
Hot glue gun
Step 2: Constructing the Base
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
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
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 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
For more information on communicating with the Arduino Mega click here.
Step 7: RoboRealm Set-Up
xvalue = GetVariable("xvalue")
yvalue = GetVariable("yvalue")
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
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:
Attach the turret to an autonomous car
Track a laser pointer