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.
Some additional questions reviewing your excellent document
On the HW side,
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
D1 , on the envelope detector, should not be a precision rectifier? I mean, it will bring 0,6 V down
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
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 .
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 .