Long story short, I now have a computer controlled laser cannon muhahha!
The whole thing is controlled via serial commands, which let me:
- Control pitch (Y) and yaw (X)
- Turn the laser on and off
- Make the laser flash or not
- Follow a pre-programmed "sweep" pattern
- Control whether or not the laser turned off while moving and on again
I started by sending the commands by hand from the Arduino IDE, but then I wrote a Java app that let me control all the options using a GUI, which made things a lot easier. It can also record the position of the laser at given times, and play these back, allowing the laser to follow a path:
Finally, I added some physical aiming controls (two variable resistors to control X and Y). This makes it a lot easier to point it at objects, and I can use it along side the Java interface.
If you want to build your own, the Arduino PDE file is here. There's not much actual "building" required - if you have two servos, Blu Tac them together and sticky tape a laser pointer on the side. I'm using a heavy shot glass as a frim base for mine ;)
The laser pointer and servos drew too much power for my Arduino to handle on its own, so I have them hooked up to an external 4.5V supply. The servos have a separate +V and signal wire so they were easy enough to wire up, but I had to use a transistor to switch the laser pointer.
I'm not quite finished the Java app yet, but if you're interested leave a comment and I'll post what I have so far.