Intro: Das Uber Airsoft Gun Turret
This Instructable will show you how to Design, Build and Trouble Shoot an Airsoft Gun Turret with a USB interface. The turret can be toggled between Manual Mode, where a Human interfaces with it using an Xbox 360 Controller, or Automatic Detect and Fire Mode, where the turret springs to life and detects any human presence in its surroundings. Firing at Humans is not advised.
A Special Thanks to Colin. For helping me with the WebCam calibration concept way back when.
Visit my blog, for all other details not contained in this instructable.
Update: HACK-A-DAYPost checking out the turret. Very flattered from these guys words.
Step 1: Get an "Electronic" Airsoft BB Gun. and Slice It Open.
If you are in the U.S. Say just as the title says, go to any Department Store and buy one.
Look for guns that look easy to cut or to take apart.
After you've got your gun, open it up (follow this guide).
As you can see, it is very simple. If you power the motor, you fire the pistol. Before you hack it open you do this by closing the circuit by pushing a switch with your finger as you pull the trigger. But there are many, many ways to close an electric circuit, and you can get very creative. In this project we are going to use Relays to do that.
If you are not in the U.S, this may take some doing.
I am obviously not in the U.S. but I got Lucky. A friend of mine gave me his.
'(Gracias Pinche Bronzon!! Ahi esta el Robot que te dije que iba a hacer con tu Pistola.)'
If you are in Mexico: 'jalense a los bazares o a los mercados y busquen a la gente que vende cuchillos y pistolas tipo militar. las tiendas de chucherias afuera de los super mercados (Soriana y la Comer y demas) a veces las tienen. De ultimas, preguntenle a algun amigo que le gusten las gotchas si tiene una o sabe donde comprarla. En Mexico es comun que vendan gotchas y Airsoft Guns en las mismas tiendas.'
Step 2: Get Phidgets.
Phidgets are a bunch of awesome USB interfaces that rock out.
They always send you stickers with their order.
The Phigets we are going to use for this project are the servo controller, and the relay controller, or InterfaceKit 0/0/4.
While your phidgets get to you through the mail, it's a good idea to get your computer ready. Follow the next step to do so.
I know you can fire a relay with the two extra ports of the servo controller, but that required an additional circuit and I was to lazy to make it. But YOU can make it. Just have something check the servo signal until it hits certain value and fire a relay from there. You can use a PIC or one of the AVR tiny uCs to do this.
Step 3: Prepare Your Computer.
We will use an Xbox 360 gamepad to control the Turret. I think it is serves very good as interface for a pistol.
Being this the case, we need to use a Windows environment to program. And we ALL know that is a bitch.
First, get your hands on the followings SDKs. Windows SDK and Direct X 9.0c or above.
Also, you will want to get the Phidget Library of your choice. I'm going to do this in VC++ because I can get it working with the two other libraries required to make this robot. The Direct X library, and the Intel OpenCV Library.
These are all powerful tools and are behind some very very cool things, so treat them with respect!
It's a good idea to get an IDE up and running now if you don't have one and go through some of the code examples.
All the code for this robot is done by mashing together the SimpleController example from the DirectX Xpad library, the Servo and the 0/0/4 Interface phidget code examples, and the face recognition code example from OpenCV.
Check Linker errors if you are using the Microsoft Visual Studio Express CD that comes with the Phidgets.
Once you have all of this working properly, your Phidget order should have arrived!
Step 4: Phidgets and Gun
Use the phidget relays to close the circuit between the motor and the power supply.
If for any reason you can't make your code work, and you really want to fire your BBs, go to the Phidget Manager, in the task bar next to the clock. You can fire the BB gun from there.
If you are using an AC/DC converter to power the gun instead of batteries, make sure it can draw at lears 1.5 Amps of current, since the motor needs a bit of current to start.
Remember to shoot when there is no one in front are anything stupid like that.
Don't fire at people.
Step 5: Phidgets and Gamepad
Use the SimpleGamepad example to change the boolean variables in the InterfaceKit example Code.
Once that is done.
You should have Gamepad + Phidgets and Airsoft gun all working in unison. And hopefully you can do something like the attached video.
If you are done, it's time you build our two DOF mechanism to mount our turret.
Step 6: The Mechanism.
We are going to make a two DOF mechanism similar to this one, and this one.
I used CAD to help me, and I share it with you.
It uses two Servo Motors, two bearings, wood and plexyglass.
I eliminated one of the 'Y' motors in the end and replaced it by a Ball Bearing.
The image also shows the gun facing backwards.
Step 7: The Push Bearing.
The push bearing is the key to have a smooth control over the 'X' axis movement of the robot and it should be mounted on a cut round piece of Plexiglas.
Step 8: Attach the Plexy Glass
Attach a piece of round cut Plexiglass to the Push Bearing.
Step 9: Cut the Wood
Get your hand dirty and use some tools to cut the wood. I approached a professional to do this.
If you live in Mexico: ' Aqui es donde nos desquitamos. Ya que cortar madera de una manera de tal manera de que sea util y estetica despues, se necesitan herramientas mamonas. Y en Mexico hay muchas carpinterias pequenias donde se pueden hacer este tipo de cosas por un precio infimo! Nosotros nos pusimos a ayudar y nos hechamos unas chelas con el carpintero en Mexico.'
After you enjoy a Beer with your Local Carpenter, proceed to assemble the wood pieces.
These can be even be pasted with White Glue. I used it, at least. Use anything you think does the work best.
Step 10: Gun Bed.
Add pair of extensions to your BB Airsoft Gun.
One will be attached to a Bearing that will smooth out movement in the 'Y' Axis of the turret and the other will be attached to the Servo that will, well, create the 'Y' Axis movement.
Using hot Glue, Add a USB Web Camera PCB to the front, and run the cable under the Gun Bedding.
Step 11: Ball Bearing
A nice Ball Bearing to hold our turret.
Step 12: Couple the Shafts
Couple the Servo Shaft with the Gen Bed arm.
Step 13: Mount the Push Bearing
Now you should have a dry wood structure. Mount the Push bearing.
Step 14: Sand the Wood
Sand the wood, and add another Web Cam to the bottom of the structure.
Place it over some News Papers and get it ready to paint.
Step 15: Cover the Servos!
Be nice to your servo motors and cover then (and their shaft) with a little paint.
Step 16: Paint the Thing
Have it reflect your favourite lenghtwave of the electromagnetic spectrum with a nice liquidy plastic coating.
I went with the same colors as the Gamepad.
Step 17: Leave It Out to Dry
At least half an hour!! More of you can.
Step 18: Add Some Stickers
Our robot has lasers, there is no such thing as a cool robot with out lasers. So the robot must carry the appropriate warning stickers.
Step 19: Get Some Lasers
Get some cheap Laser.
Step 20: Cut Them Up
Cut them up with the Dremel and then short the switch, as shown in the third picture.
Warning! I don't know if this is dangerous.
Step 21: PCB
Print a PCB on a Toner Printer (a.k.a laser printer or Copy Machine).
Then, Iron the piece of paper on to a slab of copper. Then, drop it in the Acid.
Step 22: Clean and Sand the PCB
After putting the copper in the acid, keep rocking it for about 15 minutes.
Take it out carefully, sand it. and then drill it.
Step 23: Solder
Introduce all the component leads into the holes of the PCB and solder it.
Step 24: Stuffing
Stuff the inside of the robot with all the components.
Step 25: Attach the Lasers
Use some thermofit and to fit the Lasers to the barrel of the pistol.
Step 26: Voila!
If you have questions about the programing, just ask me. but you can do it just by following the examples very easily.
If you want to know how to wire up the indicator LEDs or decorative LEDs, follow my other instructable. Or any other one of the trillions of guides out there.