3763Views4Replies

Author Options:

Arduino LDR tachometer (RPM counter)- not sensitive enough ?!? Answered

Ladies & Gentlemans  ...

I would like to ask you, what I'm doing wrong, in this RPM counter ??? As mentioned in my previous questions, I 've got an ARDUINO and I started with my first part - of my project. To count RPM / or speed.

I'm using a LDR (light dependant resistor) and green laser as light source. The scheme is like this:

+ 5V ------- LDR -------------Analog pin 1
                                    \
                                      \--------resistor (220kOhm) --------- GND

The code for this project looks like this :


int LDR=1; // LDR is on analog port 1
int val=0; // this is the value, I get from the LRD

void sextup(){  Serial.begin(9600); }
void loop()
{
 val = analogRead(LDR);
// read the value getting from LDR
Serial.println(val);
if (val<1018) {delay(4000);}

}
To explain the value 1018 in the IF condition ... when pointed the laser on the LDR,I get value from 1019-1020. So my idea was, when the value decrease just by one or more ... let me know, that the laser beam has been interrupt. But I realised, that I can cross the laser beam very quickly, and the LDR/Arduino will not notice it.

I really don't know, where I'm going wrong. My few suggestions are :

1. wrong method - to use LDR ... should I use something else ???
2. wrong RESISTOR value ??? ... should I change to different value to make it more sensitive ???
(I tried 2 different values = 220kOhm, 46kOhm ... that's what my voltmeter said :) ... but with both of them I have the same result )
3. should I use different code ??? Any ideas ???

Thank you in advance for your answers.

Zholy

4 Replies

user
steveastrouk (author)2009-11-22

Personally, I think the problem is an LDR isn't fast enough to sense rapid changes, use a photodiode or phototransistor.

Select as Best AnswerUndo Best Answer

user
seandogue (author)2009-11-21

Okay, first of all,. to measure rpm I'd stick to a digital approach on inputting signal to the Arduino. Standard approach uses a comparator and/or Schmidt trigger where you've put the Arduino's pin in your circuit.

At that point, you point the output of the intermediary circuit to the Arduino and use the PulseIn() command to capture the signal

Sorry I can't give you much more specific than that..I don't use Arduinos, but I have done alot of things with uCs over the years and glanced at the command reference to see what was avaiable for the task.

Select as Best AnswerUndo Best Answer

user
seandogue (author)seandogue2009-11-21

BTW, minimize any looping structure, as these will dramatically slow the capture process and result in errors. Perhaps that's what PulseIn() is supposed to avoid...idk.

Select as Best AnswerUndo Best Answer

user
seandogue (author)seandogue2009-11-21

Here..I dug this out of the net. maybe it;ll help you.

http://interface.khm.de/index.php/lab/experiments/arduino-frequency-counter-library/

Select as Best AnswerUndo Best Answer