Hack Your Usb Missile Launcher Into an "Auto-aiming Autoturret!"

by toelle in Circuits > USB

107188 Views, 100 Favorites, 0 Comments

Hack Your Usb Missile Launcher Into an "Auto-aiming Autoturret!"

usbmissilelauncher.jpg
wiimote.jpg
usb.JPG
How to make your usb missile launcher aim on it's own.
This instructable will teach you to turn your usb missile launcher in an autoturret which will find and aim at IR targets. (sorry only IR targets)

What You Need!

wiimote.jpg
usbmissilelauncher.jpg
What do I need?

You need:

1 wiimote:
a bluetooth enabled pc
1 Usb missile launcher (duh!)
Ducttape
GlovePie (Programmable input emulator) You can download glovepie from: http://glovepie.org/poiuytrewq.php
A little bit of programming experience (not really necessary but, helps you understand the programming part better)

Preparation

usb.JPG
Use ducttape to fasten your wiimote on the top of the missie launcher. Make sure the missiles are still able to fire. The wiimote should point forward, and be placed in the middle of the missile launcher like on the picture. Be sure not to cover the 1 and 2 buttons on the wiimote, because you need to be able to press them in order to connect them to your PC (see next step).

Connecting the Wiimote

soleil.jpg
Now connect your wiimote to your pc. If you already know how to do this, you can skip this step.

If you are using bluesoleil do this: Open bluesoleil and press the red/orange ball in the middle of the screen, this will make your pc scan for bluetooth devices. While your pc scans, press and hold the 1 and 2 buttons on your wiimote (the LEDs should now start blinking) when your computer finds your wiimote you can release the buttons again. The wiimote device should appear on your bluesoleil screen as something like "Nintendo RVL-CNT-01" or something like that. Now double click the new wiimote device your pc found. This will make it scan for possible services. The mouse icon should now turn orange. Click the mouse icon. If the wiimote icon turns green you have successfully paired your wiimote to your computer.

Programming Part1

glovepie.jpg
With your wiimote properly connected to the computer you should be able to use glovepie scripts with it. Open GlovePIE and enter this:

debug=wiimote.dot1x

if wiimote.dot1y<462 then keyboard.Down=true else keyboard.Down=false
if wiimote.dot1y>562 then keyboard.Up=true else keyboard.Up=false

if wiimote.dot1x<462 then keyboard.Left=true else keyboard.Left=false
if wiimote.dot1x>562 then keyboard.Right=true else keyboard.Right=false


The first line isn't really necessary but it helps you see if your wiimote works properly.
The 2 next lines handles the horizontal aiming. and the last 2 handles the vertical aiming. It does this by pressing the right buttons in the missile launcher software based on where the IR target is. If your missile launcher software uses anything other than the arrow keys for aiming, you will need to tweak the code.
If you have more than one wiimote connected to your pc, then replace the "wiimote" with "wiimote" followed by what number wiimote you want to use. For example, if you use your second wiimote for this you would write "wiimote2". If you are unsure about what number you should use, just put "wiimote" without the number there and GlovePIE will most likely figure it out by itself.

Programming Part 2: Shooting a Missile

The following lines of code will take care of the Shooting mechanism.
Now at the end of the script add this:

wiimote.Led1=wiimote.dot1vis
wiimote.Led2=wiimote.dot1vis
wiimote.Led3=wiimote.dot1vis
wiimote.Led4=wiimote.dot1vis


This will make the LEDs on the wiimote light up whenever it can "see" an infrared light. This makes it easier for you to see if the wiimote receives any IR signal.

Now we are going to add the shooting.
This is going to be a little more complex than the previous lines of code, but i hope you understand it. At the end of the script add the following:

if wiimote.dot1vis=true then {
if wiimote.dot1x>412 and wiimote.dot1x<612 and wiimote.dot1y>412 and wiimote.dot1y<612 then {
keyboard.Enter=true
keyboard.Enter=false
}
}


The first line checks if the wiimote can "see" any IR signal. The 2nd line checks if the IR light is in the center of the wiimotes "field of view". If it is, the launcher should be aimed correctly, and the launcher will shoot a missile. If your missile launcher software does not use Enter for firing the missiles, you should change "keyboard.Enter " to whatever key your software uses.

Finished

usb.JPG
Now you have a fully autoaiming wiimote/missile-launcher turret.
Open your missile launcher software, and connect the missile launcher. If you've set up everything correctly, you can go ahead and start the GlovePIE script by hitting run, then switch over to your missile launcher software and watch as the missile launcher aims and shoots at IR targets.
It will be able to aim at anything that emits InfraRed radiation, like a candle, remote controller or the wii sensor bar. If you run into any problems or have a question for me, leave a comment or send a private message, and I'll be glad to help.