Ultrasonic Anemometer

I have just noticed that if you do a google search:

ultrasonic anemometer construction

I dont know how long this has been occuring but it also has the quote:

I believe that this is the only ultrasonic anemometer on the web which has
enough detail to enable it’s actual construction.

I’m still waiting to be proved wrong.

I would not be upset if proved wrong, but it would mean that I would have to improve my search technique.

Carl (i guess this is your name),

Great project and taking the time to share with the comunity . I have a few question that would help me to understand your design

1) Where do you get the formula v = SQRT((d/t)*(d/t)+(C*C)) - d/t ?

1)Why the 300 samples ? I see you explain and show math about the 3 seconds and get 312 samples to produce 1 measure. You can use just 100 samples or even less and still get good results .

2) Why are you mention to get TOF in multiples of 25 usecs (instead of real time)? You send the pulses (actually 16 )and should be able to get the time to arrive. You could send the pulses , start timer and stop when it arrives .

3) I am not sure to understand why you use the 74HC368 drivers? Could you use just the I/O pins of the microcontroller directly?

4) What do you use zero detector and envelope for ?

Regards,

Zenon

1) Where do you get the formula v = SQRT((d/t)*(d/t)+(C*C)) - d/t ?

We can find the wind velocity from the equation: Vns = d/2 *( 1/tns - 1/tsn)

We can solve this(algebra) for the magnitude of the wind velocity when we have the time difference: V = SQRT((d/t)*(d/t) + C*C) - d/t Where t = largest tof - smallest tof.

1)Why the 300 samples ? I see you explain and show math about the 3 seconds and get 312 samples to produce 1 measure. You can use just 100 samples or even less and still get good results .

The wind gust peak is usually averaged over 3 seconds(historical from the time constant of cup anemometers). This gives a sample size of 300. Any smaller size can be used but you will get more noise in your result.

2) Why are you mention to get TOF in multiples of 25 usecs (instead of real time)? You send the pulses (actually 16 )and should be able to get the time to arrive. You could send the pulses , start timer and stop when it arrives .

This is the crux of the problem. To get precision of 0.1 usecs is impossible with TOF.

My solution is to use the coarse TOF to get the TOF to within a 25 usec range. I then use the phase shift to get the precise TOF within that 25 range.

3) I am not sure to understand why you use the 74HC368 drivers? Could you use just the I/O pins of the microcontroller directly?

You can drive the transducers direct as I did in my first prototype. I have given the code:

//PORTD is at 0x0b pin 6 controls NORTH HIGH pin 7 controls NORTH LOW asm volatile ("\n\t" "ldi r25 , 16 \n\t" //set pulse counter to 16 "pulse1%=:" "\n\t" //branch back here till 16 pulses sent "sbi %0 , 6 \n\t" //turn on NORTH HIGH "cbi %0 , 7 \n\t" //turn off NORTH LOW

ect

This does not give a fine enough control of the pulse frequency. Timer0(Arduino millis() and PWM 5 & 6) is used as an exact frequency source for the ultrasonic. To get the differential feed requires that I had to use 2 74HC368 drivers, but it is not to extravagant to get the best S/N ratio.

4) What do you use zero detector and envelope for ?

The envelope detector is used to get the coarse TOF.

The zero crossing is used to get the phaseshift(fine detail) of the waveform.

1) What do you mean by "largest" /"smallest" TOF . So this formula is based on "large" number of samples and I pick largest and smallest and substracts them to get "t" ?

2) i still do not understand the big picture of you method to determine the wind speed

I see your explanation as follow : 1) You send pulses for .64 msec 2) After that wait .48 msec for settle down 3) Here is my problem...you say active waiting 1.28 ms for INT0 and INT1 . I do not understand what happens first, measure phase or detect envelope. Should be envelope, since it is coarse. So after sending the pulses, just wait for envelope to be detected (capture that value in envelopetof).Once detected, wait for the next crossing zero, capture timer1 again (in zcdtof) . Repeat this 300 times? In your code i see you use TCNT1 for both zcdtof and envelopetof, so even i read your code, I am sorry do not understand how this works.....

1) What do you mean by "largest" /"smallest" TOF . So this formula is based on "large" number of samples and I pick largest and smallest and substracts them to get "t" ?

This equation gives the wind speed when we have the TOF( say north to south) and the TOF in opposite direction(south to north).

In the example in the pdf for 1 kph wind we get:

tof from N to S tns = 0.36/(344.7 + 0.277) = 1043.5 micro sec. tof from S to N tsn = 0.36/(344.7 - 0.277) = 1045.2 micro sec.

So t = 1.7 usec. d = 0.36. C = 344.7.

subsitute into the equation and get v = 0.277 m/s (1 kph)

