# Frequency counting max 60Hz

Hello all. I want in my arduino application to be able to count the frequency of a wind speed sensor like this one http://www.inspeed.com/anemometers/Vortex_Wind_Sensor.asp . It will give frequencies from 0 up to 50-60Hz maximum. So what is the best way to meter such frequencies? I want to count this once every minute or so. Any suggestions?

The link you provided causes me a little concern, under instructions they simply say "so easy, none are needed" and on another tab they may the claim that no "power" is needed... yet the signal provides a "pulse"

You will need to contact them and get them to provide some information. I suspect that the device has a three conductor cable, power, signal, and ground... They will need to provide information on which wire is which... Also they will need to tell you if the pulse is a positive pulse or a negative pulse. You can spend some effort to determine this information, but they should provide it for their product...

After you get the above, with the low count frequency, you could simply check the status of a digital pin in the loop function and increment a counter, then once per minute do something the with count value. This would be reasonable only because the frequency is so low. For higher frequencies, or if you simply want a more robust design, use a external interrupt to monitor the signal, and another interrupt to trigger a function to process the signal counts on a time interval (ie. once per minute).

As the web page says something about a reed contact I'd guess that you simply have two wires which are connected in case of a pulse (so once per turn).
If you connect the signal to the external interrupt (pin 2 or 3) you can measure the time between two pulses and get a relatively exact value without waiting for a minute.

pylon:
As the web page says something about a reed contact I'd guess that you simply have two wires which are connected in case of a pulse (so once per turn).
If you connect the signal to the external interrupt (pin 2 or 3) you can measure the time between two pulses and get a relatively exact value without waiting for a minute.

I was thinking something like:

main program:
counter = 0;
sleep 5 seconds;
freq = counter / 5;

interrupt method:
counter ++;

Will this work? Will the 5seconds of sleep be actual 5 seconds? Or the [(max) 50Hz x 5seconds = ] 250 interrupts cause that sleep take longer than 5seconds and then the reading will not be accurate?

For this low frequencies your method will be more than accurate. The sensor itself has not a very high resolution by supplying only one pulse per turn.

Your probably going to have to de-bounce the reed switch with external hardware or in code. Ideally interrupt driven counter would be the best way so you don't miss counts. Maybe better than plain counting would be to calculate a rolling average of time between each pulse so you don't get such wild readings with wind gusts (unless your looking for that)

If you'll are right that there is simply a two wire connection to a reed switch, then the web site is wrong with its description of the output being a pulse... Since a switch closure is not a pulse...

wanderson:
If you'll are right that there is simply a two wire connection to a reed switch, then the web site is wrong with its description of the output being a pulse... Since a switch closure is not a pulse...

But if you momentarily keep making/breaking the switch contact then your pulsing it.
The image shows just two wires and from the description it does look like a simple reed switch making/breaking the circuit.