Here’s another iteration of an Arduino controlled autonomous floor robot. This one uses a Tamiya gearbox and servo steering, with infra-red and touch sensors for obstacle detection.

The robot chassis is built from Fischer Technik and a rectangular section plastic downpipe fitting. The parts are held together with screws, plastic cable ties, gaffer tape, glue and rubber bands.

A Tamiya double gearbox powers the back wheels. The white spacer between the gearbox and the red plate of the robot is a PVC downpipe adapter. In this project, both motors are always driven in the same direction and speed.

A basic Futaba servo steers the Fischer Technik front wheels. The front axle is screwed to the servo horn and cable ties attach the servo to the chassis.

One of the challenges with this kind of robot is that whatever sensors you use they only work with 80% of household obstacles. For this robot we used two Sharp infra-red distance sensors pointing slightly left and right. The Sharp sensors have quite a narrow beam. Setting them pointing outwards works well for detecting approaching walls, but leaves a dead-spot in the centre that misses narrow objects like chair legs. The infra-read sensors also miss low (15-35mm) obstructions that the robot can’t drive over.

To deal with things that slip past the IR sensors, we added a touch sensor bar to the front, about 35mm above the floor. This is made of two strips of wood. Two microswitches were glued with epoxy to one strip and the second strip is positioned in front of the switches so that the switches are closed if the front bar hits anything along its length. The front bar was hinged with gaffer tape. This touch sensor gets quite a beating so it needs to be strong and well attached.


The motorshield controls the two DC motors in the gearbox. Separate 9v NiMH battery packs provide power for the Arduino and the motors.

The touch sensors and IR sensor are wired to analog ports on the Arduino and polled to detect obstructions.


The software that controls the robot has a simple set of rules:

  • if an object is detected within a few hundred millimeters on either side the robot steers away from that side until the obstruction is no longer detected.
  • if an object is detected close up on either side, or moderately close on both sensors, the robots backs up and turns. The turn takes it away from whichever side is closer to the obstruction.
  • After the robot backs up, it remembers the turn direction for 3 seconds. Without this rule the robot could back up in alternate directions, leaving it still pointing at the obstruction.

The Arduino source code for this project is at and you can download a zip file here.


  • Arduino Duemilanove
  • Adafruit motorshield
  • Tamiya double gearbox with wheels
  • Sharp GP2Y0A02YK0F IR distance sensor. The IR distance sensors sensors come in several versions, optimised to work over different distances. We used one designed for 200 – 1500mm range.  The GP2Y0A21YK0F which works over 100 – 800mm, and has a wider beamwidth, might be a better choice
  • 5mm square section wood strips for the touch detector
  • 2 x microswitches, recovered from an old mouse
  • plastic cables ties, epoxy glue, rubber bands, M3 machine screws and nuts.
  • 2 x 6-cell AA battery pack and NiMH batteries
  • Fischer Technik baseplate, axle and wheels


This robot negotiates the floor fairly successfully. Going forwards the sensors detect pretty much everything. The main problem is that the robot is fairly tall. Some overhangs or sloping chair legs can strike the top of the robot without being detected by the IR sensors or hitting the touch sensor. Similarly objects  that fit under the touch sensor stop the robot.

There are no sensors on the back of the robot, so it’s unaware of hitting something while backing up. The robot can get stuck in a close space where the robot can’t back up, but the IR sensors show an obstruction. When the happens the robot will backup continuously without success. This situation could perhaps be improved with some software changes.