I am currently researching how I can interface my inspeed anemometer to my arduino. I have been googling a few ideas that I had, but I am still not clear on what is the best approach and more importantly there are a few things regarding the coding that are confusing me.
Basically the anemometer gives out a pulse once per revolution and apparently the windspeed in 2.5mph per pulse per Hz.
Anyway my ideas of implementing the interface were in order of preference:
1) Using the onboard counter to count the number of pulses on a regular basis over a 3 second intervals
2) Use an interrupt to count the pulses
3) Poll the pin.
So regarding the onboard counter I couldn't find much info on how to initialize them and actually use them. I found one page http://interface.khm.de/index.php/lab/experiments/arduino-frequency-counter-library/ where the code is confusing me and I can't find any info on how to use the functions in the library. Does anyone know what functions I can use to configure and use the onboard counter as I think this could be the best approach for me.
The interrupts approach is probably also an option. As I have more sensors to interface to, I don't want interrupts being triggered all the time and possibly affecting the timing on other interfaces. I was looking at a way of disabling interrupts and only enabling them for say a 3 second period when I wanted to check the windspeed. I saw some examples of this and a function cli(); but I cannot find info on the arduino page regarding this function. Is this the manner in which interrupts can be disabled? If I am unable to get the counter working this too could be a viable option if I was able to enable and disable interrupts when I wanted (perhaps even simpler than using the counter)
The polling technique would be the easiest and a method that I could implement straight away, but it has its disadvantages and I would like to understand how to use the counters or interrupts before resorting to that.
I'd be interested to hear the thoughts of anyone on the above methods, which would be best etc and also if anyone could shed some light on enabling disabling interrupts and using the counters I'd be very grateful.
Many thanks for the help