The first step in programming any line follower is to get an idea about where the robot is relative to the line it has to follow. For this purpose, infrared sensors or reflectance sensors are used. These sensors detect the amount of light reflected off a surface. A black surface reflects much lesser light compared to a white surface, and thus reflectance sensors can be used to detect the presence of a black line on a white track.

The assembled Zumo Robot has an array of 6 reflectance sensors on the lower surface. Using the output from the 6 sensors we can detect the relative position of the Zumo Robot with respect to the black line. For any generic line follower, you would have to combine the output ofall the reflectance sensors in a sensible way. Fortunately, the 'ZumoReflectanceSensor' block in the ZumoBot library does that for us and gives us one single numeric value ranging from 0 - 5000. From the numeric value, we can get an idea of where the black line is relative to the Zumo Robot. This is illustrated in the diagrams below:

learn_arduino_centerSensor.png

learn_arduino_rightsensor.png

learn_arduino_leftsensor.png

Since a numeric value of 2500 corresponds to the center of the Zumo Robot being above the black line which in turn corresponds to moving forward without turning, we can use that value as the reference.

If the numeric value exceeds 2500, then the robot is on one side of the black line, and if the numeric value is below 2500, then the robot is on the other side of the black line.

To make things easier, we can subtract 2500 from the output of the 'ZumoReflectanceSensor' block in which case any positive difference implies that the robot is on one side of the line, and a negative difference implies that the robot is on the other side of the black line. This difference between the reference value and the actual value is also known as the 'error' signal

The block diagrams responsible for these steps are shown below:
In the above block diagram, the 'ZumoReflectanceSensor' block returns a numeric value as output. We then subtract 2500 from the numeric value to obtain the error signal which is then pushed further to the controller block. We will discuss the controller block on the next page.

This guide was first published on May 19, 2014. It was last updated on May 19, 2014.

This page (Acquire Sensor Input) was last updated on Sep 08, 2021.

Text editor powered by tinymce.