Using the NXT Sound Sensor

The NXT Sound Sensor measures the intensity (volume) of sound using the microphone on the face of the sensor. For example, you can use the sound sensor to make your robot react to a loud sound such a hand clap.
Sound Sensor Data
The Sound Sensor can give the following data:
DataTypeRangeNotes
Sound Level (dB) Numeric0 to 100Sound level, scaled to a percentage (0-100%)
Sound Level (dBA) Numeric0 to 100Sound level, adjusted to approximate human ear sensitivity, and then scaled to a percentage (0-100%)
The Sound Level (dBA) value is adjusted to approximate the sensitivity of the human ear to different frequencies. This means that sound frequencies that are heard by the sensor but are hard for you to year will not result in a high sound level value.
Tips and Tricks
Quiet sounds and normal talking usually result in sound levels less than 50%. A hand clap or loud voice will usually produce a level greater than 50%.
Examples Using the Sound Sensor
Some examples of how you can use the NXT Sound Sensor in your program are shown below.
Example 1: Start Your Robot with a Clap
This program makes your robot start driving when you clap your hands. It uses the Wait block in the Sound Sensor – Compare – dB mode to wait until the sound level rises above 50%.
Example 2: Sound Controlled Speed
This program makes your robot drive forward, with the speed of the robot controlled by the sound level. The louder you yell at the robot, the faster it will drive! The program uses the NXT Sound Sensor block in the Measure – dBA mode to get the sound level on a Numeric data wire. The result is wired to the Power input of a Move Steering block to make the sound level control the motor power. The process is repeated in a Loop so that the motor power is continuously adjusted based on new sound readings.
Blocks that Can Use the Sound Sensor
The table below lists the different programming blocks that can be used with the NXT Sound Sensor. Each block will have different modes for the dB and dBA data provided by the sensor.
BlockModeUse
Wait Sound Sensor - CompareWait for the sound level to reach a certain value.
WaitSound Sensor - ChangeWait for the sound level to change by a certain amount.
Loop Sound SensorRepeat a sequence of blocks until the sound level reaches a certain value.
Switch Sound SensorChoose between two sequences of blocks based on the sound level.
NXT Sound SensorMeasureMeasure the sound level and get the result on a Numeric data wire.
NXT Sound SensorCompareCompare the sound level to a threshold and get the result on a Logic data wire.
Data LoggingSee Data Logging.
NXT Sound
Quick links