Sunday, December 11, 2011

Arduino IR Wall Following Robot

This robot built for the Introduction to Mechanical Engineering class at the University of Minnesota follows a wall using input from 3 infrared sensors mounted on the front of the robot, one facing front, one facing 45 degrees to the right of the front sensor, and one facing 45 degrees to the left of the front sensor.

The sensor readings detect the presence of walls in front and to the sides of the robot, this information is then fed into the arduino, which determines which of the two motors to turn on to avoid (turn away) or find (turn into) the wall. The arduino "sees" a wall if the sensor reading is below a defined value that is calibrated for each sensor.

The robot initially starts out moving in a straight line until it sees a wall, and an integer is stored that tells the arduino which side of the robot the wall should be located. If a wall is seen, the arduino turns on the motor closest to the wall, turning the robot away from the wall. If no wall is seen, the arduino uses the wall integer to turn the robot back towards the wall. When a wall is seen in front of the robot, it uses the wall integer to determine which way to turn to avoid collision.