[chbot] Determining delay between two similar signals

Charles Manning cdhmanning at gmail.com
Sun Jul 5 07:31:38 BST 2020


Hi Robin

An FFT is probably not the best way to go as, generally, that is going to
be maths heavy.

Basically what you're trying to do is reconstruct the signal  from what you
are receiving then measure the phase difference between the transmitted and
the received signal.

I assume you're using a single tone rather than mised audio. Keeping it to
a single tone will make life much easier.

I recommend starting off with taking the tx and rx signals and feeding them
into an oscilloscope and seeing the signal delay and then working from
there.

There is another way to do this which is to use the flight time from the tx
to the rx as the delay in an oscillator. If the wind is blowing from tx to
rx then it will carry the signal faster resulting in a frequency shift.





On Sun, Jul 5, 2020 at 6:17 PM Mark Atherton <markaren1 at xtra.co.nz> wrote:

> http://www.dspguide.com/ch7.htm specifically convolution
>
> http://www.dspguide.com/ch7/3.htm has some basic drawings
>
> The latter may have a pictorial example of what you are trying to do
>
> DSPguide is a brilliant book.
>
> HTH
>
> -Mark
>
>
>
>
> On 5/07/2020 5:27 PM, Robin Gilks wrote:
>
> > Me again!
> >
> > I'm still getting nowhere with my project that will use ultrasonic
> > transducers to measure wind speed.
> >
> > I understand that I need to run a cross correlation between the original
> > transmitted signal and the delayed received one in order to work out the
> > delay and hence (with a fixed distance between transducers) the speed of
> > the wind.
> >
> > Trouble is, when I try to find basic information I end up in a cloud of
> > matlab and scipy mazes that don't help me at all. I just don't seem to be
> > able to make the leap from basic idea to usable code on an embedded
> > system. It really doesn't help me to read that I need to an FFT when I
> > wouldn't know an FFT from a dead elephant!
> >
> > A typical example of what I find is thus (from
> > https://www.dsprelated.com/showarticle/26.php):
> >
> > "A well-known solution to estimate delay is to calculate the
> > cross-correlation between the two signals. An efficient implementation
> > calculates |ifft(fft(a) .* fft(b)|, using FFT for cyclic convolution.
> > A peak in the result indicates the integer-sample delay with best
> alignment."
> >
> > warblefarblegarble :(
> >
> > Thought a couple of times that I'd found a code snippet that delivered
> the
> > goods but on trying them out they don't actually work. e.g.
> > https://bitbucket.org/GreyCat/calc-sound-delay/src/default/
> > I feed in 2 audio files, one of which I have trimmed a 150ms from the
> > front of with Audacity and it tells me the delay is 3-4 times what I'd
> > actually created.
> >
> > Confused...
> >
>
>
> _______________________________________________
> Chchrobotics mailing list Chchrobotics at lists.ourshack.com
> https://lists.ourshack.com/mailman/listinfo/chchrobotics
> Mail Archives: http://lists.ourshack.com/pipermail/chchrobotics/
> Meetings usually 3rd Monday each month. See http://kiwibots.org for
> venue, directions and dates.
> When replying, please edit your Subject line to reflect new subjects.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ourshack.com/pipermail/chchrobotics/attachments/20200705/f37dafc1/attachment-0001.html>


More information about the Chchrobotics mailing list