# Anemometor - inductor measurement

Status
Not open for further replies.

#### ClydeCrashKop

##### Well-Known Member
Yes you can.
Do you have a unit to hack or are you starting from scratch?
Is there a measurable voltage at the inductor?
If so, what is the minimum voltage and maximum when spinning fast?

#### jpanhalt

##### Well-Known Member
Welcome to ETO.

Can you post a picture of the inductor? My guess is that the inductor, if it really is one, is producing pulses, not a continuous change in inductance.

#### Colin

##### Active Member
I bought mine for $12.00 For$12.00 you couldn't even make the fan.
The fan is magnetic. The magnet is in the hub. The magnetic flux is picked up by a Hall device.

#### JonSea

##### Well-Known Member
Doesn't a magnet moving over a coil of wire make a generator? The output voltsge should be proportional to speed.

#### Colin

##### Active Member
Yes. But the coil is an alternator and you pick up the pulses. Dealing with the output voltage is far too difficult.

#### Mikelagoud

##### New Member
Yes you can.
Do you have a unit to hack or are you starting from scratch?
Is there a measurable voltage at the inductor?
If so, what is the minimum voltage and maximum when spinning fast?
So I attached the circuit that the wind meter has and you can see the inductor on the top. I bought similar inductors from Amazon and when I measure the the ac voltage with a multi meter while blowing on a fan and having the inductor next to the fan the voltage is between 0-10mili volts. Can I convert this ac voltage to a digital pulse and read it with arduino?

#### Attachments

• 58 KB Views: 40

#### Colin

##### Active Member
It doesn't convert the voltage. It detects the pulses.

#### Attachments

• 40.3 KB Views: 38

#### Mikelagoud

##### New Member
Image from page 2 of the LM111/211/311 datasheet

Full datasheet can be found here: http://www.ti.com/lit/ds/symlink/lm311-n.pdf
Hello Sir, I made this circuit and I have a small fan with a magnet and was blowing to the inductor and was getting pulses on the oscilloscope, faster blowing more pulses. Attached photos. To count it with the arduino and translate it to a wind meter how do I do it? I mean I'm counting the pulses with pulseIn() but how do I translate it fast slow?

#### Attachments

• 113.9 KB Views: 22
• 108.6 KB Views: 24
• 111.3 KB Views: 25
• 103.1 KB Views: 23
• 105.5 KB Views: 24
• 103.5 KB Views: 22
• 97.5 KB Views: 23
Last edited:

#### Colin

##### Active Member
It depends on how many pulses you need to detect in say 20mS.
You "open the gate" and count in the background 20mA. Store the number of pulses detected.
Hold the fan outside the window of the car. Drive at 49km/hr.
Use this as a reference.
It's so easy.

#### jpanhalt

##### Well-Known Member
Rather than count the number of pulses in a set period, I suggest timing single pulses. You can set an interrupt or flag for an edge (rising or falling) and capture the time between those events. At least that is how I would do it with a PIC and presumably arduino has the same capabilities.

#### Mikelagoud

##### New Member
Rather than count the number of pulses in a set period, I suggest timing single pulses. You can set an interrupt or flag for an edge (rising or falling) and capture the time between those events. At least that is how I would do it with a PIC and presumably arduino has the same capabilities.
Hmm I like this ideq, I know how to measure the pulses in a period of time but how do I do what you suggested? I understood to put a flag when the rising pulse occurs let's say 1 but how do I know when it's falling and becomes zero?

#### jpanhalt

##### Well-Known Member
The difference between the methods is the responsiveness. Take your slow frequency which had a period of about 40 ms. If you counted ten cycles, it would take 400 ms and the counting error would be approximately +/- 10%. If you timed a single cycle ( or several cycles), your response time would be cut considerably and the MCU timer would easily give 1 part in 1000 (2^10) precision.

The arduino is based on an Atmel chip, which is manufactured today by the same company that makes PIC's. They all seem to have very similar functionality -- including the ability to start and stop timing on a transition (low-to-high or high-to-low or both), and the timer runs at a few MHz. Of course, there are pre- and post-scalers for those counters, so you can adjust the timer to get the number of counts you want. I know how to do that with a PIC, which is quite easy. Unfortunately, I have never touched an arduino, but I suspect it is at least and probably more easy to do.

Someone with that experience will surely chime in.

John

