Columbus, Ohio USA
Offline
Full Member
Karma: 1
Posts: 102
Arduino rocks
|
 |
« Reply #15 on: September 11, 2011, 10:08:43 am » |
how do I know what frequency input is what output voltage..
The datasheet is not clear to me...
Check out the equation given: Vout = fin * Vcc * R1 * C1 So just for the sake of argument say you wanted the full-scale reading (Vout = Vcc) to be at 2000 Hz (2000 rpm in your case as I understand it): R1 * C1 = 1/2000 = .0005 On p. 7 of the data sheet there are some guidelines for choosing R1 and C1, although as you say it's not exactly clear--maybe just experiment. Joe
|
|
|
|
|
Logged
|
|
|
|
|
INDIA
Offline
Sr. Member
Karma: 0
Posts: 331
Arduino rocks
|
 |
« Reply #16 on: September 13, 2011, 03:13:38 am » |
I want pick the capacitive pulse with a ne555 like here http://www.sportdevices.com/rpm_readings/index.htmand feed it to the LM2917.. now in my single cylinder bike there is one spark in every rotation.. so if the engine is running at 2000 rpm then what will be the frequency (Fin) ..?? 2000 Hz or (2000/60 )Hz...??
|
|
|
|
|
Logged
|
|
|
|
|
Columbus, Ohio USA
Offline
Full Member
Karma: 1
Posts: 102
Arduino rocks
|
 |
« Reply #17 on: September 13, 2011, 03:56:48 am » |
I want pick the capacitive pulse with a ne555 like here http://www.sportdevices.com/rpm_readings/index.htmand feed it to the LM2917.. now in my single cylinder bike there is one spark in every rotation.. so if the engine is running at 2000 rpm then what will be the frequency (Fin) ..?? 2000 Hz or (2000/60 )Hz...?? Oh, sorry--right you are, it's 33 1/3 Hz. Funny, that! Joe
|
|
|
|
|
Logged
|
|
|
|
|
INDIA
Offline
Sr. Member
Karma: 0
Posts: 331
Arduino rocks
|
 |
« Reply #18 on: September 13, 2011, 06:07:53 am » |
first I want to ask that should I convert the frequency to 0 - 5 volt ( taking Vout = 5 volt at 7000 Rpm) and read it with the analog input pin..??
so my 0 - 7000 RPM will be analog read rpm = map(rpm, 0, 1023, 0, 7000)
OR
There is other better way to do it for better precession and accuracy..??
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 311
Posts: 35470
Seattle, WA USA
|
 |
« Reply #19 on: September 13, 2011, 06:48:48 am » |
There is other better way to do it for better precession and accuracy..?? None of what you suggest here will make for better precision or accuracy. Multiplying an inaccurate value won't make it more accurate. Getting the signal each and every time, at the exact time it is sent, is how you improve accuracy. Precision is rather meaningless in this context. Either you got the pulse or you didn't. There isn't any middle ground.
|
|
|
|
|
Logged
|
|
|
|
|
Toronto, Canada
Offline
Edison Member
Karma: 2
Posts: 1233
"Keep it R.E.I.L. - "Research, Experiment, Investigate and Learn"
|
 |
« Reply #20 on: September 13, 2011, 09:15:05 am » |
If I may add to Pauls, also depend on the rotation device ( ei : your bike motor )
|
|
|
|
|
Logged
|
|
|
|
|
INDIA
Offline
Sr. Member
Karma: 0
Posts: 331
Arduino rocks
|
 |
« Reply #21 on: September 13, 2011, 10:42:35 am » |
So should I just go for -
convert the frequency to 0 - 5 volt ( taking Vout = 5 volt at 7000 Rpm) and read it with the analog input pin..??
so my 0 - 7000 RPM will be analog read rpm = map(rpm, 0, 1023, 0, 7000)
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 311
Posts: 35470
Seattle, WA USA
|
 |
« Reply #22 on: September 13, 2011, 11:13:30 am » |
convert the frequency to 0 - 5 volt Frequency of what? How will you convert that frequency to a voltage?
|
|
|
|
|
Logged
|
|
|
|
|
INDIA
Offline
Sr. Member
Karma: 0
Posts: 331
Arduino rocks
|
 |
« Reply #23 on: September 13, 2011, 12:53:56 pm » |
convert the frequency to 0 - 5 volt Frequency of what? How will you convert that frequency to a voltage? PaulS this is the IC which converts frequency to voltage http://www.national.com/ds/LM/LM2907.pdfand the calculation for it is Vout = Vcc * Fin * R1 * C1
|
|
|
|
|
Logged
|
|
|
|
|
United Kingdom
Offline
Faraday Member
Karma: 130
Posts: 4635
|
 |
« Reply #24 on: September 13, 2011, 01:04:08 pm » |
Converting what is essentially a digital signal to analog via a frequency-to-voltage chip and then converting it back to digital strikes me as being a very silly way to make a digital RPM meter. Much better is to:
1. Clean up the input pulse if necessary so that you get one (or more) well-defined pulse(s) per revolution (you would have to do this anyway of you use a frequency-to-voltage chip);
2. Feed the pulse into an Arduino pin that supports interrupts. In the ISR, record the time that the pulse occurred using a call to micros(), and calculate the time since the previous pulse. Then the RPM is just 60 divided by the interval (in seconds) between pulses.
|
|
|
|
|
Logged
|
Formal verification of safety-critical software, software development, and electronic design and prototyping. http://www.eschertech.com
|
|
|
|
INDIA
Offline
Sr. Member
Karma: 0
Posts: 331
Arduino rocks
|
 |
