Great, got that, but after that? What is my next step?The coil should be as close as possible to the magnet without interfering with the fan. I'd experiment with the correct orientation.
Great, got that, but after that? What is my next step?The coil should be as close as possible to the magnet without interfering with the fan. I'd experiment with the correct orientation.
Ok, I just ordered a opamp and and I will add more turns on the coil but, which will be the output of my circuit, I have an inductor and a resistor in series. Will I connect want pin to gnd and the other one to the arduino Input ?With a large enough pulse on the pickup coil you can feed it directly into an arduino or other micro input pin. If it's too low, add more turns to the coil. If it's still too low, I'd look at using a transistor or opamp. I would use clamp diodes to protect the input pin.
The slot opto IR sensor and the hall sensor are both $1.50 ea at Digikey.It's just a cheap pickup coil. Probably cost less than a HE sensor or optointerrupter.
what's the cost of a loop of wire?The slot opto IR sensor and the hall sensor are both $1.50 ea at Digikey.
Max.
For the μP based one I built, it was more suited to use a digital device than an analogue type.what's the cost of a loop of wire?
If I was designing from scratch, I'd probably use HE but the TS was trying to retrofit something and was following the coil path. For manufacturing an inexpensive device, I think the coil makes the most sense (pun somewhat intended...). Plus, for experimenting, mixing analog and digital is always fun.For the μP based one I built, it was more suited to use a digital device than an analogue type.
Max.
Hi again, so I made the circuit on the reply below and I have attached some photos of the oscilloscope. While blowing harder on the fan the square waves were smaller, more pulses. Do you find it good ? And now I just have to connect it to arduino and measure the pulses and translate it to numbers right? Amount of pulses in time.We'll tackle one thing at a time. Let's see what the signal looks like on an oscilloscope.
Yes it will be AC, but that doesn't mean that it has to go positive and negative. We can amplify and level shift it so that it goes between 0V and 5V (assuming that the Arduino board accepts 0-5V signals). We can input that to the Arduino chip (Atmel ATmega chip).
Hi again, so I made the circuit on the reply below and I have attached some photos of the oscilloscope. While blowing harder on the fan the square waves were smaller, more pulses. Do you find it good ? And now I just have to connect it to arduino and measure the pulses and translate it to numbers right? Amount of pulses in time.
Uploaded my circuit with fan as well.
![]()
I mean I'm counting the pulses with pulseIn() but how do I translate it fast slow?
Take Hall sensor, for example DN6851, from dead computer's fan and place it close to magnet. Connect lead 3 to arduino input, lead 2 to ground and lead 1 to +5 V.Hello, I want to make a wind meter like this one: attached
Hi MrChips, So I have this program and I measure the pulses (rising of pulses) in a fixed time. I attached the output. It half works, meaning when I blow on the fan the count rises, my problem now is that count 1 is 1.47mph , count 2 .94mpg etc , so I have fixed numbers but not a nice ramp with numbers, do you know how to do that?Your pulses are not getting smaller. What you mean to say is the peak-to-peak amplitude is 4.6V and the cycle period goes from 38ms to 6ms as you blow on the fan.
Since the signal is the output of a comparator, you can connect the signal directly to the Arduino input and measure the duration of the HIGH signal using the pulsein(pin, value) function.
This is just a first step. Ideally, you want to measure the duration (i.e. period) of one complete cycle or you want to count the number of pulses over a fixed time.
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 ("The Wind Speed Is"); // Print a heading
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
}
Thanks for your answer, the sample time of one second was to big, I mean the delay was to long to wait for 1 second, that's why I put 100 ms.This was the code I provided you in another forum:
Take note of these lines: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 ("The Wind Speed Is"); // Print a heading 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 }
interrupts(); //Enables interrupts on the Arduino
delay (1000); //Wait 1 second
noInterrupts(); //Disable the interrupts on the Arduino
This is what you have:
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
The idea of a 1000 milli-second delay was using interrupts to create a 1 second sample period. Why was that changed to 100 mSec? The code needs to have a flow. If you work from the basic code you will have something that works. What was missing when I gave you that sample was how many pulses you get for various calibrated wind speeds, making sure your pulses are linear. Meaning if you get 20 PPS (Pulses Per Second) for a 10 MPH wind you should get 40 PPS for a 20 MPH wind speed. One suggested calibration method was to drive on a windless day at various speeds and note the pulse counts.
Also if you recall within the final lines of code:
//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
Those lines are remarked out so you can put in your own math functions.
Ron
.