Mikelagoud
New Member
Once you know the variables of what you have, as in how many pulses per unit and if the pulses are linear then you just remove the // from the lower lines and fill in the math functions. If you want to get fancy have the output display things like wind velocity in kilometers per hour as well as miles per hour. Heck, using an Arduino you can also toss in ambient temperature.Good luck with it. Just remember the final lines need to be setup.
Ron
Hi again, I was doing some measurments and noticed a problem, on the attached photo is the output from the arduino, I have a big fan and was counting a good wind meter I have and according to that I was calibrating mine, but as you can see at the photo the 4.42 mph is the correct measurment but without moving it ( I have it steady and same distance, not moving it) every some time it goes to 2.94 mph. Attached the code as well. Do you know why?
Code:
#define mph_var 2.23
#define kph_var 3.6
double windRate, ms, Mph, Kph; //This is the value we intend to calculate.
volatile int count; //This integer needs to be set as volatile to ensure it updates correctly during the interrupt process.
void setup() {
attachInterrupt(0, Wind, RISING); //Configures interrupt 0 (pin 2 on the Arduino Uno) to run the function "Wind"
Serial.begin(9600); //Start Serial
}
void loop() {
count = 0; // Reset the counter so we start counting from 0 again
interrupts(); //Enables interrupts on the Arduino
delay (100); //Wait
noInterrupts(); //Disable the interrupts on the Arduino
//Start the math Calculate for mph or kph or both
windRate = (count * 11.00) * 60; //Take counted pulses in the last second and multiply by 5.0 and then convert it to minutes
windRate = windRate / 1000; //Convert windrate, giving you Velocity/ Hour
ms = windRate;
Mph = ms * mph_var;
Kph = ms * kph_var;
// Serial.println(count); //Print the variable windRate to Serial
Serial.print("m/s: ");
Serial.print(ms);
Serial.print("\t");
Serial.print("mph: ");
Serial.print(Mph);
Serial.print("\t");
Serial.print("km/h: ");
Serial.println(Kph);
}
void Wind()
{
count++; //Every time this function is called, increment "count" by 1
}