Last edited:

#### ClydeCrashKop

##### Well-Known Member
I made a very accurate tachometer for a Yanmar diesel that had a hall effect sensor getting signals from the ring gear teeth on the flywheel. I adjusted the timer to reset after it counted 2000 teeth at 2000 RPM and it was accurate throughout the entire range. No math or lookup tables. Just count pulses until the timer times out, display that number and start counting again. In this case, it counted the right number of teeth in about 1/2 second.

So in your case, set your timer to count pulses for 1 second and like was said earlier, hold it out your car window at 50 MPH. If it is reading 90 MPH, shorten the count time. If it is reading 40 MPH, lengthen the count time.

Last edited:

##### Well-Known Member
If you wish to use an Arduino you can try the following code sample. You can modify the code to fit your needs. As can be seen the code displays wind velocity expressed in MPH (Miles Per Hour) which can easily be converted to kph or if you like add a line or two of code and display both.
Here is what it looks like in Arduino:

The actual code sample:
Code:
int windPin = 2;    //This is the input pin on the Arduino
double windRate;    //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() {
// put your setup code here, to run once:
pinMode(windPin, INPUT);           //Sets the pin as an input
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() {
// put your main code here, to run repeatedly:
count = 0;      // Reset the counter so we start counting from 0 again
interrupts();   //Enables interrupts on the Arduino
delay (1000);   //Wait 1 second
noInterrupts(); //Disable the interrupts on the Arduino

//Start the math Calculate for mph or kph or both
//windRate = (count * 5.00);        //Take counted pulses in the last second and multiply by 5.0
//windRate = windRate * 60;         //Convert seconds to minutes, giving you Velocity / Minute
//windRate = windRate / 1000;       //Convert windrate, giving you Velocity/ Hour
Serial.println(count);  //Print the variable windRate to Serial
Serial.println("Miles Per Hour");
}

void Wind()
{
count++; //Every time this function is called, increment "count" by 1
}
The last lines of code are remarked out:
//Start the math Calculate for mph or kph or both

These lines allow you to place your math functions in for your pulse count. Less the additional math functions as it is the display is pulses per second displayed.
Serial.println(count); //Print the variable windRate to Serial

Once you have your math worked out that will change to:
SerialPrintln(WindRate); // That will display the eind velocity.

You need a pulse count so I suggest Colin's method. Place the sensor on a vehicle on a calm wind day and get pulse counts for assorted speeds.

Ron

#### Mikelagoud

##### New Member
If you wish to use an Arduino you can try the following code sample. You can modify the code to fit your needs. As can be seen the code displays wind velocity expressed in MPH (Miles Per Hour) which can easily be converted to kph or if you like add a line or two of code and display both.
Here is what it looks like in Arduino:
View attachment 109328

View attachment 109329

The actual code sample:
Code:
int windPin = 2;    //This is the input pin on the Arduino
double windRate;    //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() {
// put your setup code here, to run once:
pinMode(windPin, INPUT);           //Sets the pin as an input
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() {
// put your main code here, to run repeatedly:
count = 0;      // Reset the counter so we start counting from 0 again
interrupts();   //Enables interrupts on the Arduino
delay (1000);   //Wait 1 second
noInterrupts(); //Disable the interrupts on the Arduino

//Start the math Calculate for mph or kph or both
//windRate = (count * 5.00);        //Take counted pulses in the last second and multiply by 5.0
//windRate = windRate * 60;         //Convert seconds to minutes, giving you Velocity / Minute
//windRate = windRate / 1000;       //Convert windrate, giving you Velocity/ Hour
Serial.println(count);  //Print the variable windRate to Serial
Serial.println("Miles Per Hour");
}

void Wind()
{
count++; //Every time this function is called, increment "count" by 1
}
The last lines of code are remarked out:
//Start the math Calculate for mph or kph or both

These lines allow you to place your math functions in for your pulse count. Less the additional math functions as it is the display is pulses per second displayed.
Serial.println(count); //Print the variable windRate to Serial

Once you have your math worked out that will change to:
SerialPrintln(WindRate); // That will display the eind velocity.

You need a pulse count so I suggest Colin's method. Place the sensor on a vehicle on a calm wind day and get pulse counts for assorted speeds.

Ron
Hi there, thank you very much! The program works perfect for what I need. I now just doing a calibration with a good anemometer I have.