Light at the Beginning of the Tunnel





Name of Activity

Light at the Beginning of the Tunnel




NXT, car, light sensor, tunnel, drive, reverse, ambient light



Grade Level

4, 5, 6


1 Hour Total

Brief Description

In this activity, students will build or be provided with a pre-built NXT car with a light

sensor attached. Students will program their NXT car to drive into a tunnel and then

reverse out of the tunnel when the ambient light gets too dark. The car will stop when

the ambient light increases and the car is out of the tunnel.

Lesson Objectives:

– To program light sensors according to the ambient light in the surrounding environment.

Materials Needed:

– NXT Car.

– Light sensor.

– Tunnel.

– Computer running LEGO NXT software.

Preparation and Set Up:

Set up computers running LEGO MINDSTORMS NXT Software.

Build a tunnel that is large enough for an NXT car to drive into.

Arrange students in pairs.

Distribute necessary materials.

Necessary Background

This activity can be introduced as designing a safety feature for your car so that it does not drive into an unsafe, dark area.


  1. Have students build or provide a pre-built NXT car with a light sensor attached to the front of the car.
  2. Use MINDSTORMS NXT to program the NXT car.
    1. Check the ambient light value inside and outside the tunnel. To do this:
      1. Turn on the NXT and place it where you want to take your reading.
      2. Use the key pad to scroll over until you find the “View” option.
      3. Select the “View” option using the orange center button.
      4. Scroll over until you find “ambient light”and select “ambient light” using the orange center button.
      5. Scroll over to select the port that the light sensor is wired to. A percentage value should appear on your screen.

  • Program your car to drive until it read a darker value a little bit above the reading that you got in the tunnel.
  • Program your car to drive backwards until it reads a light value that is a little less than the ambient light value in the room.
  • Test the cars. If the car does not respond as you wish, try changing the value that the light sensor is searching for.
  • Extensions or Modifications:

    Have students program their car to stay in the tunnel, this can be related to an animal who cannot leave its home in broad daylight without being eaten.

    Reference 1

    Reference 2

    Reference 3

    Leave a comment

    You must be