A good friend and I have had a long standing "contest" to see who could build a small robot to navigate a path first. Now, my cohort could have beaten me to the punch on this any time he wished. His technical expertise is far beyond my own. He hasn't, though, and this has been a great opportunity (several years in the making) for me to learn about embedded electronics. After all this time, I am pleased to announce the completion of a very imperfect path navigating robot.
The tracking algorithm is very simple. The robot travels forward until it gets close to a barrier, then it "looks" around to find the best direction to turn. It can choose to turn 45 degrees either direction, however I biased the code for 90 degree turns. If the 45 is truly the best path, it can be utilized.
The bot appears a bit epileptic. This is because it has a tendency to track ever so slightly to the left. Every few clock cycles I have it track back the other direction.
This view shows the front of the 'bot. I love the Sharp IR sensors. They make it look like Johnny 5.
In the picture below, you can just make out the circuit board. The two cables to the left are for programming and serial communications.
Like other, similar projects, this one uses two servos to move the bot forward. They have been modified to turn continuously instead of moving to specific angles.
There are a whole slew of improvements I could make. The bot really should have four stationary sensors to help it track a straight line. This would help eliminate the stutter when it moves. Also, the Sharp IR sensors are bad in two ways. First, their range is only good for about 3 ft. Even that is questionable, and if an object gets too close, the sensor reports that it's farther away. That could be a problem.
There is also a lack of electrical power on the machine. It could really benefit from using a rechargeable battery pack.