Trying to use the NRG 40 Anemometer to measure wind speed on the arduino mega. I currently have the signal going through a comparator, LM 324, to try and convert the sinewave to a square wave using a 5v source. I'm using Freqmeasure.h's Serial Output example which is as follows:
/* FreqMeasure - Example with serial output
* http://www.pjrc.com/teensy/td_libs_FreqMeasure.html
*
* This example code is in the public domain.
*/
#include <FreqMeasure.h>
void setup() {
Serial.begin(57600);
FreqMeasure.begin();
}
double sum=0;
int count=0;
void loop() {
if (FreqMeasure.available()) {
// average several reading together
sum = sum + FreqMeasure.read();
count = count + 1;
if (count > 30) {
float frequency = FreqMeasure.countToFrequency(sum / count);
Serial.println(frequency);
sum = 0;
count = 0;
}
}
}
Does the square wave need to be input to pin 49? does the voltage pk-pk matter? how "perfect" does the square wave need to be for the arduino to read it? the frequency is generally around 60 Hz with a pk-pk of ~600mV.
There is a simple equation for windspeed with frequency in Hz as the variable, so I just need to convert the voltage sinewave generated by the anemometer into a square wave that can be read by the arduino mega.
Thanks and if I'm missing any crucial information please let me know so I can provide it!!