Author Topic: Minimalist Ultrasonic Anemometer  (Read 2893 times)

0 Members and 1 Guest are viewing this topic.

Offline jtTopic starter

  • Regular Contributor
  • *
  • Posts: 91
Minimalist Ultrasonic Anemometer
« on: July 20, 2023, 11:32:58 pm »
Ran across this project and got to thinking about how I might do things differently. 
https://www.instructables.com/Sonic-Anemometer/

Presuming the same physical implementation (one TX reflected symmetrically to three 120deg offset RX),  I was thinking a more minimalistic analog front end could be implemented.  Thought I'd outline it here to get a sanity check on the theory of operation.

So basically the referenced author's implementation boils down to a phase detector for each receiver, referenced to the TX excitation.  The author uses 4046 PLLs to accomplish this.  I was wondering if I could use the actual receive transducers to implement an unbalanced frequency mixer by coupling in an attenuated copy of the excitation signal into the RX transducers.  The transducer disk would then be affected by constructive and destructive interference between this excitation and the received ultrasound signal and would output a sum of those signals yielding an output proportional to phase and amplitude.

To remove the high frequency components, I'd then use an envelope detector to AM demodulate this output.  And to isolate the phase information from the amplitude information, I would sweep the phase of the copy-of-the-excitation-signal to find the envelope maximum relative to signal sweep phase offset (timing registers in an MCU).  The maximum would correspond to the point where the received ultrasound signal and the swept reference signal are in phase.  From there I could back out the phase delay to the excitation signal.

The absolute phase value would be dependent on any phase lag associated with the injection circuit and drive circuit, but could either be calibrated out, or left as an unknown.  Presuming well matched components, such unknowns probably could be neglected since the anemometer only needs relative phase information to function. 

So the end product would consist only of a drive circuit, some passives and a fairly low-end MCU with integrated ADC (such as an Arduino ATmega328) in addition to the transducers. 

I haven't found any specific prior art (kind of a hard thing to google for), but I found something that I think operates on a similar basis, where early radar systems would couple the received echo and a reference oscillator into a crystal resonator through means of a waveguide to produce the sum of the signals.   
http://www.tpub.com/neets/book18/80h.htm

Thoughts?
 
The following users thanked this post: boB, RoGeorge

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 2857
  • Country: au
Re: Minimalist Ultrasonic Anemometer
« Reply #1 on: July 21, 2023, 05:19:46 am »
I was wondering if I could use the actual receive transducers to implement an unbalanced frequency mixer by coupling in an attenuated copy of the excitation signal into the RX transducers.  The transducer disk would then be affected by constructive and destructive interference between this excitation and the received ultrasound signal and would output a sum of those signals yielding an output proportional to phase and amplitude.
Thoughts?
That moves you into the amplitude domain, whilst the example operates in the phase domain only.
It will be harder to setup and more prone to noise, if you have to worry about precise % of coupling - not to mention humidity dependent too.

The 4046 approach as some merit : it uses the inbuilt amplifier of the 4046, and the PLL gives good low pass averaging over many cycles.

Quote
And to isolate the phase information from the amplitude information, I would sweep the phase of the copy-of-the-excitation-signal to find the envelope maximum relative to signal sweep phase offset (timing registers in an MCU).  The maximum would correspond to the point where the received ultrasound signal and the swept reference signal are in phase.  From there I could back out the phase delay to the excitation signal.
That's also sounding complex, as any peak will be 'soft' and a 4046 is actually 'quite good' at phase detection.
If we take a ballpark/conservative  one part in 5000 for analog noise floors, the 4046 will be good to about 5ns.
That's now needing a rather good MCU ?

I also found this
https://www.quora.com/How-much-do-temperature-and-humidity-affect-the-speed-of-sound-Is-it-significant
suggests a mechanical or SW offset may be needed to keep any phase detectors away from any phase reversal points.

Maybe a MCU with a CLU (for phase detectors) and reasonable timers/capture would be able to manage this, with simple bandpass preamps ?

« Last Edit: July 21, 2023, 05:59:05 am by PCB.Wiz »
 

Offline Berni

  • Super Contributor
  • ***
  • Posts: 5223
  • Country: si
Re: Minimalist Ultrasonic Anemometer
« Reply #2 on: July 21, 2023, 05:48:48 am »
This just makes things much more complicated.

