I explored the possibility of implementing the XO Acoustic Tape Measure (Distance) algorithm on the Lego NXT brick. To ensure that the Distance algorithm would generate reasonably measurements, the NXT hardware needed to meet some basic requirements.
Component | Requirement |
---|---|
Speakers | To play sounds louder than ambient noise |
Sound Sensors | To detect sounds from an NXT speaker |
System | To record and play sounds simultaneously |
To use the algorithm with three or more participants, the NXT needs to have two more capabilities.
Component | Requirement |
---|---|
Speakers | To play distinctive sounds louder than ambient noise |
Sound Sensors | To detect distinctive sounds from NXT speakers |
For the Java programming environment setup for the Lego NXT, please refer to my Lego Learning project.
The Lego NXT speakers are capable of playing a specified frequency (Hz) at a specified volume (% of the system sound) for a specified duration (ms).
The following audio demonstrates the NXT’s ability to play different frequencies at a fixed volume. I programed the NXT to play at 200 Hz, 400 Hz, 600 Hz, 800 Hz, and 1000 Hz. All sounds were played at 100% volume for a duration of 1 second on and 2 seconds off.
The following audio demonstrates the NXT’s ability to play different volumes at a fixed frequency. I programed the NXT to play at 20%, 40%, 60%, 80%, and 100% its maximum volume. All sounds were played at 800 Hz for a duration of 1 second on and 2 seconds off.
Although the NXT speakers are not particularly loud, from these preliminary tests it would seem the NXT speakers should be adequate for the Distance application in reasonably quiet environments.
The Lego NXT sound sensor detects sounds in two modes, decibels (DB) mode and adjusted decibel (DBA) mode. In DB mode, all sound frequencies are measured with equal sensitivity, and the sound sensor is capable of detecting some sounds that are too high or too low for the human ear to hear. In DBA mode, however, the sensitivity of the sensor is adapted to the sensitivity of the human ear. In other words, the sensor attempts to ignore sounds that humans are unable to hear.
Using DB and DBA modes to detect ranges of frequencies has been studied previously. We need to know, however, whether or not the capabilities of sound sensor are adequate to distinguish frequencies generated by the NXT speaker.
In this experiment, I programed one Lego NXT brick as a sound generator that played tones at a range of frequencies. I programed another Lego NXT brick as a sound receiver that recorded all sounds it heard and printed those recorded values to the LCD in real time. The generator and reciever were placed within one inch of each other.
The following chart shows the recorded values per frequency for DB and DBA modes.
This experiment demonstrated that the NXT sound sensor is able to distinguish sounds produced by the speaker of another NXT. Both DB and DBA modes were adequate, although the largest, most stable range of distinguishable frequencies were in DB mode between 800 and 1400 Hz.
In this experiment, I programed one Lego NXT brick as a sound generator that played a fixed frequency, which was determined as the most sensitive frequency from the previous experiment, 1100 Hz. I programed another Lego NXT brick as a sound receiver that recorded all sounds it heard and transmitted those recorded values to my PC. The generator and reciever were placed within one inch of each other.
The following chart shows the recorded values for DB mode. Sounds were played at 100% volume for 0.5 seconds on and 0.5 seconds off.
This experiment demonstrated that the NXT sound sensor does not record sound as frequencies (oscillations). Even though it can capture aproximately 5000 samples per second, the frequency of the sound is lost, and only the amplitude is reported. In other words the raw data captured by the sound sensor is insufficient to distinguish sounds of different frequencies.
This experiment also demonstrated that the NXT is easily able to detect pulses of sound when they are louder than ambient noise. The levels reported by the sound sensor rose quickly and consistently after the generation of the tone.
In this experiment, I programed one Lego NXT brick as a sound generator that played a fixed frequency, which was determined as the most sensitive frequency from the previous experiment, 1100 Hz. I programed another Lego NXT brick as a sound receiver that recorded all sounds it heared and printed those recorded values to the LCD in real time.
The following chart shows the recorded values in DB mode. Sounds were played at 100% volume at a distance ranging from 0.5 inches to 38 inches.
This experiment demonstrated that the NXT sound sensor can distinguish sound from another NXT within only 30 inches (0.7 meters). This greatly reduces the usefulness of implementing the Distance algorithm on the Lego NXT, especially considering the fact that the accuracy of the algorithm is greatly diminished when the sender and receiver are in close proximity.
During the aforementioned experiments, I noticed that echo greatly affects the sound measurements. When the sound receiver was located next to a corner and the sound generator was located away from the corner but facing it, the receiver recorded approximately 25% higher.
In this experiment, I programed a Lego NXT brick to record sounds as it played them simultaneously. This operation worked flawlessly.