Before You Begin




What’s the point?

To help students understand that, like a touch sensor, a light sensor detects information from the environment. The program then uses this information to determine the direction it will flow.

To help students understand that different kinds of sensors specialize in the different kinds of information they detect. In designing a robot, the designer must consider the kind of information available in the environment and use the appropriate sensors and programs.

To give students additional opportunities to compare programs that use sensor input to those that do not.


What you will need:

   For each group:

·    The Robotics Inventions™ kit

·    A disk

·    A copy of the Technical Guide

·    Light sensor attachment building instructions, Constructopedia, pages 34-35

·    A small flashlight

·    A set of reflection stands (See A Note on Materials)

·    A building bin (optional)

·    Student Activity Sheets



   For the class:

·    One pre-built Roverbot with a light sensor attachment

·    Posterboards—one white, one black

·    Transparencies # 6 and 7


Programs usedStartLight (to initialize all three input ports for the light sensor); Linetracker; StopNow; StopShine.


About the Light Sensor


Return to Top


New Commands introduced in this activity


          Tech Guide


     Tech Guide
© The LEGO Group


Tech Guide
© The LEGO Group



    Tech Guide
© The LEGO Group




(See Additional Programming Highlights)

Activity overview

By now, students have had some experience working with sensor input. In this activity you will introduce the light sensor, a sensor that detects light information.

First, you will introduce the need for a light sensor using one of several options.

If you choose to introduce it by the example of a robot tracking a line, you will use the Linetracker program. Students will observe and will be quite impressed with the jiggling nature of its behavior. First you will run it on the track provided with the Mindstorms™ kit. Then you will remove Roverbot from the track, placing it on plain paper, first on white paper then on black. Students will observe that Roverbot turns one way on white and the opposite way on black. From this behavior they will infer that the RCX has a way of telling when it’s on a dark area and when on a bright area. You will then show them the light sensor, explaining its function.

If you choose to introduce the need for a light sensor by analogy to the touch sensor, you will place a white posterboard next to a black posterboard. You will then remind the students of the robot that hit the wall and stopped, asking them to think of how a robot would know to stop if instead of a wall it had a black posterboard. It will be obvious to students that a touch sensor could not obtain that information and they are likely to suggest a light sensor (or a sensor that can tell light from dark).


Next, you will have students work in small groups. Since the nature of light input is more abstract than the press and release states of the touch sensor, you will have the students first work on getting light readings from different surfaces. This will help students understand that different surfaces reflect different amounts of light. Only then you will have students work on solving problems using information detected by a light sensor.

As students work in small groups, you will direct them to take light measurements from the relevant surfaces and to use these measurements to set the thresholds in their programs.

Finally, you will have a class discussion, comparing the Table Bumper (if students didn’t have a chance to build it, consider building one for demonstration) and the light sensor as devices that can get information from the environment and inform a program that can prevent Roverbot from falling off the table.

Return to Top

Prepare Ahead:


1.       Make enough copies of the Lighten Up! student activity for each student to have one.

2.       Make the Reflection Stands (See A Note on Materials box).

3.       Download the StartLight program into slot #5 of an RCX. This program must run at least one time before you can get light sensor readings from View on the display window. (See Important Note in the box, page 6-2.) The StartLight program has 3 light sensor watchers, one for each port. By running this program once, you configure all three ports for a light sensor.



4.       Prepare a Roverbot to track a line (If you choose to demonstrate in Whole Class Activity).


Suggestion: We recommend doing this part of the Prepare Ahead section after you have had a chance to read through this Lighten Up! activity guide.

a)      Build a light sensor attachment, following building instruction on pages 34 an 35 of the Constructopedia.

b)      Connect the light sensor attachment to one of the Roverbots, placing the connector wire on input port #1.

c)      Place Roverbot so that the light sensor is directly above the black line on the Track Sheet provided in each Mindstorms™ kit. Use the View button on the RCX to get a light reading, and write it down. Then move Roverbot so that the light sensor is directly above the light (white) area. Write down the light reading you get here.

d)      Open the Linetracker program. Look at the light ranges set for “if light” on each event watcher. Check the reading with the light sensor above the black line to see if it falls within the 25..38 range set in the program. (For example, if your reading of the black line was 34 and the range set in the program is 25 to 38, you do not have to adjust the range. However, if your reading was 23, you must change the program to include the number 23 in the range set for this event watcher.) Do the same for your light reading with the light sensor pointing at the white background.

e)      Download the Linetracker program into slot #5.

f)        Place Roverbot near or on the dark track and run it on program 5. It should track the edge of the black line if the ranges are correct.


Important Note: Ambient light conditions may change from one day to another or at different hours of the day. If your Linetracker does not behave as expected, check the light readings and see if they fall within your dark and light ranges. Change the ranges as needed.

Also, turning on/off overhead lights may help, because it will change the light readings, and they may then fall within your set ranges.



Programming for Light Sensor Input



 Return to Top