Yeah, I’m terrible at updating this blog. Going to work on fixing that.
Ok so a while back I got the missile turret on thinkgeek. The actual company is dreamcheaky. http://www.dreamcheeky.com/thunder-missile-launcher
It only ships with a cheap gui app to control it. However, lots of people online quickly figured out how to talk to it in their code via USB.
I also got Sparkfun’s inventors kit for Arduino recently (Yeah I’m late to the party :P) https://www.sparkfun.com/products/11227
So I decided it would be fun to combine both and make myself a laser trip wire activated missile launcher!
From what I could tell, Python was the easiest way to talk to the missile launcher. I don’t really know Python, but I was able to get something working.
I started off by cloning the stormLauncher project on GitHub https://github.com/nmilford/stormLauncher
Had to install PyUSB since it’s being used to communicate with the missile launcher. http://sourceforge.net/apps/trac/pyusb/
PyUSB uses libusb so you should make sure that’s installed. For windows use libusb-win32 http://sourceforge.net/apps/trac/libusb-win32/wiki
The wiki explains how to install it for a certain device. For the Thunder Misslie Launcher its:
1 2 |
|
Now came time to test the stormLauncher code. It didn’t seem to work for me. I don’t remember what errors I was getting so I decided to look into the code and strip it down to try and see if I can get it working.
I got a test working with this:
1 2 3 4 5 6 7 |
|
Using an arduino and photo sensor, I made a trip wire that just sends the value of the sensor through the serial cable. I used the same circuit as in this tutorial: http://arduino.cc/en/Tutorial/SwitchCase
The sketch is quite simple. Just output the light level.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
After that I looked up how to do serial communication with python. Basically the program reads the serial input coming from the arduino. Once the value passed by the arduino hits a certain threshold, this means the laser is no longer in contact with the light sensor so fire away! I got the light value by testing around with the laser so that might have to change. I also added a sleep time because the missile launcher isn’t the fastest. Note that I have code in there to remove the “Light level: ” part that is sent. I could/should have just ommited that so that I didn’t have to parse it out.
Like I said I don’t really know python so this was the result of playing around and reading a few things online. It works but it can be improved.
Here is the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|
My next plan is hooking up the missle launcher to my RaspberryPi and and having the light sensor hooked up to an XBee Module. This way it’s more mobile.