How to use FreqCount Library for RPM reading

Hi!

I'm going to use the Arduino as a data logger.
I need to count RPM 2 stroke 2 cylinder engine (650-8500) each 100 ms.

The frequency range will be from 10.83 HZ to 141.6 HZ.

The question is If I will use FreqCounter library with 100 ms can I measure decimal point ?

How else I can measure RPM each 100 ms ? 10 RPM accuracy is not a problem

Thanks
Igor

Do you have an reference (URL) to the library?

In theory the Arduino running at 16 Mhz can easily count the pulses of a 200 Hz signal as it supports interrupts that can react instantly on sensor pulses. Better not use floating point numbers for this as these are (much) slower than longs.

if you count the pulses you can update the rpm on your display e.g. every second. This can be the pulses in the last second, or the pulses in the last minute or since start that is up to you.

A minimal primer on interrupts - http://arduino.cc/en/Reference/AttachInterrupt -

Thanks for reply

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

  2. What do mean display every second? This is the data logger....

  3. And Interrupts is what for ?

The problem I think that I can not measure 14.1 Hz in 100ms period ...

Probably use lm2917 freq to vol converter and measure using ADC ?

Sorry I forgot to mention that the project page

http://code.google.com/p/arduino-telematic-box/

Regards
Igor

each 100 ms....The frequency range will be from 10.83 HZ to 141.6 HZ.

Let's forget Arduino and any particular Arduino library for a minute.

If you want to use a simple frequency counter to measure frequency to the nearest tenth of a Hz, you will have to have a "gate" that is opened to the counter for ten seconds. Then the counter is reset, the "gate" is opened for ten seconds so that the counter can increment on each positive transition of the input signal and then the gate is closed. (You could use negative transitions instead of positive; the principle is the same).

Anyhow...
After you close the "gate," if you divide the count value by 10.0, giving a floating point result, you have the frequency to the nearest 0.1 Hz (plus or minus a least-significant bit).

If you want to measure the frequency approximately every 100 ms, the "gate" duration could be 100 ms (0.1 seconds), and the count value at the end of the gate time would be the frequency in tens of Hz. That is, you get the frequency in Hz by multiplying the count value by 10 (so the least significant decimal digit of the Hz value would always be zero). This, obviously wouldn't meet your requirements.

To measure low frequency signals every 100 ms with simple circuitry, you could measure the period between positive transitions, not the count value for a gate time of 100 ms.

Suppose we can measure the time between two positive transitions in microseconds. Then the frequency in Hz would be 1000000.0 / (period in microseconds)

Now, back to Arduino stuff...

Here's my take on it: The frequency counter library doesn't seem appropriate for measuring the frequency of a 10 Hz signal, accurate to the nearest tenth of a Hz every 100 ms. In fact, as far as direct measurement of frequency to the nearest tenth of a Hz with a gate time of 100 ms, well...I might be tempted to make a rare (for me) flat statement: No Way!

On the other hand it is definitely possible to measure, in microseconds, the time between two positive transitions of a signal. Whether you can make such measurements (with an Arduino) with sufficient accuracy over your desired range of frequencies is another thing. I haven't tried it, but maybe others can report on actual experience with accurately measuring periods of low frequency signals. Note that measuring the period might be very appropriate for frequencies of a few tens of Hz, but not necessarily for frequencies of a few hundreds of Hz (or more).

Consider the following:

The difference in periods between 10.1 Hz and 10.2 Hz is something around 9800 microseconds. In order to report frequencies this low to the nearest tenth of a Hz, you have to measure the period with an accuracy of something like plus or minus 4900 microseconds, and that's something that I think you could manage with an Arduino with no real problems. For that matter, if you can measure period plus or minus 50 microseconds, you can calculate the frequency of signals with frequencies near 10 Hz to the nearest hundredth of a Hz.

Next:
The difference in periods between 100.1 Hz and 100.2 Hz is something like 10 microseconds. It might take some work to satisfy yourself that you can measure the period with an accuracy of plus or minus five microseconds, but, maybe, just maybe, it's not impossible.

On the other hand...
The difference in periods between 1000.1 Hz and 1000.2 Hz is something like 0.1 microseconds, and I see no hope in measuring this directly in software.

Here's the bottom line as I see it:
Measuring the frequency (in software) directly to the nearest tenth of a Hz requires a gate time of 10 seconds, not 100 milliseconds.

Measuring the period (in software) in microseconds so that frequency can be calculated to the nearest tenth of a Hz doesn't seem practical for frequencies much higher than 100 Hz, but I won't rule it out as an absolute impossibility. (For 141 Hz, to get results plus or minus a tenth of a Hz, you would have to measure period plus or minus 2 microseconds. That's a real challenge, I'm thinking.)

Perhaps an "RPM Module" based on a 2907/2917 chip might be the way to go. I haven't used any such chips, so I don't know how easy it is to get accurate results. I mean, I would rather do things "all-digital" but...

Finally, note that:

"Real" frequency counters use combinations of hardware dividers and phase-lock loops and other hardware and/or software "tricks" to be able to display results for a wide range of frequencies of periodic signals.

Regards,

Dave

Thanks Dave!

I have no person that I can discuss this problems...

  1. I'm planning to use NXP LPC2478 processor for RPM counter. It has 32 bit timer and hardware allowed to fill up to 4 MHZ fill signal. So I can use 555 timer to form proper signal from Hall sensor. I can easy take care about 5 microsecond open gate ... But I come up the Arduino device and decided to switch to it . Many reasons for that .. free developer tools and a lot of sensors and shields...

I have short conversation with guy that deal with dynamometer and he measure RPM using extra Hall sensor for crankshaft teeth.

It has 32 Teeth ( I will measure tommorow), so I can get more accuracy measurement of RPM.

Some people advise me that I can measure acceleration and find out how cylinder 1 and cylinder 2 works using measure the period between teeth.

Finally I solved this, Library from the same person call FreqPeriod.
I can measure from 14.11 till 133.33 HZ without a problems!.

In my case. it will be from 850 till 8000 RPM Two stroke cylinder motor.