Learn 4: Experiment With Color Sensing

4. Calibrating the Color Sensor

          • Place the robot on top of the printed color calibration sheet with the color sensor above the red square, exactly as we did when we tested the sensor.
          • Click on the Calibrate Color Sensor button.

We have told the robot the order of the color samples on that sheet. Armed with that knowledge it will calibrate its color sensor as follows:

      1. based on its sensor reading, light up its right eye the color that it thinks it has seen
      2. re-calibrate its settings for that color to match the sensor readings
      3. light up the left eye to confirm the color that it has just re-calibrated
      4. drive forward to the next color sample on the sheet and repeat 1-3 above

Once it has completed color calibration, the eyes will flash on and off.

What we are doing here is replacing the pre-defined default settings for each color with the red, green, blue and clear values read in the current environment.

After calibration has been completed, check the sensor accuracy by re-running the calibration. You should notice that the robot’s guesses (right eye color) will now match the confirmed color samples (left eye color).