NXT Sound Sensor

Measures sound level from the NXT sound sensor

Library

Simulink® Support Package for LEGO® MINDSTORMS® EV3 Hardware / NXT Sensors

Description

The NXT Sound Sensor block reads the sound level measured by the NXT sound sensor connected to LEGO MINDSTORMS EV3 brick.

During simulations without hardware, this block emits zeros. See Block Produces Zeros or Does Nothing in Simulation (Simulink).

Use the Sound Sensor

  1. Open the legoev3nxtlib block library and copy the NXT Sound Sensor block to a new model.

  2. Open the legoev3lib block library and copy the Display block to the same model and connect these blocks.

  3. Connect the sound sensor to port 1 of the EV3 brick.

  4. Prepare and run the model on the EV3 brick as described in Run Model on EV3 Hardware.

  5. Move closer to the sensor and make sounds. Observe the measurements on the LCD display of the EV3 brick.

Parameters

EV3 brick input port number

Select the EV3 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 sound data to output:

  • Normalised (0 - 100) outputs the intensity of the sound on a scale from 0 to 100. 0 is the weakest intensity and 100 is the strongest intensity.

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

Sample time

Specify how often the block reads sensor values. This value defaults to 0.1. Shorter sample times, such as 0.01, may produce unreliable measurements.

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

Introduced in R2018a