i have been measuring rpm of few ac devices (juicers, mixer\grinders etc) using ir led attached coin cell(which connected rotating arm of appliance) , photodiode connected arduino.
although rpm count coming out pretty accurate, have observed ir led , photodiode pair interacts more time want. leads me suspicion calculated rpm may more actual.
please suggest how use ir led + photodiode reliable sensor.
following arduino code:
although rpm count coming out pretty accurate, have observed ir led , photodiode pair interacts more time want. leads me suspicion calculated rpm may more actual.
please suggest how use ir led + photodiode reliable sensor.
following arduino code:
code: [select]
int sensepin = 04;
int rotationcount=0;
// setup function runs once when press reset or power board
void setup() {
serial.begin(9600);
pinmode(sensepin, output);
}
// loop function runs on , on again forever
void loop() {
int sensorvalue;
digitalwrite(sensepin,high);
sensorvalue = analogread(a0);
if (sensorvalue < 1023)
{
rotationcount++;
serial.println(rotationcount);
delay(3); // dirty fix sense ir led+photdiode once
}
}
hi,
you try detecting "edge" of signal photodiode, rather current value. make global variable record value returned analogread() last time read. each time take new reading, compare (i.e. subtract) last reading. if value has changed significant amount, increment count. "significant" means, have determine experiment. may still need delay() prevent double-counting, may able away shorter delay, enabling measure higher speeds.
paul
you try detecting "edge" of signal photodiode, rather current value. make global variable record value returned analogread() last time read. each time take new reading, compare (i.e. subtract) last reading. if value has changed significant amount, increment count. "significant" means, have determine experiment. may still need delay() prevent double-counting, may able away shorter delay, enabling measure higher speeds.
paul
Arduino Forum > Using Arduino > LEDs and Multiplexing > Measuring RPM with IR led and Photodioide.
arduino
Comments
Post a Comment