4. Following lines, going to the rescue



Following a line is one of the most used techniques in Robotics to help robots get an orientation indoors. You will see factory robots following lines to carry objects from one place to another without human intervention. There are different ways to do this and in this video, the IR-array sensor at the bottom of the motor board is used to get the robot to follow a line.

The Arduino Robot starter kit comes with five infrared sensors at the bottom of the motor board. This enables it to measure the reflection of infrared light and detect the different qualities of the material underneath. For example, by analysing the reflected infrared light, it is possible to distinguish whether the colour of the surface is light or dark.

In this example, a racing track is created by drawing a black line over a white surface. The different sensors read data that will be used to feed a PD algorithm. PD stands for Predictive-Derivative and it is used to make a decision on how centred the robot is on top of the line. Ideally, for the robot to follow a line, the central IR sensor needs to be straight on top of the track and the algorithm needs to be “clever” enough to steer the motors towards it.

PD techniques gather signal data from the five sensors to make an expert decision on where to move next. You will see how, after loading the “Line Following” example, Xun and David play with the parameters of the PD algorithm to adjust the robot's behaviour so that it is at its best.

The line-following algorithm is designed to detect dark lines on clean-white surfaces. The PD method runs on the robot's bottom board, and requires very little interaction from the user. The next example is called “Rescue”. In this case the IR-array is used in a more creative way. Upon detection of a black line covering all the IR sensors at once, the motors will stop. In a modified version of the previous track, we can see how the robot finds an obstacle and pushes it out of the track, then coming back to the line and moving forward.

The next video in the series will show how to use images and sound on the Arduino Robot. Make sure to subscribe to the next video tutorial by the Arduino team here.