How to calculate maximum wind or gust

Hi

I’m working with an anemometer. The basic function is every time the anemometer does a circle the sensor sends a click, so un click=1,2kph

During 8 second I measure the clicks, but what I want to have is the average of clicks = kph and I want to know the gust or maximum.

I’m using this script

  speed = 0;
  int windreadings = 25;
  for ( int i = 0 ; i < windreadings ; i++ ) {
speed += analogRead(A1);
Serial.print(speed);
delay(50);
  }
  speed /= windreadings;

I’m blocked I don’t know how to do that…

Thank’s

I guess this isn't quite so. You need to consider the time between "clicks" to actually calculate the speed, right?

If you search the forum for "anemometer" or "weather shield" you might find some discussions about using interrupts for that.

But one thing to note for sure is that analogRead() isn't the right tool for that. If you want to do it that way, you'd rather want digitalRead() (or as I said interrupts).


Update:
I just realised that you and me (amongst others) have already discussed very similar things in (at least two) other threads
Davis anemometer and Electron
Nightmare with photon weather shield - #5 by ScruffR

1 Like