Changes
Page history
jessvi created page: Lab3
authored
Mar 02, 2015
by
Jesper Kurtzmann Svith
Show whitespace changes
Inline
Side-by-side
Lab3.markdown
View page @
fe723ee4
...
@@ -29,8 +29,8 @@
...
@@ -29,8 +29,8 @@
>
>
> #### Plan
> #### Plan
>
>
> We made a program similar to the SonicSensorTest called SoundSensorTest, but changed it to use the
sound sensor and
> We made a program similar to the SonicSensorTest called SoundSensorTest
(see fig. 1)
, but changed it to use the
> get the readings using the readValue() method of the SoundSensor class.
>
sound sensor and
get the readings using the readValue() method of the SoundSensor class.
>
>
> ```
> ```
> public class SoundSensorTest
> public class SoundSensorTest
...
@@ -67,7 +67,7 @@
...
@@ -67,7 +67,7 @@
> identical claps in a row.
> identical claps in a row.
>
>
> To compensate for the inconsistency we decided to use a smartphone and transmit a constant tone. The setup is
> 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:
> from different distances:
>
>
> 
> 
...
@@ -86,10 +86,10 @@
...
@@ -86,10 +86,10 @@
> | 4 | 9-11 |
> | 4 | 9-11 |
> ##### Fig. 3: Table of sensor reading.
> ##### 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.
> The table
(see fig. 3)
shows the distance between the sound sensor and the sound source and the value read by the
> We used a phone to play a constant tone at the maximum volume. The highest readings came from the closest
distance
>
sensor.
We used a phone to play a constant tone at the maximum volume. The highest readings came from the closest
> and once the distance increases the sensor readings decreased gradually. When the distance was above 4
metres the
>
distance
and once the distance increases the sensor readings decreased gradually. When the distance was above 4
> readings went down to the background-noise level. This might change if we used another sound source.
>
metres the
readings went down to the background-noise level. This might change if we used another sound source.
>
>
> ---
> ---
> # Exercise 2 - Data logger
> # Exercise 2 - Data logger
...
@@ -106,13 +106,13 @@
...
@@ -106,13 +106,13 @@
> #### Result
> #### Result
>
>
> The DataLogger was used to log data from the sound sensor. The experiment consisted of a period of 10 seconds in
> 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.
>
>
> 
> 
> ##### Fig. 4 Recording of a sequence of four finger snaps. The graph shows data logged from the NXT while running the SoundSampler program.
> ##### 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
> The graph
(see fig. 4)
shows four distinct spikes in the sound level caused by the finger snapping. The spikes peak
> dB before the sound level goes back to its normal. The background noise measured is about 2-10 dB.It is
>
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
> 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.
> or echo from the sound waves which take some milliseconds to fade away.
>
>
...
@@ -129,9 +129,9 @@
...
@@ -129,9 +129,9 @@
>
>
> #### Result
> #### Result
>
>
> The test was conducted on a table where the car was controlled using voice commands. When the car
detected the
> The test was conducted on a table where the car was controlled using voice commands
(see fig. 5)
. When the car
> first spike it would drive forward, when it heard the second it would turn left, on the third it would
turn right
>
detected the
first spike it would drive forward, when it heard the second it would turn left, on the third it would
> and on the fourth it would stop.
>
turn right
and on the fourth it would stop.
>
>
> [](http://www.youtube.com/watch?v=wlh4UXzuPlk)
> [](http://www.youtube.com/watch?v=wlh4UXzuPlk)
> ##### Fig. 5: Video of the clap controlled robot in action.
> ##### Fig. 5: Video of the clap controlled robot in action.
...
@@ -149,7 +149,6 @@
...
@@ -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
> 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.
> 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.
> 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
> #### Plan
>
>
...
...
...
...