Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Contents

LEGO MINDSTORMS NXT Light Sensor

Measure light intensity

Library

Simulink Support Package for LEGO MINDSTORMS NXT Hardware

Description

This block outputs the intensity of light detected by the NXT Light Sensor. The sensor includes an illuminating LED to actively measure the reflectance of nearby surfaces. For example, the light-intensity under a desk measures approximately 20 while a the light-intensity of fluorescent light is approximately 85.

If you run a simulation of a model that contains this block without the target hardware, this block outputs zeroes. See Block Produces Zeros or Does Nothing in Simulation.

Use the Light Sensor

  1. Open the legonxtlib block library and copy the blocks shown to a new model.

  2. Connect the Light Sensor block to the LCD block, as shown.

  3. Connect the Light sensor to Port 1 on the NXT brick.

  4. Prepare and run the model on the NXT brick.

  5. Point the Light sensor at a variety of well-lit objects and observe the measurements on the LCD display.

    When you point the sensor at a bright light, the measurement value is higher.

    When you point the sensor at a dark shadow, the measurement value is lower.

  6. Hold the Light sensor near a piece of white paper in a dark location, such as under your desk. The red LED in the sensor illuminates the paper. Observe the measurements on the LCD display.

    When you hold the sensor nearer to the paper, the measurement value is higher.

    When you hold the sensor further away from the paper, the measurement value is lower.

Dialog Box

NXT brick input port

Select the NXT sensor port to which the sensor is connected. Avoid assigning multiple devices to the same port. The options are 1, 2, 3, or 4.

Output mode

Select the type of light intensity data to output:

Normalized (0 - 100) outputs the intensity of the light on a scale from 0 to 100. 0 is the weakest intensity. 100 is the strongest intensity.

Raw A/D (1023 - 0) outputs the intensity of the light on a scale from 1023 to 0. 1023 is the weakest intensity. 0 is the strongest intensity.

Turn on red LED

Emit red light from the LED located next to the light sensor. Under low light conditions, the sensor can use this capability to measure the amount of red light nearby objects reflect.

Sample time

Specify how often the block reads sensor values.

Smaller values require the processor to complete the same number of instructions in less time, which can cause task overruns.

See Also

| |

External Web Sites

Was this topic helpful?