i still do not understand the big picture of you method to determine the wind speed

If you could measure the TOF using envelope detection (ping distance uses this) with an error of 0.1 usec there would be no problem. But the best we can get even with an average of 300 samples is 5 usec(wind noise is the problem). To get closer I incorporate phaseshift wich can give errors of 0.1 usec with 300 samples.

In your code i see you use TCNT1

Good, up to here you have got what I am doing.

The ZCD sets INT0 first. The counter value is recorded for the use as the phaseshift.

TCNT1 keeps counting

I set the detector levels so that the ZCD occurs first.

The envelope detector will then set INT1. The counter value is recorded as the coarse TOF.

TCTN1 is then reset.

hello guys, we have trouble with ultrasonic anemometer using pic , we need circuit of this anemometer and which sensor we should use. in this project, it done with using atmega but we must use pic could you help us immediately smiley-sad

Carl,

After a year I am back with your project .... I plan to use it in a sail boat and my main concern is what would happen with the boat movement. For sure will introduce errors....well...we will see.

1) why the ZCD has a pot R 22 ? What is that for? Actually I was surprised to realize that the calibration is done through an external program. What calibration do we need? I mean, as soon as the signal goes above 0V, should rise the output

2) D1 , on the envelope detector, should not be a precision rectifier? I mean, it will bring 0,6 V down

3) On the 4052, why we need -5 V?

On the SW side,

I did, as usual some changes . Basically, I am not using interrupts, but a continuous pulling of ZCD and envelope.

First a minor comment, regarding the time difference , diff = NZCD[counter]-SZCD[counter] i think is not accurate, because we are sending first 300 samples and then reverse for another 300 . I would expect to send 1 sample (n>s), reverse(s>n), send another sample, reverse and so on , until 300 times. What I mean if we send pulse 1 , the corresponding reversed pulsed will be after 300 other pulses , so wind changed in that time (well....might not in millisecs....)

Until step 3, I am ok , but struggling to understand your logic in the error correction It looks like if the diff is less than 200 (ie half period), then you add a pulse. How do you know this?

Then you mentioned the other problem about transducers behavior and define Northerror[20] . Why 20 values? An again the logic , even is there, not sure to follow why.

Finally, a basic question on tof Even you mentioned that we do not have individual Tof, I think we do have it, since envelope measures that "" We can find the wind velocity from the equation: Vns = d/2 *( 1/tns - 1/tsn) This requires that we have each tof as a discrete number. This we do not have. We cannot use this equation. What we have is a time difference of multiples of 25 micro sec.""

We send pulses, start TMR1 and capture the value (TMR1 again)when envelope detects it . We substrac and get Tof. What is true and you mentioned, is that with envelope is not enough to get precision and we need ZCD to find out phase shift .

Regards,

Zenon

On a rocking sail boat it should be as accurate as an eggcup type. I have used the same response time constant.

why the ZCD has a pot R 22 ?

We want to detect above the noise level and I want it to occur before the envelope detector. An improvement would be for the ZCD to be fixed and the envelope to be adjustable.

D1 , on the envelope detector.

This is not a rectifier but an Amplitude modulation detector. A precision rectifier would bring the detection level down but I dont know if it is really necessary.

On the 4052, why we need -5 V?

This may be a bit of overkill as the negative voltage on the analog input is very small(it can cope with -5v).
You should try to leave it out and see if it works for you.

What I mean if we send pulse 1 , the corresponding reversed pulsed will be after 300 other pulses

Yes but remember we are getting an average over time.
Also I found that you need a couple of pulses before the circuit becomes stable(I drop the first couple of measurements).

It looks like if the diff is less than 200 (ie half period), then you add a pulse.

about transducers behavior and define Northerror[20] .

Now this was just trial and error and I chose 20 as a reasonable figure. This is an area were there could be much improvement.

Even you mentioned that we do not have individual Tof, I think we do have it, since envelope measures that

Yes we do not have an accurate figure for tof to use in that equation.

Keep me informed on your progress.
I am going to revisit this design as my next project but I will be busy on another project for some months.

Cheers.

Carl,

I was expecting the ZCD to detect zero volts crossing, but you are right, noise might impose a threshold above 0 V. I also thought that ZCD will allways happen before envelope . On step # 3 , you are mentioning that the meaasurement might not be in the appropiate pulse, so you get the diff and if it is less than 200 (half pulse), then you add another pulse (400) . if diff is more than half pulse (200), then you remove one. My question to you is how do you know that this is needed? and what nakes you think that if diff>200 then substract one pulse. Regards,

zenon

