UltraSonic wind speed mesurment with AVR

Go To Last Post
167 posts / 0 new

Pages

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry for delay, I'm out of town. Top image is envelope detector and received signal. IIRC the bottom was testing the envelope detector. A strong signal will ramp up the output faster, but it is still a mechanical system, and it takes time for the piezo xtal to absorb enough energy to mechanically vibrate and generate an output voltage.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

System was avr DVDs to generate the easily tunable drive signal, and another processing the envelope detector output. There are several ways to drive the piezo, a square wave, unipolar or bipolar, is easiest. That, however, also pumps a lot of energy into the piezo that is not at the primary resonant frequency. This is converted to heat in the piezo. Additionally, piezo may have a power rating, and you may wish to maximize power at resonance to maximize transmitted signal.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Perhaps this Hackaday article could help:

 

ULTRASONIC ANEMOMETER FOR AN ABSURDLY ACCURATE WEATHER STATION

 

https://hackaday.com/2013/08/21/ultrasonic-anemometer-for-an-absurdly-accurate-weather-station/

 

 

The original author's work is here: http://forum.arduino.cc/index.ph...

 

https://code.google.com/archive/p/mysudoku/downloads

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

With DDS one can easily drive piezo with sine wave or square wave, easily tuned for resonance, and evaluate impact on output signal strength, etc.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Receiver was several op-amp filters feeding an envelope detector. Second image shows how quickly it tracks the first positive 1/2 cycle of the input.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In theory one could feed the filter output into an ADC for direct conversion and not use the envelope detector. A fast processor helps if one goes the route. Unless one is doing phase or phase and amplitude modulation this is not usually needed. Certainly doable, but certainly non-trivial. Likewise with the dds transmitter it is easy to slightly modulate the transmitted chirp, in a phase continuous manner. That can be used to advantage in the output signal processing, but is not helpful with simple signal detectors.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Don't ask how long it took an old time to write that on a cell phone...

Good luck with your project!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And here's another Ultrasonic Anemometer based on that project:

 

https://soldernerd.com/2014/11/14/arduino-ultrasonic-anemometer-part-1-getting-started/

 

All I did was to put "how to make ultrasonic wind speed" into google - and got about 1,020,000 results  

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for your answers. I am still trying to solve the same problem. I have 4 transducers and each of them are receiving different length and amplitude signals. I have tried to adjust transmitting signal frequency and voltage for each transmitter individually, but any good results. This difference in received signals leads to different shape of envelope, so the threshold level to trigger the envelope should be different.

 

 

The transceivers I am using: http://www.farnell.com/datasheet...

Also I have tested with these: http://www.farnell.com/datasheet... The results were similar and the received signal shape was different for each sensor.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There are many options
As I m ed mentioned before, you can use the slope of the initial signal to backwards extrapolate to a (estimated) start time

Another approach is to watch for the individual peaks and use the LAST peak in the ping as your time reference. The piezo will still ring after the last real peak from a received signal, so in practice you measure the peaks of several of the peaks to calculate the amplitude of the plateau. The ringing will be of a smaller amplitude, so you can tell which was the last peak in the ping. This can be e as easier as the initial peaks in the ping will be low amplitude for the reason I mention before.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

I would like to know if I really need a temperature compensation. If I measure the difference of travel time to both directions with equation: v = L/2 * (1/t1 – 1/t2), where should I put the temperature value to compensate wind speed value? Do I need to use other equation? Is it enough to compensate the distance L using temperature reading?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Although the speed of sound in air changes with temperature, the difference between the two readings going in opposite directions will remain the same (assuming the temperature has not changed between reading)

But I would do some temperature testing once the unit was working in the lab (climate controlled).

Good luck with your project, and please come back and provide a link once you have it working.

 

Jim

 

 

(Possum Lodge oath) Quando omni flunkus, moritati.

"I thought growing old would take longer"

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ignoring the impact of air pressure and relative humidity:

