Sunday, February 17, 2013

First steps toward trilateration


One of my goals is to be able to locate the robot using trilateration. I plan to do this using a few stationary microphones and speaker and radio transceivers. The Raspberry Pi with Arduino will send out a  radio signal to the robot which outputs a sound. The sound is collected using a number of stationary microphone. Difference in sound arrival time can then be used to calculate a relative position of the robot.
CC Wikipedia Trilateration
Well, that is the plan, in reality I´m not quite close to that yet. Right now I can sample at 3K Hz and output the result to the Nokia 5110 screen as below. I can see the tone of that the robot sends out but the input is very noisy.

3K Hz sampling of sound
Next step is to output a specific frequency from the Robot that the receiver can detect. I have been reading this instructable and tried the code but do not get very good results from it.
The robot beeps using Arduino tone command.
The robot now outputs a tone of 1Khz this is how it looks on the 5110
1Khz from robot buzzer, really close to the microphone.

The wave looks 55 pixels wide. The screen show 84 pixels of the 255 samples taken
4600 Microseconds for 255 samples.
0.0046s / 255 = 1.8e-5 s for one sample
9,9e-4 s for 55 samples = 1010 Hz!

So we can sample the robots wave, even if it does look a bit chopped up compared to when I whistle (sin wave). I guess that is since it is generated as a square wave using the tone command.
The tone command:
"Generates a square wave of the specified frequency" - Arduino Tone
ok next step is to detect the frequency by code. Judging from the look of the wave I think I will try to sample hills somehow...