PS : Will let you know my progress . So far , just on the analog side . I have two oamp LM358 for first stage (instead of your transistors), then a precision recitifer (because the diode 1N4148 was not working) , ZCD and envelope detector . One of my problems is that the tranducer cables, pick the signal from the sending end.So, when I receive the signal, I have a strong one (picked by the cable) and the real signal , very weak.

My question to you is how do you know that this is needed?

What we get is the difference "diffav" now this value will vary as shown by the wind function. Using this function we can determine what is needed for a given value.

pick the signal from the sending end

I used twin shielded microphone cable to feed the transducers. Earth the shield only at the circuit board.

I hope the opamps work. It will simplify the circuit layout.

hello; 1-i construct the circuit correctly but when i download program to my arduino(arduino uno) it gave me unreal and constant values.I just download operation part and i dont have lcd so i wanna use pc for monitor how can i do this is it possible? 2-Another problem is with transducers(tr-40-16b) my transducer has two pin one is short and another one is long how can i connect transducer to circuit?we have to use just microphone cable? so how can i connect these transducer with microphone cable? Thanks...

it gave me unreal and constant values

I can't follow this. What exactly gives you these values? Is it the Arduino IDE ?

Please provide exact details on what you have connected.

two pin one is short and another one is long

The drive signal is a balanced pair one wire for each pin(long or short). You should use shielded cable which has a third connection - the shield. Earth the shield at the circuit board end and leave the end at the transducer unconnected.

What exactly gives you these values? Is it the Arduino IDE ?

yes ? use arduino 1.0 program. But when ? download calibrate temperature program to the arduino uno with using arduino 1.0, it gave me -10 ,-9.87,-10... values from serial monitor but ambient temperature is 23 C.

Please provide exact details on what you have connected.

? convert your connection in a useful way for my ardunio because your connection is according to the atmega 328. For example, in your circuit you connect temperature connecion to the 28. pin ( PC5 (ADC/SCL) ) ? connet it in my circuit to the analog input 5 pin. Another example you connect zcd conection 4. pin (PD2 (INT0) ) i connect it in my circuit to the digital pin 2.

Actually i couldnt understand what you said about transducer pins, you mean that i shouldnt connect short pin anywhere and i should just connect long pin to one of my third connections cable and shielded connections at earth so i have one more connections what about it? Thank you very much for your fast replies

OK I can see what you are doing:

TRANSDUCERS ---- arduino uno ---- Arduino IDE display

Does the calibrate resisitor 1k make any difference. The voltage at analog 5 should change.

If it does not you have a analog circuit error.

If it does and the display "external temperature = 10.0" does not change you have a program error.

Your job is to find and fix the problem.

The cable:

H1.......................................................long pin H2.......................................................short pin NORTH transducer Earth------------------------------

..........wire 1 ..........wire 2 twin shielded microphone cable ----------shield

Good job Carl, nice anemometer. Im trying do create my own, my phase shift works well, but my TOF values changes a lot in some wind ocasions. I used the circuit of this article: http://www.ozitronics.com/docs/k168.pdf .... What happens is that sometimes the transistor saturates on one period after or before the actual period, that is the correct one. This occurs because of the variation of the amplitude of the receiving signal that changes with the wind. The transducers dont have the same properties, that means that a 8m/s wind on one pair works well, and a 8m/s on the other one doesnt. I was thinking on making two different amplifiers that uses different gains, but in some wind ocasion the same problem will happen. Do this happens with your TOF detection circuit and you get a lot of measures to compensate that? Or is it more robust? Do you have any ideas to help?? Thank you.

Then you mentioned the other problem about transducers behavior and define Northerror[20] . Why 20 values? An again the logic , even is there, not sure to follow why.

This relates to your problem of the differences.

From the project report we compensate using software:

We do run into another problem. Ultrasonic transducers are not symmetric for transmission and reception. The devices are not linear components and even worse the symmetry changes with temperature. You can match them as north-south, east-west pairs. It's properly a good idea to do so. However we do need to have a constant which is used to match the pairs as closely as possible. This constant will need to change with time as the temperature changes. I use: int Northerror[20]; //The tof error for north-south transmit We keep a running sample of the differences when the difference should be zero.

Hi Carl, im having some problems here, i would like to know how do you get Zero Crossing Detecting... Here, if I do this I get a Square Wave all the time because of the noise, that keeps crossing zero. How do you detect that the zero crossing isnt a noise? Do you have any graphic that shows the reception wave + the zero crossing at the same time? Thank You.

The circuit is shown there and R22 is used as a threshold set. Adjust this value to give output only when signal is received.

A CRO picture of the ZCD output is labelled "Output from the zero crossing detector with example program CRO".

Sorry for posting here, but when I went to your main thread, I couldn't get to or find the REPLY button.

Oh well.

Hey, great job.

How much would it cost to build one?

(Nominal)