Documentation Center

  • Trials
  • Product Updates

Contents

LEGO MINDSTORMS NXT Acceleration Sensor

Measure acceleration along three axes

Library

Simulink Support Package for LEGO MINDSTORMS NXT Hardware

Description

Measure the linear acceleration along the X, Y, and Z axes of the NAC1040 HiTechnic NXT Acceleration / Tilt Sensor.

The axes of the sensor are oriented as shown here.

For each axis, the sensor measures -2 g to +2 g of acceleration. The sensor outputs approximately 200 counts per g.

    Note:   The SI equivalent of 1 g is 9.8 meters per second squared.

You can use this sensor to:

  • Determine the orientation of the sensor, for example in a self-levelling robot.

  • Measure small and moderate acceleration forces, such as road surface vibration and acceleration in a vehicle.

  • Detect larger acceleration events, such as a collision.

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 Acceleration Sensor

View the changing outputs of an acceleration sensor as you change the orientation of the sensor.

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

Connect the Acceleration Sensor block to the LCD blocks, as shown.

Double click each LCD block to open the block masks for each block.

Use the Display at line parameters to select a different line number for each block.

Use the Display label parameters to add an X, Y, or Z label for each line.

Connect the Acceleration sensor to Port 1 on the NXT brick.

Prepare and run the model on the NXT brick.

Move the Acceleration sensor about and observe the outputs on the LCD.

Position the Acceleration sensor on a table and systematically change the orientation of the sensor. The horizontal axes, such as X and Y in the following illustration, output values near zero. The vertical axis, such as Z in the following illustration, measures Earth's gravitational acceleration and therefore outputs a value near 200. If you invert the Z axis from the position shown, the sensor outputs a value near -200.

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.

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?