The Idea
*Build videos at bottom
A few months ago, I decided to build an airsoft gun turret that could automatically aim at people. With Halloween approaching, I decided to repurpose that project into a Halloween version, and I landed on an eyeball for the spooky replacement to the airsoft gun. Most of the documentation refers to the original airsoft version, but that's okay - it works pretty similarly.
How Does It Work?
A Kinect V2 handles the body tracking (if you didn't know, Kinects are pretty cool for this, and it's a shame that the consumer-friendly versions are no longer in production).
The Kinect data is processed by a desktop app, which was built with Unity. This app scans through the tracked body parts, determines what is important, and performs some trigonometry to get the angles that the turret needs to face the target. It then figures out what state it should be in (waiting, tracking, firing, etc). Based on that state, the turret version issues voice commands to the would-be intruder - I disabled these for the eyeball, but there is potential to put some creepy sounds in. There are also a few simple gestures that can be used to change the state (hands up, or the secret deactivation gesture), but these don't actually matter for the eyeball.
Once all that is done, the app sends the angle data and firing state via serial port to an Arduino (an Adafruit Metro Mini, in this case). The Arduino code is pretty simple. It just processes the incoming bytes, sets the angle on a pair of servos - one for the horizontal rotation and one for the vertical, and sets a signal to a relay for firing in the turret version.
I built a mount out of a piece of scrap wood. It lets me attach the Kinect and eyeball at a known distance, which helps with the trig calculations. And for the final display, I covered all the mechanisms with black fabric to hide them.
Mechanism and Physical Design
The eyeball itself is just made out of a styrofoam dome from a hobby store. My wife painted the eye details and glued some red yarn to it for the bloodshot look. I also wrapped the eye in plastic wrap and shrank it down with a heat gun to give it a glossy look.
The eyelid is made from paper mache, molded over a similar styrofoam dome. I trimmed it up, cut it in half to help with positioning, and covered it in fabric that has a leathery skin look.
In order to allow the dome to rotate around smoothly, I used the top of a roller ball bottle. This gave me a ball that was already mounted in a socket. I cut a length of plastic tube and glued the roller ball to the inner center of the dome. The plastic tube is cut such that the roller ball is perfectly centered inside the sphere that the dome would make. This means that as the roller ball rotates, the eyeball dome rotates perfectly around its own center.
I then mounted the roller ball lid to a length of wire strong enough to support the whole assembly, and stapled that wire to the wood base.
To rotate the eye in the X and Y directions, I use two servos. I made a little around for each servo out of K'nex pieces. I then cut lengths of stiff wire that connect the servo arms to the edges on the eyeball - one on the side for X movement and one of the bottom for Y movement. This part was actually a bit tricky. You need to loop the wire through the styrofoam so that it can move smoothly as the servo arm moves.
To mount the servos, I made some brackets from a straight piece of aluminum that I bent and cut notches out of. I just kind of eyeballed it when making and attaching these (get it? eyeballed).
The eyelids are mounted with some more wire - it's flimsy, but it gets the job done.
Build It Yourself
- Build the physical eyeball as described above.
- Plug in a Kinect and install the drivers
- Download the Kinect SDK Unity Pro Package here: https://developer.microsoft.com/en-us/windows/kinect/...