Friday 17 September 2010

Working with Sound

Starting up:
Participants: Johan & Jakob
Date: 16/9-2010
Duration: 3 Hours
Goal: Attach the Sound sensor to Failbot 9797 and test the sensor as described in the given exercise.

Building the robot was not a challenge, other than locating the correct blocks in the box.

Analyzing the input
After creating a basic program similar to SonicSensorTest.java, but with respect to the sound picked up by the sound sensor, we tested the sensor by producing various noises at different distances and angles.
Increasing the distances did lower the readings as one would expect, the farther away the lower the readings, however the angle from which the sound was coming from had a much bigger impact. A sound produced for behind the sensor was much lower than a sound produced right in front of the sensor.
Afterwards we tested the DataLogger, which worked as expected.

Sound Controlled Car
We uploaded the program to the Failbot 9797 and ran it. It started to drive as expected and responded to various sounds by driving turning each way and then stopping. Clapping was the least effective means of controlling it. Claps had to be very loud and preferably in front of the car for it to register. Johan tried making a high pitched yelping sound, which was very effective and worked almost every time, this appeared to be the best way of controlling it.

Turning it off was a challenge until we read the code and realized why. We fixed this by using a ButtonListener which calls System.exit() if the escape button is pushed. Very effective.

Clap Controlled Car
We discussed ways of analyzing the input from the sensor to determine whether a clap had been made. In the end we decided just to try to implement it by three if-sentences to determine whether the data corresponded to the pattern described in the exercises. This technique proved to be very effective - more effective than we both expected - and it was able to detect claps almost perfectly, while also filtering out other sounds such as the yelping sound which was so effective earlier.

Conclusions
The clap pattern described in the exercises proved to be very accurate and the simplistic algorithm implemented was very effective. By experiments and data logging it would probably be possible to tweak the constants to get less thread sleeping thereby enabling the Failbot to register more claps per minute, however we didn't find time for this.

No comments:

Post a Comment