... | ... | @@ -29,8 +29,8 @@ |
|
|
>
|
|
|
> #### Plan
|
|
|
>
|
|
|
> We made a program similar to the SonicSensorTest called SoundSensorTest, but changed it to use the sound sensor and
|
|
|
> get the readings using the readValue() method of the SoundSensor class.
|
|
|
> We made a program similar to the SonicSensorTest called SoundSensorTest (see fig. 1), but changed it to use the
|
|
|
> sound sensor and get the readings using the readValue() method of the SoundSensor class.
|
|
|
>
|
|
|
> ```
|
|
|
> public class SoundSensorTest
|
... | ... | @@ -67,7 +67,7 @@ |
|
|
> identical claps in a row.
|
|
|
>
|
|
|
> To compensate for the inconsistency we decided to use a smartphone and transmit a constant tone. The setup is
|
|
|
> showed in the picture below. The car was placed on a table in the middle of the room and loudness were measured
|
|
|
> showed in (see fig. 2). The car was placed on a table in the middle of the room and loudness were measured
|
|
|
> from different distances:
|
|
|
>
|
|
|
> ![P1](http://gitlab.au.dk/uploads/group-22/lego/62d5a5f655/P1.png)
|
... | ... | @@ -86,10 +86,10 @@ |
|
|
> | 4 | 9-11 |
|
|
|
> ##### Fig. 3: Table of sensor reading.
|
|
|
>
|
|
|
> The table shows the distance between the sound sensor and the sound source and the value read by the sensor.
|
|
|
> We used a phone to play a constant tone at the maximum volume. The highest readings came from the closest distance
|
|
|
> and once the distance increases the sensor readings decreased gradually. When the distance was above 4 metres the
|
|
|
> readings went down to the background-noise level. This might change if we used another sound source.
|
|
|
> The table (see fig. 3) shows the distance between the sound sensor and the sound source and the value read by the
|
|
|
> sensor. We used a phone to play a constant tone at the maximum volume. The highest readings came from the closest
|
|
|
> distance and once the distance increases the sensor readings decreased gradually. When the distance was above 4
|
|
|
> metres the readings went down to the background-noise level. This might change if we used another sound source.
|
|
|
>
|
|
|
> ---
|
|
|
> # Exercise 2 - Data logger
|
... | ... | @@ -106,13 +106,13 @@ |
|
|
> #### Result
|
|
|
>
|
|
|
> The DataLogger was used to log data from the sound sensor. The experiment consisted of a period of 10 seconds in
|
|
|
> which consecutive snaps were made with the fingers. The graph below shows the results:
|
|
|
> which consecutive snaps were made with the fingers.
|
|
|
>
|
|
|
> ![G1](http://gitlab.au.dk/uploads/group-22/lego/093160e740/G1.png)
|
|
|
> ##### Fig. 4 Recording of a sequence of four finger snaps. The graph shows data logged from the NXT while running the SoundSampler program.
|
|
|
>
|
|
|
> The graph shows four distinct spikes in the sound level caused by the finger snapping. The spikes peak at 30-50
|
|
|
> dB before the sound level goes back to its normal. The background noise measured is about 2-10 dB.It is
|
|
|
> The graph (see fig. 4) shows four distinct spikes in the sound level caused by the finger snapping. The spikes peak
|
|
|
> at 30-50 dB before the sound level goes back to its normal. The background noise measured is about 2-10 dB.It is
|
|
|
> interesting to note that the spikes increase faster than they fade away. This observation can be due to resonance
|
|
|
> or echo from the sound waves which take some milliseconds to fade away.
|
|
|
>
|
... | ... | @@ -129,9 +129,9 @@ |
|
|
>
|
|
|
> #### Result
|
|
|
>
|
|
|
> The test was conducted on a table where the car was controlled using voice commands. When the car detected the
|
|
|
> first spike it would drive forward, when it heard the second it would turn left, on the third it would turn right
|
|
|
> and on the fourth it would stop.
|
|
|
> The test was conducted on a table where the car was controlled using voice commands (see fig. 5). When the car
|
|
|
> detected the first spike it would drive forward, when it heard the second it would turn left, on the third it would
|
|
|
> turn right and on the fourth it would stop.
|
|
|
>
|
|
|
> [![image alt text](http://img.youtube.com/vi/wlh4UXzuPlk/0.jpg)](http://www.youtube.com/watch?v=wlh4UXzuPlk)
|
|
|
> ##### Fig. 5: Video of the clap controlled robot in action.
|
... | ... | @@ -149,7 +149,6 @@ |
|
|
> used to stop the program. This does not work when the program loops in one of the four inner loops. You can make
|
|
|
> the ESCAPE button always work as a program terminator if you also poll the state of the button in the inner loops.
|
|
|
> But you can also use the ButtonListener mechanism to listen for the ESCAPE button and exit when ESCAPE is pressed.
|
|
|
> A simple example of a ButtonListener can be seen in the leJos tutorial, [ref. 6]. Try this in the program.
|
|
|
>
|
|
|
> #### Plan
|
|
|
>
|
... | ... | |