torsdag den 16. september 2010

LAB.3 - Sound sensor test

Date: 16/9-2010 Duration of activity: 11:15 - 14:
Group members participating: All
_____________________________________________
Schedule for the day:
- Read out measurements value from sound sensor
- making sound measurement with datalogger, udload to PC.
- testing soundcontroled car
- modifying escape button
- Clap detection test

Problems and progress:
- upload problems, reason unknown. Functions if dos-promt i used
- battery low :-(

Results of sensor measurement:
- just in front 60
- 1 meter from, max 40
- 2 meter from, max 53
- Datalogger functions, sample file uploaded to computer.
- SoundControlCar runs through 4 states, strait, left, rigth, stop. reacts on levels above 90. cant se the difference betwen soundtype
- The escape button does not function because the button is only read at certain times. and only if the button is pressed while it looks
-The changes made to the escape is mentioned here

Clap sensor test description and solution

We looked at the link for "A clap counter" by Sivan Toledo for inspiration on how to detect a clap with the NXT brick. The specs of reading a clap is as follows:

- low sound level for 10ms -> high sound level after 25ms -> low sound level after 250ms
The way we tried to program this on the NXT was to calculate the amount of samples from the microphone input into the above time scheme. The NXT brick sample rate is one new sample each 3ms, this means that the total samples needed to register a clap is 250ms/3ms per sample = 83 samples. This offset has to be passed before you can start registering claps.
Also the different significant signs for the clap are calculated into samples:
First sign at 10ms/3ms per sample = 3 samples.
Second sign at 25ms/3ms = 8 samples.
This means that a clap in means of samples will have the following sample requirements:
3rd sample sound level below 25
8th sample sound level above 85
83rd sample sound level below 25
We then programmed a buffer consisting of 83 samples and then simply looking through these samples every time a new sample is received. By doing so we can check if the clap requirements are meat every 3ms.

Final Status:
- We had some problems manipulating the buffer indexes so that we looked at the samples in the buffer in the right order as they where received chronologically. We tried implementing it using the Queue in Java, but this was not a part of the lejos lib.
- We tried to detect the clap in a sequencial way, meaning we checked for the first sign and then setting a flag, checking for the second sign a setting another flag, and ultimatly checking for the third sign and the two other flags, if alle the requirements for a clap has been meat, then they are all true.
We where able to detect the two first signs, so a bit of work is needed for us to be able to detect claps.

Ingen kommentarer:

Send en kommentar