Light Sensor (Color Sensor)

The light sensor enables the robot to “see” light intensity and colors. We prefer to call it color sensor. It can differentiate between most basic colors and thus help the robot act accordingly when it detects or does not detect your color of choice.

Attaching a Color Sensor

Please refer to pp. 68-72 of the EV 3 Manual (Building Instructions) for a color sensor facing downwards, and pp. 73-75 for a setup with a forward-facing sensor.

Programming: Step-by-step Instructions

Image of EV3 light sensors

These two files have step-by-step instructions on how to program the color sensor, including screenshots of every single step:


Exercise: Moving along a Black Line

Please find a printable version of this exercise HERE.

This example is great practice that shows how the color sensor can be used to guide the robot’s movements, i.e., along a black line.

Instructions:

1) First, put a <Switch Block> inside a <Loop Block>.
Add two <Move Steering Blocks>.
Set the <Switch Block> for the <Color Sensor> to <Compare> <Color>.
See figure below:

2) Next, select the color of the line you wish to follow. Make sure only the color you want is selected.

3) Then, fine-tune the motors’ steering, rotations, and power until the robot moves along the line as desired. Note this is contextual and may take some adjustments for the robot to follow the line.

Please find a printable version of the “Moving along a Black Line” exercise HERE.


© 2019 Dr. Krista Francis & Stefan Rothschuh