If i wanted to do a simple AFE i would move the whole phase detection stuff into the MCU since it has hardware timers that can measure time delays very accurately.

Then all i need in the AFE is a circuit to amplify the signal from the piezzo and turn it into a clean square wave for the MCU to understand.

How to get synchronized timers is very platform dependent. For a STM32 you typically get timers with 4 capture compare channels. So in this case you only need 1 timer, set up the dividers for a timebase of 40KHz. Set the 1st channel for output compare operation to generate a 40KHz square wave with a 50% duty cycle. Then configure channels 2 3 4 for input capture operation. Start the timer up and you should have a new phase reading ready in capture registers 2 3 4 at a rate of 40 000 readings per second. Average those readings together a bit to clean up any noise and you got your reading.
 

Offline RoGeorge

  • Super Contributor
  • ***
  • Posts: 7911
  • Country: ro
Re: Minimalist Ultrasonic Anemometer
« Reply #3 on: July 21, 2023, 05:51:16 am »
Interesting project, thanks.  :-+

Since we have a clean reference signal (we generate it), and since we can afford to integrate many measurements (average), the device might be made out of 4 lock-in amplifiers (in software), one for each ultrasonic mike.

Seems doable with a small MCU with ADC, but didn't make any numerical estimations.
« Last Edit: July 21, 2023, 05:54:47 am by RoGeorge »
 

Offline Berni

  • Super Contributor
  • ***
  • Posts: 5223
  • Country: si
Re: Minimalist Ultrasonic Anemometer
« Reply #4 on: July 21, 2023, 06:08:07 am »
Actually that is a nice idea too.

You could just as easily use a timer to trigger an ADC conversion at two 90 degree apart locations of the 40KHz drive signal, run the two ADC readings trough a rectangular to polar calculation and you get the amplitude and phase of the signal. If you have a MCU with a particularly fast ADC you could grab a reading at every cycle, this would take 40Khz*2*3 = 240kSPS. You can get 1 MSPS or even more ADCs in some MCUs. Tho that would likely mean offsetting the reading points and adding that later in the phase results since not all MCUs have 3 sample and hold circuits to be able to capture 3 analog signals at the exact same time.
 

Offline jtTopic starter

  • Regular Contributor
  • *
  • Posts: 91
Re: Minimalist Ultrasonic Anemometer
« Reply #5 on: July 21, 2023, 01:43:42 pm »
Thanks everyone for their reply, exactly the feedback I was interested in getting. 

I have always been interested in lock in amplifiers, and was looking into that approach before the idea evolved into the described. I'll probably revert back to that, although this has been more of a thought experiment than anything ( I have too many other projects to finish up before I get more serious about this one). 

I'd agree the best solution would be to move most of it into the digital domain.  I'd be facing a learning curve on the embedded microcontroller programming.  Maybe I could use a DAC to steam raw ADC data to a PC and handle it in Matlab from there.  At least to get started
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 16267
  • Country: de
Re: Minimalist Ultrasonic Anemometer
« Reply #6 on: July 21, 2023, 03:28:46 pm »
A µC is perfectly good enough to handle the math to measure the phase shift. There are mainly 2 choices: use the ADC to get in phase and quadrature data to calculate the phase (via ATAN2) or with analog hardware make a square wave signal and than use the timer hardware to measure the timing.  Many moder µCs could run the timer at some 100 MHz and this could resolve the time to about 1/2500 of a period. That is about as good as the ADC resolution. Averaging over multiple periods would give additional resolution, so I don't think one has to worry a lot about the resolution, especially if the setup is reasonably large. 40 kHz is slow enough for many µCs to handle in real time.  If one want's a PC at all this would get more like the averaded ADC or timing signals, if not directly the wind speed components.

Mixing the signal directly at the detector is more of a problem as I don't think the transducers are very nonlinear.

If one really wants to go to town, one could consider using 3 equal transducers and swap between send and receive.
 

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 9233
  • Country: nl
  • Current job: ATEX product design
Re: Minimalist Ultrasonic Anemometer
« Reply #7 on: July 21, 2023, 04:38:40 pm »
Using PLLs is a novel idea, but I don't think it's a particularly good one. Time is one of the most accurately measurable physical phenomena, and the output of ultrasonic transducers can be directly converted into time signals with just a comparator. There are also plenty of ICs specifically designed for TOF measurements.
 