V = 331 m/Sec + (0.6 m/Sec/'C * T)

V = the speed of sound

Temperatures are in 'C.

 

In Ohio the span of the temperature is > 50'C.

 

So measurements in Winter and in Summer have quite a different reading for the same speed!

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi DocJC,

as ki0bk said, if we measure the difference of time of flight, to both directions, when temperature has not changed between readings, the result will remain the same for temperatures 10...50C? 

 

The lenght is changes depending on temperature. To determine actual lenght I use these equations:

 

speed_of_sound = 331.3 + (0.606*temperature);   // This is actual speed of sound at ambient temperature in Celsius

lenght= ((Tup+Tdown)/2.0)*speed_of_sound;   // I use both directions average of last time of flight reading, to determine the actual lenght. Here I compensate the lenght, depending on temperature changes.

 

Final equation, to determine velocity:

v = lenght/2 * (1/t1 – 1/t2)

 

Could you confirm, that these equations are correct and I will get the same or very similar velocity value at different temperatures 10...50C?

Last Edited: Sat. Aug 18, 2018 - 07:35 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm not sure how you derived your final equation.

If you show your derivation then I and others can take a look at it.

 

I would simply use:

Vwind = (Distance/Time) - Vsound

Where Distance is in meters, the separation distance between the Tx and Rx sensors.

Time is the transit time for the Ping, in Seconds, (one way distance transit time).

Vsound is the velocity of sound at the current temperature.

Vwind is the velocity of the wind in the direction of the two sensors.

(Velocity is a vector, so you typically need two sets of transducers for an X and a Y vector, to then sum them.)

Vsound is a function of the current temperature.

That velocity will impact the transit time of the Ping.

 

An example:

Set your Tx and Rx transducers 10 meters apart, for the example.

Assume you have a 20 m/Sec wind from the Tx sensor to the Rx Sensor, directly along that axis.

(20 m/Sec ~ 44.7 Miles/Hr, so a pretty good wind speed!)

At 0'C Vsound = 331 m/Sec.

The velocity the Ping will travel at = the Vsound + the velocity of the wind.

The wind is helping to make the Ping move faster than it would without the wind.

Time = Distance / Speed = 10 m / (331 + 20 m/Sec) = 0.0285 Sec

That is the transit time for the Ping, assuming perfect Ping detection.

 

Now work the problem "backwards", you know the sensor separation is 10 m, and your device measures the transit time as 0.0285 Sec, so what was the vector component of the wind speed along the measurement (sensor) axis?

Velocity = Distance / Time.

Velocity = Vsound + Vwind.

We stated above that the time was for 0'C, where Vsound = 331 m/Sec.

(331 m /Sec + Vwind m/Sec)  = (10 m) / (0.0285 Sec) = 350.8782 m/Sec.

Vwind = 350.8782 - 331 = 19.88 m/Sec  ( = 20 mSec +/- rounding errors).

 

That is the calculation you do in the micro.

You measure the transit time, you know the transit distance, so you calculate a velocity.

To subtract out the baseline Vsound you need to know the current temperature.

Hence add a thermistor or a DS18B20 temp sensor, etc. to measure the ambient temperature.

 

If you measure the same 20 mSec wind, along the sensor axis, 10 m separation, at 50'C the transit time would be:

T = D/V = 10  / (361 + 20) = 0.0262 Sec.

Vsound = 331 + (0.6 * Temp), where Temp is in 'C.

Vsound = 331 + 30 = 361 m/Sec at this hotter ambient temperature.

 

Work backwards again.

You will measure the transit time of 0.0262 Sec, known distance of 10 m.

V = Dist/Time = 10 / 0.0262 = 381.6794 m/Sec.

The velocity is the sum of the baseline velocity of sound plus the added velocity of the wind.

V = Vsound + Vwind = 381.6794

Vsound (at 50'C) = 361 m/Sec.

Vwind = 381.6794 - 361 = 20.6794 m/Sec  (+/- rounding errors).

 

So, with this "simplistic" approach, YES, you need the ambient temperature in order to (easily) calculate the velocity of sound at the temperature.  Vsound = 331 + (0.6 * Temp), Temp in 'C

 

Know that there are several errors inherent within this system, include, but not limited to:

Vsound is also a function of atmospheric pressure and humidity.

Temperature is the main factor, however, compared to the others.

One's ability to detect, precisely, the reception of the Ping is non-trivial.

The transmitted Ping is typically several cycles of the resonant frequency applied to the transducer.

The super cheap SR04 HR04 or whatever send 8 cycles for the Ping, and they use a rectangular pulse not a sine wave, (which is a separate discussion which impacts the Xtals energy efficiency and the energy and frequency spectrum of the transmitted signal, none of which you really need to worry about.)

Point being, however, the received Ping will "ramp up" in its amplitude as sequential cycles of the resonant frequency are received.  An inexpensive receiver won't actually determine the time of the start of the first cycle of the group of cycles of the ping.

The error in this is relatively constant for a given setup, (and the error limits are easily calculated, if desired).

 

If it is an issue, one can add a constant correction factor to the measured velocity to compensate for this offset.

 

Now, back to your equation, with (1/t1 - 1/t2).

When I calculate the Vwind, including both measurements, (Sensor A to B, and B to A), I get a messy equation, more easily solved when Vwind << Vsound, and assumptions are made.

Hence my desire to see how you derived your equation.

(Maybe my brain is making this harder than it should be...  Wouldn't be the first time).

 

Personally, I'd add a Dallas Semi DA18B20 temp sensor, (or equivalent), and use the easy math.

 

JC

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for your detailed answer. I found this equation here: https://pdfs.semanticscholar.org.... This equation is widely used in ultrasonic flow meter. I simplified this equation and removed the cos() of angle. How do you think, this equation is suitable for anemometer?

Pages