« Reply #25 on: September 13, 2011, 01:22:44 pm » |
Converting what is essentially a digital signal to analog via a frequency-to-voltage chip and then converting it back to digital strikes me as being a very silly way to make a digital RPM meter. Much better is to:
1. Clean up the input pulse if necessary so that you get one (or more) well-defined pulse(s) per revolution (you would have to do this anyway of you use a frequency-to-voltage chip);
2. Feed the pulse into an Arduino pin that supports interrupts. In the ISR, record the time that the pulse occurred using a call to micros(), and calculate the time since the previous pulse. Then the RPM is just 60 divided by the interval (in seconds) between pulses.
You are right.. I even had the same thought in my mind that why convert frequency to voltage and feed arduino when arduino itself can take the frequency directly.. If you read my posts right from the beginning, you will notice thats what I wanted to do .. I wanted to find the time gap between pulses and calculate the RPM...But I just couldn't get how to find the interval... can you please help me with the coding as you said..??
|
|
|
|
|
Logged
|
|
|
|
|
United Kingdom
Offline
Faraday Member
Karma: 130
Posts: 4635
|
 |
« Reply #26 on: September 13, 2011, 02:02:49 pm » |
OK, I'll assume you are using an Arduino Uno. This can generate interrupt 0 on pin 2 and interrupt 1 on pin 3. I'll assume you are feeding the ignition pulse (cleaned up if necessary) to pin 2. Here is a sketch to calculate the rpm: const int ignitionPin = 2; const int ignitionInterrupt = 0; const unsigned int pulsesPerRev = 1;
unsigned long lastPulseTime = 0; unsigned long rpm = 0;
void ignitionIsr() { unsigned long now = micros(); unsigned long interval = now - lastPulseTime; if (interval > 2000) { rpm = 60000000UL/(interval * pulsesPerRev); lastPulseTime = now; } }
void setup() { pinMode(ignitionPin, INPUT); attachInterrupt(ignitionInterrupt, &ignitionIsr, RISING); }
void loop() { // insert code here to show the RPM on the display and delay for e.g. 0.2 seconds }
I've included some pulse cleanup in the software (i.e. ignore pulses that are less than 2ms apart).
|
|
|
|
« Last Edit: September 13, 2011, 02:09:14 pm by dc42 »
|
Logged
|
Formal verification of safety-critical software, software development, and electronic design and prototyping. http://www.eschertech.com
|
|
|
|
INDIA
Offline
Sr. Member
Karma: 0
Posts: 331
Arduino rocks
|
 |
« Reply #27 on: September 13, 2011, 10:08:05 pm » |
Thank you so much...  I have a Arduino duemilanove with the Atmega328.. Hope it will also able to take interrupts as the uno on the same pins.. as the uno also uses the 328...
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Offline
Brattain Member
Karma: 279
Posts: 15293
Measurement changes behavior
|
 |
« Reply #28 on: September 13, 2011, 10:25:39 pm » |
have a Arduino duemilanove with the Atmega328.. Hope it will also able to take interrupts as the uno on the same pins.. as the uno also uses the 328... As far as software code and hardware pin numbers there is no difference between Uno and your board. Only difference for Uno is smaller size bootloader that also uploads at a faster baudrate, everthing else is the same. Lefty
|
|
|
|
|
Logged
|
|
|
|
|
INDIA
Offline
Sr. Member
Karma: 0
Posts: 331
Arduino rocks
|
 |
« Reply #29 on: September 13, 2011, 11:04:36 pm » |
OK, I'll assume you are using an Arduino Uno. This can generate interrupt 0 on pin 2 and interrupt 1 on pin 3. I'll assume you are feeding the ignition pulse (cleaned up if necessary) to pin 2. Here is a sketch to calculate the rpm: const int ignitionPin = 2; const int ignitionInterrupt = 0; const unsigned int pulsesPerRev = 1;
unsigned long lastPulseTime = 0; unsigned long rpm = 0;
void ignitionIsr() { unsigned long now = micros(); unsigned long interval = now - lastPulseTime; if (interval > 2000) { rpm = 60000000UL/(interval * pulsesPerRev); lastPulseTime = now; } }
void setup() { pinMode(ignitionPin, INPUT); attachInterrupt(ignitionInterrupt, &ignitionIsr, RISING); }
void loop() { // insert code here to show the RPM on the display and delay for e.g. 0.2 seconds }
I've included some pulse cleanup in the software (i.e. ignore pulses that are less than 2ms apart). @ dc42 First tell me how do I setup my hardware portion of pulse input to the arduino board..?? I thought of using something like this http://www.sportdevices.com/rpm_readings/index.htmor tell me if there is any other way to pickup and feed the pulse which will just match your coding.. I went through your code, its just what I want to do, but couldnt plot out how to do it as I am not much advance in coding.. will you please make me understand this part... rpm = 60000000UL/(interval * pulsesPerRev); what is that 60000000UL...??
|
|
|
|
|
Logged
|
|
|
|
|
|