How to read Davis pulse anemometer (wind speed) on Arduino Nano

Hi everyone, I'm working on a university project and I need to read the wind speed from a Davis anemometer (Vantage pro 2).

I've tried using a pulseIn function reading LOW, as I thought that would read the time between each pulse. From that, I could then calculate the windspeed.

However, on the serial monitor it gives me 0 most of the time for duration with some rare random spikes.

I'm quite new with Arduino so I'm not entirely confident that I'm using pulseIn correctly, or even that it's the right function to use, so I thought I would ask here for some help.

This is my code:

int pin = 2; //this is the pin that receives the pulse

unsigned long duration; //duration of the pulse

void setup()

{

  Serial.begin(9600);
  pinMode(pin, INPUT);

}



void loop()

{
  
  Serial.print("Duration of pulse:");
  duration = pulseIn(pin, LOW); //this way it reads for how long there is no pulse i.e. the duration between pulses?
  Serial.print(duration);
  Serial.print("\n");
  
 }

Thanks.

Have you checked you are getting 5 volt pulses from the anemometer?

pulseIn(pin, LOW) will measure time for which the signal is 'low'.

Yeah, I hooked it up to a multimeter and it was giving off the 5V pulses.

pulseIn(pin, LOW) will measure time for which the signal is 'low'.

That means the duration between pulses right? Because it wasn't working for me.

SamuVim: That means the duration between pulses right?

As you are regarding a "pulse" as when the signal is high, then yes.

Check your connections, including ground connection to the anemometer. Check your signal is connected to the correct pin; when Arduinos have pin labelling between the pins it is very easy to connect to the adjacent pin by mistake. To eliminate any other factors, you could test your code with a switch or push button in place of the anemometer (with pull-up resistor or use INPUT_PULLUP). You could use your multimeter to check the 5V pulses are getting to pin 2 (if using probes, be very careful not to short anything).

I don't have an Arduino kicking around at the moment on which to test your code.

Hi Master,

Any one can help me, i need code for setup arduino uno R3 + wiznet ethernet w5100 + davis anemometer (4 cabel red+black+yellow+green.

i need the davis anemometer for windspeed and wind direction can work at web server with ip local and ip public.

i hope some one can help create the code for it.

thank you and appreciated.

Qris