The next thing little robot needed was the ability to sense its environment. I ordered a MaxBotix EZ4 sonar from Sparkfun for less than $30, and with a little nervous soldering today got it connected up to the robot. The obstacle avoidance code is very simple – if the robot detects an obstacle sufficiently close, it turns left a little. An earlier algorithm had both left and right turning but needs some work to prevent excessive oscillations.
Below is a little video of the robot navigating around the hallway and avoiding a moving beslippered object (me).
robot081231
Today at around 4pm, a little baby bot was born. Oliver helped me with some of the design decisions, and with measuring and calibrating the little guy. He weighs about 2lb (including batteries), and is 14″ long. At this stage, he is blind. He does, however, diligently follow instructions fed to him as a program down a USB cable. After each programming, we remove the USB cable and he is reborn, newly obedient.
One of the lessons I learned with this robot was that the electronics and programming are at most half the challenge. What caused the most problems was the mechanical part. In the end, I settled for an old iPhone box for the body. We carefully cut holes in the sides for the motors, making the motors fit as snugly as possible to minimize wobble. Even so, a couple of folded pieces of paper and an earplug are used to pack the motors more tightly.

My first little Robot
It works! I built the beginnings of a little robot today. I have an Arduino Diecimila connected to a circuit built on a breadboard around a TI SN754410 Quadruple Half-H Driver, connected to two Pololu Gearmotors . I followed recommendations found in various net places to reduce motor noise by wiring each motor with 3 capacitors – fiddly work with such small motors, and followed a very clear example I found in a course on the web to hook up the Arduino via the H-Bridge to a motor.
I wrote some code to drive each motor forwards or backwards at a chosen speed, and on top of this wrote routines to drive the robot forwards, backwards, clockwise or anticlockwise. After a little debugging it all works. Only problem now is… the robot has no body, just guts.
I had in mind a Ferrero Rocher box for a transparent, light, appropriately sized body, but the particular – formerly ubiquitous – size which I wanted is nowhere to be found. I may have to cannibalize some tupperware.