Learn 4: Experiment With Color Sensing

3. Calibrating the Line Sensor

          • Print off a straight line sheet from the downloadable line follower template document.
          • Place your robot on this sheet with the line follower directly above the black line, as shown in the image below
          • Click on the Calibrate Line Sensor button in the button panel below the Interactive Control Code cell.

The robot should :

      1. take a reference reading for black [1],
      2. drive forward 5cm [2] and then
      3. take a reference reading for white [3].

The following summary statistics for black and white should be reported in the Notebook under the button panel (your numbers will be different):

BLACK: AVERAGE = 0.07    MINIMUM = 0.03 MAXIMUM = 0.11

WHITE: AVERAGE = 0.76    MINIMUM = 0.63 MAXIMUM = 0.86

To test the accuracy of our line follower after calibration:

          • place the robot over the black line as if it were following it,
          • select Line Follower Sensor from the I2C-1 dropdown list in the sensor control panel.
          • Observe the string of Ws and Bs as you move the robot from left to right.

Does this string accurately reflect the position of the line relative to the center of the sensor?

If you haven't done the Extension: Line Follower Explained in Mission 4, you could take a look now if you're curious about how this works.