Ultrasonic wind speed measuring

Hi,
so I am building a Ultrasonic wind speed measuring device with 2 HC-SR04 ultrasonic sensors. The idea is to have them facing each other in my case 15cm apart. Then I trigger one (send one 10us pulse on the trigger pin) and using pulseIn to measure the time (from 1st sensor to 2nd and back). Then using math i get the wind speed. The issue is I can't seem to get stable numbers. The sensors always read different values despite being the same distance apart. Any ideas why and what to do?

Yep do the maths first to see what shift in time of flight you get and whether it’s enough to measure

I think that you need to give us some quantative measurements, rather than just saying:

bangaham:
The sensors always read different values despite being the same distance apart.

Surely you are expecting them to be different, due to the wind?

Also I don't see why you are measuring the time for the ultrasonic pulse to go and return.
If the signal is sped up in one direction due to wind, then isn't it slowed down in the other direction and the two changes cancel each other out?

You have to trigger both at the same time, otherwise the HC-SR04 is not "listening" for an incoming ultrasonic-chirp.

I don't think it's possible the way you are doing it though.

Even if the measurement was accurate to 1cm, your wind speed resolution is only ~70 km/h

But even before that happens, the ultrasonic frequency has shifted so much that the receiver won't pick it up anymore.

quick math: speed of sound = 343 meters per second. Programming an Arduino usually deals in milliseconds so divide 1000 milliseconds by 353 to get the speed of sound as 2.91 meters per millisecond. 15 cm is 0.015 meters so multiply 2.91 by 0.015 meters to get 0.043 milliseconds from one side to the other. That is 43 microseconds. Can an Arduino do that? Can an Arduino initiate a signal then turn around and monitor another signal looking for 43 microsecond time difference? And, can it do that reliably? I am skeptical.

10 microsecond pulse? Hmm. Estimate a 50 Khz frequence for ultrasound and multiply by by 0.00001 to get 0.5. that is one half of a single cycle of 50 Khz. That will be difficult to detect. Make it 100 Khz and get an entire one cycle of sound. No, that still won't work.

I estimate: No, that will not be successful.

To do that you probably need some custom hardware. Make a hardware counter running at a couple of mega Hz, start it when the signal is sent, and have the receiver wired to directly stop it. Forget the 10 microsecond pulse. Turn on the transmitter and see how long it takes for the counter to stop. Then turn off the sound. Then you must run it a bunch of times with a known wind speed to calibrate it.

These are physical devices and you don't know how many microseconds it takes to start sending detectable sound waves and you don't know how many microseconds it takes to recognize the right frequency sound being received.

Programming an Arduino usually deals in milliseconds

The machine instruction cycle time of a standard Arduino is 62.5 nanoseconds.

It is no problem at all to measure the speed of sound in air over a distance of 15 cm, and beginners do it every day, with $2 sensors.

Hi,
Have you seen this Hackaday and own loaded his files on construction, code and research equations?

Tom... :slight_smile:

Thanks for all the information, I will try the things you guys recommended and reply if things still won't work, I know this won't be super accurate, it's more of a proof of concept.

TomGeorge:
Hi,
Have you seen this Hackaday and own loaded his files on construction, code and research equations?

Ultrasonic Anemometer For An Absurdly Accurate Weather Station | Hackaday

Tom... :slight_smile:

That's an impressive and well documented project. Thanks for the pointer.

Direct link to design files and project report here: https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/mysudoku/UltrasonicAnemometer.zip

With regard to using HC-SR04 the design uses carrier phase measurements and carrier signal isn't available without modifying the device to get the analog output (trivial) and phase coherency between sender and receiver (non-trivial).

bkelly:
10 microsecond pulse? Hmm. Estimate a 50 Khz frequence for ultrasound and multiply by by 0.00001 to get 0.5. that is one half of a single cycle of 50 Khz. That will be difficult to detect. Make it 100 Khz and get an entire one cycle of sound. No, that still won't work.

I'm guessing that you've never actually used a HC-SR04, @bkelly.

They have their own microcontroller.
The 10us pulse from the host triggers the microcontroller to generate a burst of (usually) eight cycles of 40kHz, though the transducer will probably ring for as many cycles again unless damped.

Having said that, no, I don't think I'd be using one (or even two) for this purpose.