Offline jtTopic starter

  • Regular Contributor
  • *
  • Posts: 91
Re: Minimalist Ultrasonic Anemometer
« Reply #8 on: July 21, 2023, 04:54:18 pm »
Yeah, a ton of TOF options.  I'm sure I could find something, but at a glance many had a minimum distance requirement that would preclude a compact design. 
 

Offline jtTopic starter

  • Regular Contributor
  • *
  • Posts: 91
Re: Minimalist Ultrasonic Anemometer
« Reply #9 on: July 21, 2023, 05:19:54 pm »
Also - a lot of suggestions here to use comparators to reshape to a square wave for direct interface to a timer block.  Certainly a very good approach, but question on implementation:

In past experience a sharp transition (fast comparator) leads to ringing and jitter due to noise on the input signal (and/or preventable feedback).  Adding a hysteresis band solves that, but now the circuit is amplitude dependent and sensitive to passive component drift.  A slower comparator would also help, but the slower rise time sacrifices edge triggering accuracy. 

One could aggressively BP filter the input, and carefully eliminate feedback loops in the PCB layout, but now you are sensitive to the filter's phase delay which may be difficult to calibrate out over temperature/ component tolerance.

I was wondering if a switched capacitor filter might be good for this given the clock-driven transfer function frequency stability.  Then followed up with a single pole RC filter to remove the switching frequency, where the cut off frequency would sufficiently high to negate any associate phase delay sensitivity.  But at this point, you are essentially recreating the functionality of a direct ADC sampling solution but with more discrete components and less DSP flexibility in how to filter the sampled signal. 

Thoughts?
« Last Edit: July 21, 2023, 05:22:50 pm by jt »
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 16267
  • Country: de
Re: Minimalist Ultrasonic Anemometer
« Reply #10 on: July 21, 2023, 06:47:26 pm »
Some filtering before the comparator is good, but I don't think it has to be super agressive. With a very agressive filter consecutive zero crossings are correlated and averaging over many transitions already takes care of this part. The usual way for a low noise zero crossing detector is to us a saturating amplifier first and the comparator only after the amplifier. For the hysteresis there is the option to have a time dependent hysteresis effective only for a short time, so that the next zero crossing is back to the original zero.

A switched capacitance filter is kind of a sampling system and looses some of the timing information. It depends a lot on how it is implemented, but there is a chance to make it really bad. So I don't think this is a good idea here.

The phase shift and drift of the fitler is a good point. It may indeed become an issue. The usual US tranducers are already resonant and act as relatively steep filters. So it is not just an extra electronic filter, but also the transducer temperature that could be an issue. The system with 3 receivers may hope for some compensation between the transducers.
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 2857
  • Country: au
Re: Minimalist Ultrasonic Anemometer
« Reply #11 on: July 21, 2023, 11:10:52 pm »
In past experience a sharp transition (fast comparator) leads to ringing and jitter due to noise on the input signal (and/or preventable feedback).  Adding a hysteresis band solves that, but now the circuit is amplitude dependent and sensitive to passive component drift.  A slower comparator would also help, but the slower rise time sacrifices edge triggering accuracy. 
AC coupled  CMOS unbuffered gates work quite well as ultrasonic buffers.  That's effectively what is inside the 4046, on the pin they AC couple into.

I was wondering if a switched capacitor filter might be good for this given the clock-driven transfer function frequency stability.  Then followed up with a single pole RC filter to remove the switching frequency, where the cut off frequency would sufficiently high to negate any associate phase delay sensitivity.  But at this point, you are essentially recreating the functionality of a direct ADC sampling solution but with more discrete components and less DSP flexibility in how to filter the sampled signal. 
Thoughts?
Sure, switched cap can work, but they have faded to niche parts, at high prices.

Quote
  I'd be facing a learning curve on the embedded microcontroller programming. 
 Maybe I could use a DAC to steam raw ADC data to a PC and handle it in Matlab from there.  At least to get started

To get something going, you can get aliexpress ADC modules like this
https://github.com/swharden/ADC-10-F103C

or, you could look into python on a Pi PICO, and see how that feels.
The PICO PIO module state engines should manage carrier generate and phase capture.


 

Offline RoGeorge

  • Super Contributor
  • ***
  • Posts: 7911
  • Country: ro
