Go Down

Topic: Progrmming Help Required - DC Motor as Annemometer (Read 1 time) previous topic - next topic

Khalid

Jun 26, 2011, 01:13 pm Last Edit: Jun 26, 2011, 01:14 pm by Khalid Reason: 1
Dear All,
BackGround:
I am working on a Laminar Flow nozzle project. In this project Arduino shall control RGB LED, one Solenoid, and Anemometer made from CD ROM Motor. Actually i should not called it a perfect Anemometer for the time being because it just provide me voltage at high wind and i am not able to convert those voltages into wind MPH. The maximum voltage i get from this Anemometer is 0.4 V DC.  
The idea is when the voltages reaches to 0.24 DC the laminar flow disturb and i want to stop the pump. This seems very simple as i can monitor the voltages through Analogue pin easily. But, i do not want the Arduino to stop/start the pump frequently.

WHAT I want:
1- I want Arduino to get the voltage of Anemometer. If the voltage reading is 0.24 DC then take further readings if the voltage is greater 0.24 or equal to 0.24 for 1 minutes then STOP the pump.
2- The Arduino takes the reading of anemometer after stoppage of pump if the readings are persistent for a minute then the Pump should not be started. This cycle should be calculated again and again till the arduino knows that the wind is low and DC voltages are less than 0.24VDC. then start the pump.


http://www.youtube.com/watch?v=2CGyUeY6k08

I need all of your help please. How can i do it. Any psuedcode will be useful or any other method / technique shall be good for me.

Regards
Khalid Khattak

PaulS

There are two issues you are having. One is making use of the very small voltage that you are generating. The other, of course, is the very small voltage that you are generating. If you were to run that voltage through an op-amp with a 12 to 1 gain, you'd get 0 to 4.8 volts, which would translate to many more values output by the analogRead function, which would greatly improve your ability to make use of the data.

That's where I'd start.

Once you have a wider range of readings, you can read the value, on each pass through loop().
If the value is greater than a threshold (in terms of analogRead output not voltage), and was not before, record the time. This means, of course, that you also need to keep track of the previous value. If the value is less than the threshold, set the time to 0.

Separately, you need to see if "now" (as defined by millis()) is greater than "then" (when the value exceeded the threshold), and "then" is not 0. If so, stop the pump. If not, leave the pump running.

floresta

Have you considered using a stepper motor (from an old floppy disk drive) instead of the DC motor.  The output is AC, but even after the voltage drop of the rectifier you will probably get more DC than you are getting now.

Don

Khalid

#3
Jun 26, 2011, 05:23 pm Last Edit: Jun 26, 2011, 05:25 pm by Khalid Reason: 1
Thank you Paul and Don for the valuable replies.I want to share with you following video where i was able to light up an LED when required threshold is received off-course :
Code: [Select]
/*


int sensorPin = A0;    // select the input pin
int ledPin = 13;      // select the pin for the LED
int sensorValue = 0;  // variable to store the value coming from the sensor(DC Motor)

void setup() {
 // declare the ledPin as an OUTPUT:
  Serial.begin(9600);
 pinMode(ledPin, OUTPUT);  
}

void loop() {
 // read the value(DC Voltage) from the sensor(DC Motor):
 sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
 // turn the ledPin on
 if (sensorValue>25)    // (This 25 was the rough value. How i got it? I rotated the anemometer by hand and got the values with the Serial.Println.  i selected by seeing the rotation of Annemometer and assuming that if the annemometer is that fast( sensorvalue=25) the Laminar flow of the fountain shall be disturbed.and this  will decide to make LED on(later i will use this to OFF the pump)
 {digitalWrite(ledPin, HIGH);
  }
else        
 // turn the ledPin off:        
{ digitalWrite(ledPin, LOW);
 }
 
 // stop the program for for <sensorValue> milliseconds:
                 
}


Here is the video:
http://www.youtube.com/watch?v=megInro0qII

I know the value (25 or any value) that is generated in Arduino make some sense . For example if i rotate the Anemometer at a fix RPM (assume) i get value 25. If the RPM is little increase i will get the value greater than 25. Now i want the same how i program that for a certain period of time(monitoring) if the value 25 stays the same or increased the Arduino make the pump stop.

PaulS

Quote
Now i want the same how i program that for a certain period of time(monitoring) if the value 25 stays the same or increased the Arduino make the pump stop.

Re-read the second part of reply #1.

Go Up