[chbot] Determining delay between two similar signals

Robin Gilks robin at gilks.org
Mon Jul 6 12:08:58 BST 2020


> Hi Robin,
>
> I can't see anything wrong with the code example
> https://bitbucket.org/GreyCat/calc-sound-delay/src/default/
> Maybe the problem is your test waveform? Correlating with a continuous
> sine
> wave could give you an indeterminate result in time with a peak on every
> cycle.

I used a pretty random synthesised audio effect - there may well have been
too much regularity in it. Good to hear the code is basically OK, I'll
find some audio samples with some noise bursts in it!

> You need a signal with a well defined pattern that can be located in time.
> Hence the long sync patterns used to achieve symbol sync in digital radio.
> With your anemometer ultrasonics probably working in the 40kHz region you
> could try something like sending 4 cycles, then reverse phase by 180°
> send
> another 4 cycles.
> Then correlate sliding along the received waveform over the 8 cycle period
> against the ideal waveform and you should detect a maximum correlation
> well
> defined in time. You may need to look closely at the received waveform
> considering the Q of the sender and receiver to decide how to design your
> sync waveform for acceptable performance.

I'm planning on frequency shift keying the 40KHz drive by about 1% to
provide the pattern to look for. The distance I expect to be about 200mm
so the time delay is about 1ms. That gives enough time for several shifts
even allowing for very high wind speeds causing the delay to be reduced.
Based on the ideas at
https://pdfs.semanticscholar.org/cdfc/8e31306ea79df6bd9a6ace74cf98adf5c16d.pdf

Probably best if I concentrate on hardware for a while and get some
signals that can be processed offline to optimise the way they are
handled.


> The ultrasonic HC-SR04 modules measure distance fairly well using a simple
> burst. You might get sufficiently good performance using the analogue
> electronics of an HC-SR04 module while replacing the processor and using a
> counter timer to measure either the first zero crossing or average the
> time
> of flight on multiple zero crossings. This document is an interesting read
> with oscilloscope waveforms:
> http://www.pcserviceselectronics.co.uk/arduino/Ultrasonic/electronics.php

These module suffer a real problem with slow startup and ringing (as do
most cheap 40KHz transducers) so at a small distance I'll be lucky to get
within 20km/hr - I'm hoping for better than 1km/hr accuracy!


> I have been wondering if you could send the signal in each direction to
> eliminate the temperature variation of the speed of sound in air?

With the fixed distance and operating both ways (and at 90 degrees) I
should be able to not only eliminate the temperature but actually measure
it ;)


> Let us know how you get on.
>
> Cheers
>
> Richard
>

-- 
Robin Gilks zl3rob/g8ecj







More information about the Chchrobotics mailing list