Sparkfun published a great tutorial about building a face-tracking robot, and it inspired me to build one of my own. I had been thinking about how to do robot vision for a while, and this tutorial helped put the pieces together for me.
My version of the robot uses the ServoCity SPT200 Pan & Tilt system mounted on top of a large project box. Inside the project box is an Arduino Mega (overkill, but I had it lying around and decided to use it) with a custom shield I built using the Sparkfun Arduino Prototype shield. The USB cable provides both power and data communication from a laptop which runs the control software. Mounted on the Pan & Tilt system is a nice Logitec HD web cam with a USB connection and a nice grip-mount designed to mount onto the lid of a laptop. I also mounted a small laser which I powered from the Arduino. I have 2 switches on the back of the project box to control power to the board, and power to the Laser. For the Pan/tilt configuration, I used a pair of standard-sized Hitec analog servos with Karbonite gears for a good balance of strength and durability.
It’s probably not my best idea to mount a laser onto the platform that is designed to point at a face (due to safety reasons), but with proper aiming, the robot does a good job of hitting the target in the chest, which was my goal. The extra switch for the laser is an extra safety measure I use when aiming and configuring the robot.
The software was what I was especially excited to dive into. This was my first exposure to Intel’s OpenCV Processing Library, and I was really impressed. I found it easy to use, and had a working prototype up and running quickly thanks to the Sparkfun tutorial. That gave me confidence to tinker around with some of the other options and learn a bit more about the library. The Arduino IDE is based on Processing, so I had only a minimal learning curve with the new development environment.
A drawback of the software is that I need to leave the camera feed size small in order to get good performance from the robot. Running at higher resolutions require more horsepower than my laptop could provide. It doesn’t look as impressive when demonstrating it, but it gets the job done.