Wind speed_direction meas

Hi,
I have Young's sensor model 05103-90N for measuring wind speed and direction. It has potenciometer for direction and I successfully measure resistance and convert to appropriate wind direction.
I have issues with wind speed.
Sensor has magnet on propeller shaft who induces AC sinus wave signal for wind speed measurement. I suppose that need to connect sensor output to Arduino Uno analog input and I have some reading on it but don't know meaning of outputs. It should be number of passing magnets over coil where signal inducted. I found this logic in an sketch after many of googling. The code is bellow.

void setup() {
  Serial.begin(9600);
  pinMode(A5, INPUT);
}
int period = 1000; //reading every sec
unsigned long time_now = 0;
unsigned long obrtaji=0;
void loop() {
  obrtaji+=analogRead(A5);
  if(millis() >= time_now + period){
    Serial.println(0.098*obrtaji/period);//should be wind speed
    obrtaji=0;
    time_now += period;
  }
}

Do somebody have idea how to solve this?

Thanks

what result do you get?

void setup() {
  Serial.begin(9600);
}
void loop() {
  Serial.println(analogRead(A5));
}

if the signal goes negative you don't want to connect that to your UNO ! use a diode to only get the positive fronts

I have got integer numbers depending of rotating propeller. If there is no rotation output are zeros, in case of rotating got 3,5.. I need to set delay(1000) to see what I have got

I already have diode, just in case..

OK good so when you say

what does the documentation state about the relationship between wind speed and the sinus wave ? is the frequency related to the speed for example?

@J-M-L , I have this in documentation:

Range: 0 to 100 m/s (224 mph)

Sensor: 18 cm diameter 4-blade helicoid propeller molded of polypropylene

Pitch: 29.4 cm air passage per revolution

Transducer: Centrally mounted stationary coil, 2K Ohm nominal DC resistance

Transducer Output: AC sine wave signal induced by rotating magnet on propeller shaft. 80 mV p-p at 100 rpm. 8.0 V p-p at 10,000 rpm

Output Frequency: 3 cycles per propeller revolution (0.098 m/s per Hz)

This is a part from documentation.

Here is the link you should have posted in your original post

@PaulRB ,
Thx, that didn't fall on my mind. Sorry :blush:

One approach would be to measure the number of zero crossings per second (two of those per Hz). The conversion factor would be 0.049 m/s per zero crossing.

You will need some input additional circuitry, depending on which Arduino you have.

@jremington ,
I use Arduino Uno R3.
How to detect zero crossings? I answered to @kolaha that I have some numbers as output on analog (A5) but don't know meaning of that. When propeller stand I have got zeros on serial.
I suspected on low voltage on low rotations so applied logical gate to amplify signal but with same results.

Now that we know you have an Uno, my approach would be to use the analog comparator: https://www.gammon.com.au/forum/?id=11916

The wind speed sensor would be connected between the two comparator inputs as shown below (R1/R2 bias the inputs, R3 protects the inputs from overvoltage).

But a quick internet search for "arduino uno zero crossing detector" would turn up a very large number of other approaches.

Capture

seems the voltage does vary - careful not to send 8V into an Arduino pin

@J-M-L ,
I made circuit to protect Arduino from overvoltage
@jremington ,
Interesting approach. I will google it

So, then

void setup() {
  Serial.begin(9600);
  pinMode(A5, INPUT);
}
const int period = 1000; //reading every sec
unsigned long time_now = 0;
unsigned long revolutions = 0;
void loop() {
  if (analogRead(A5) > 10) {
    revolutions++;
    while (true) {
      if (analogRead(A5) < 10)break;
    }
  }

  if (millis() - time_now >= period) {
    Serial.println(0.098 * revolutions / period); //should be wind speed
    revolutions = 0;
    time_now += period;
  }
}

10,000 rpm means you can't use the slow analogRead of a common Arduino.

A biased analogue comparator and interrupts seems a good plan.

Don't use 'a diode' for pin protection.
Use two Schottky clamping diodes instead.
Leo..

now can digital pin be used

An LM393 comparator could work, but not that circuit. +input shouldn't be 'floating' (it is now), and -input should be biased (can't be grounded on a single supply).
But why not use the Arduino instead of an external circuit.
Leo..

изображение

@kolaha ,

Does R1 and R2 should be same or you select 1k from some reason? And why C1 is 0.1u? I tried digital output but not with this circuit.
If I understand well, on digital pin I need to count high logic input?