Tuesday, March 19, 2013

Lots of Beeping produces better measurements

Results are quite good now

I spent an hour today tweaking my sound distance measurement code. This measures the distance between a sound source and a microphone, synchronization is done by radio.
I actually get quite good results now, normally just a cm or so error after calibration. I am taking the median value from 12 measurements.

test setup 25 cm, sensor shows 23.8 cm

Challenge 1: Measuring longer distances, 

For the robot mapping I would like to get around 2 meters of accurately measured distance. Right now for short distances up to 120 cm the accuracy is acceptable (a few cm or mm error). At distances greater than 130 cm I suddenly get large errors...
I do not know why? Maybe the sound is not strong enough or get disturbed by noise? Must investigate.

A problem with longer measurements is that the SRAM memory on the Arduino is quite limited so the memory buffer has a very limited size. Since I sample the microphone sensor readings into an array of memory before analyzing, the amount of memory decides the range I can measure. If I use slower memory or transforms the measurement into smaller space I loose samples since such calculations take time from sampling.
Perhaps I could make up an algorithm that starts by measuring short distance, and if it does not find the sound there it asks for a new sound pulse and try measuring the larger distance.

Challenge 2: Get the measurements consistent

When I reset the test, change the code I must recalibrate the distance sensor for it to work properly, today with current setup I get an error of +15 cm, the other day it was 12.2 cm.

The calibration consist of measuring a known distance and calculate a mean error to subtract.
The sensor attempts to pick up the first peak in the 4.8 kHz wave. Here at 60 cm with 0.61 cm error after calibration. Before calibration the error was 15 cm
Not really sure on how to handle/automate calibration, I guess that is a pain we have to live with,

Challenge 3. Keep on testing despite the noise

Every measurement is a 20 millisecond 4.8 kHz beep, I put a delay of 20ms between the beeps... That means a lot of quite annoying noise. I have ordered a ultrasonic sender/receiver pair, I have high hopes for those...

No comments:

Post a Comment