Re: Minimalist Ultrasonic Anemometer
« Reply #12 on: July 22, 2023, 06:18:22 am »
Main question is how comes that typical weather station still uses mechanical anemometers, and not ultrasonic ones?
The ultrasonic method looks more reliable, and cheaper to implement, so why it is not the norm, what are we missing?

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 9233
  • Country: nl
  • Current job: ATEX product design
Re: Minimalist Ultrasonic Anemometer
« Reply #13 on: July 22, 2023, 09:28:37 am »
Also - a lot of suggestions here to use comparators to reshape to a square wave for direct interface to a timer block.  Certainly a very good approach, but question on implementation:

In past experience a sharp transition (fast comparator) leads to ringing and jitter due to noise on the input signal (and/or preventable feedback).  Adding a hysteresis band solves that, but now the circuit is amplitude dependent and sensitive to passive component drift.  A slower comparator would also help, but the slower rise time sacrifices edge triggering accuracy. 

One could aggressively BP filter the input, and carefully eliminate feedback loops in the PCB layout, but now you are sensitive to the filter's phase delay which may be difficult to calibrate out over temperature/ component tolerance.

I was wondering if a switched capacitor filter might be good for this given the clock-driven transfer function frequency stability.  Then followed up with a single pole RC filter to remove the switching frequency, where the cut off frequency would sufficiently high to negate any associate phase delay sensitivity.  But at this point, you are essentially recreating the functionality of a direct ADC sampling solution but with more discrete components and less DSP flexibility in how to filter the sampled signal. 

Thoughts?
The ultrasonic transducers are themselves act as a very aggressive bandpass filter. I measured the ESR of a commonly used transducer a while ago, at the resonant frequency, 40KHz it was about 5KOhm, at 30KHz it was 100KOhm. I made my diploma about ultrasonic spirometry, which is measuring airflow in a tube. This topic is a lot of fun, and you can learn a lot about electronics. I've been meaning to build a DIY high-endish anemometer for a while now.
You could place the comparator to measure zero crossings, and that usually works fine, if you are not detecting the first zero crossing. You need a digital filter that excludes noise that is not close to the resonant frequency.
Other way to do it is by placing an envelope detector on your RX signal. Or oversample it with an ADC. So many ways.
Main question is how comes that typical weather station still uses mechanical anemometers, and not ultrasonic ones?
The ultrasonic method looks more reliable, and cheaper to implement, so why it is not the norm, what are we missing?
It's because the spinning anemometers have been used for decades now. You want your measurement results to be comparable with the old results, otherwise very bad things can happen. For example imagine that you change the measurement method, and while it's calibrated, it drifts differently over time. Someone analyzing the data could scare the global populations with extreme climate change. This has actually happened, some data from satellites proved to be inaccurate, they drifted. And this drift resulted very bad climate models about 10 years ago.
Also, spinning ones need regular maintenance every 6 months, and the new bearings are sold at a hefty premium.
 
The following users thanked this post: RoGeorge

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 16267
  • Country: de
Re: Minimalist Ultrasonic Anemometer
« Reply #14 on: July 22, 2023, 10:10:28 am »
The ultrasonic ones are also not without a problem. One is humidity and maybe fungi/ algi groth that may effect the detector. Another problem for long time use can be insects looking for a home.

The mechanical solution can also be relatively cheap if build in quantety with plastic parts.
 
The following users thanked this post: RoGeorge

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 9233
  • Country: nl
  • Current job: ATEX product design
Re: Minimalist Ultrasonic Anemometer
« Reply #15 on: July 22, 2023, 10:14:40 pm »
The ultrasonic ones are also not without a problem. One is humidity and maybe fungi/ algi groth that may effect the detector. Another problem for long time use can be insects looking for a home.

The mechanical solution can also be relatively cheap if build in quantety with plastic parts.
For the hobby weather stations, it can be cheap for sure. It's an injection moulded part, a bearing a magnet and a hall sensor probably.
The professional ones are a whole different ballpark. To give you an idea:
https://www.genetworld.com/Shop/en/wind-speed-sensor-vaisala-waa-252

They are calibrated regularly anyway, so regular maintenance is given. With the old instruments, a meteorologist was going to the instruments on a daily basis. Like the number of sunny hours was with a glass ball, that burned a piece of paper behind it. Wet bulb measurement needed extra water for them. And so on.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf