Eat your heart out, Aibo

Why buy a robot that follows a colored ball when you can spend hundreds of hours building your own?


Dept.: You Built What?
Cost: $200
Time: Many long nights
Practical | | | | | Popcorn

It’s midnight and I’m exhausted. For 200 hours, I’ve been caught in a mind-numbing loop: unplug, tweak code, compile, load, plug in, pause for sigh and brief prayer. Once again, I crouch on the floor and wave a pink ball in front of my half-built friend, whom I’ve named “Pinky the Robot Who Follows a Pink Ball.” He doesn’t, and I’m crushed, but I can’t stop because I’m very close. So close that Pinky’s starting to creep me out a little.

Anyone who can solder can build a robot from a kit, but take away the plans and the parts you need and the know-how and now you’re living-scrounging the toolbox for brackets and switches, browsing that deserted section of RadioShack, dragging your battered brain through a thousand tiny victories. You’re a dreamer! A scientist! Even (what the hell) a genius!

At least that’s the journey I imagined when I found a robotics vision system called the CMUcam on Carnegie Mellon’s toy robots initiative site ( There I saw clips of robots following brightly colored objects and knew I had to build one. The folks at CMU pointed me to, where I bought the camera, a few servos and wheels, and a microcontroller called the BrainStem.

The CMUcam lacked written instructions, so I spent the first couple of hours looking at a picture and soldering capacitors into the wrong holes. Then I fed the BrainStem some simple C code and modified the servos to give them 360 degrees of motion. So far, so good: I had eyes, legs and a brain.

The next step was to make Pinky prefer pink. I knew the theory: The BrainStem asks the CMUcam what it sees, and then directs the servos to move the robot until the pink object is in the center of the cam’s frame. Apparently, this all happens over serial ports-but in what language? How does a serial port work? I was in way over my head.

Panic. Desperation. Frantic Googling. Finally, I stumbled across a similar project on the Acroname site, an orange-
obsessed robot complete with posted code I could steal and modify for my own pink-loving purposes. Easy . . . except that it didn’t work at all.

I’m ashamed to tell you how long I tweaked and tested that code until, many skipped meals later, I discovered the single troublesome line: some snippet about the camera’s auto-gain and white balance values. Driven by frustration and hunger, I decided auto-gain and white balance were stupid and just deleted the line. I hooked everything together, stuffed the guts into the BrainStem’s cardboard box (note to self: find new body before BattleBots appearance) and put Pinky on the ground to meet his destiny.

Pinky, however, seemed more interested in thrashing around nonsensically, then scooting off under the couch. The motor-control functions I wrote had given him the equivalent of an inner-ear infection and a debilitating limp.

After several more hours of trial and error, I got my first glimmer of hope: During one of our training sessions, Pinky spun adroitly out of view of the ball I was holding and stopped dead in front of a chair, head upturned. I thought the battery had died until I noticed that he was staring wistfully at my wife’s pink tote bag, twitching back and forth to get the best possible view. Eureka. Pride welled up inside me and spilled out in a single tear. A little more code massaging had Pinky juking and weaving like a ball boy at Wimbledon.

For $1,800 I could have bought a Sony Aibo that does the same thing (OK, it does lots of other things too), but the trick itself has little staying power. I build robots for that moment when the chaos crystallizes into entirely expected yet somehow surprising behavior. Pinky’s not shiny and cute, nor does he have a tail to wag, but he represents many hours of my sweating and swearing, and for that, I love him.

Check here for a simplified explanation of Pinky’s creation.

Go to this link to download Pinky’s code and learn more about his creation.