The servos arrived from HobbyKing an unfortunately short amount of time before the start of Bad Ideas, so I had only three days to build, test, and calibrate the sentry.
The pan-tilt assembly was made from scraps of aluminum I found around MITERS. I used as thin metal as possible to make the sentry light and responsive, and also easy to machine within my time constraints. The tilt axis is entirely supported by the servo's output shaft, while the panning is supported by a small set of lazy Suzanne bearings, with the servo in the center.
I removed all the unnecessary parts from the airsoft gun, like the trigger, handle, sights, and other decorative plastic bits.
To control the small DC motor that fires the airsoft gun, I just wired some small NPN transistors I had in parallel and added a diode across the motor output. I heatshrinked over the whole thing to make it look like a real motor controller.
I used the webcam from a 2006 iMac computer. Although these webcams are internal, they run over USB. I spliced its four wires to those of a standard USB cable, and stuck the camera just below the pan-tilt assembly.
To get the Project Sentry Gun code to work for my setup, I had to make a few minor modifications. First, I completely erased the stock firing code and replaced it with one line to simply turn the fire pin on the Arduino to HIGH. Also, by default, the motion tracking bit of the software has a lower limit for the size of moving objects it will target. It locks onto the largest moving object above this threshold. In addition to the lower limit, I added in an upper limit, so the turret will track things that are roughly mouse-sized, but will ignore larger things like people.
With no target, the crosshairs on the webcam overlay are thin:
If the object is too large, it is ignored:
With no target, the crosshairs on the webcam overlay are thin:
When there is a small target, the crosshairs are thick and the target is boxed in red:
If the object is too large, it is ignored:
That's cool. http://www.realsentrygun.com/ has even better systems for that kind of stuff. Have you seen their videos? Crazy stuff!
ReplyDeleteThanks. That software is neither free nor open source though.
DeleteYou had to pay for that arduino. Their 'starter kit' comes with a better servo controller, the software, battery leads etc and is $50. THat's cheaper than what you paid. I've tried both systems and the RealSentryGun.com system performs far, far better. They've been around a lot longer so their stuff is much more refined. Their stuff was used by Valve, the discovery channel, and other shows. You gotta have higher standards man ;)
Deletegreat stuff!
ReplyDeleteany videos of it in action?
Do they jitter when the pan and tilt system moves? Since I think you didn't put gears in them.
ReplyDelete