This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Measuring RPM by signal width

Hello,
I want to measure RPM not my counting pulses every, say, second, but by the width of the pulses that are generated at the space between them (for better resolution). I expect 6 pulses per revolution. Can you offer a way to do it?

  • i be thinked you neet the timer... starting teh timer you be see pusling started and stoped due by puulsated edge.... why you be having the timier number and mathematacs make the rpm rev number.

  • You did not show a device type so any info that you receive is trash. Here is my trash. Use a counter capture register.
    Bradford

  • Cactus,
    You can measure your RPM by using a 16 bit timer that generates an interrupt every period.
    its prescalar will determine the minimum speed you can measure (if your timer overflows every 500 milliseconds, then in order to have a reliable reading you must have an edge every 500 milliseconds or 120 RPM. if it overflows every 131 milliseconds, you can measure minimum about 500 RPM)
    the maximum speed (RPM) that can be measure with such a timer is 500000 * 60 = 30000000 RPM (if your timer
    has a resolution of 2 microseconds, then the timer will count to 500000 within one seconds).
    the actual RPM will be 30000000/(actual timer count). the actual time count can be calculated in your ISR
    and is the delta between the last 2 measurements (falling edges). if you add more "target" to invoke more transition per revolution, the RPM will stay the same as both the theoretical maximum and the actual count will be multiplied, but the resolution will increase - namely, you would need at least one edge per 500 milliseconds/the number of targets.

  • Hello,

    There are 2 distinctive methods of measuring timing characteristics like RPM:

    a) Frequency measurement
    b) Period measurement

    Both are covered in any classical book on instrumentation, e.g., K.B.Klaasen's "Electronic measurement and instrumentation":
    www.amazon.com/.../0521477298,
    the book is also available at books.google.com

    What you are indending to do, is performing type #2 of measurements, namely measurement of a period of a signal. You need so called "filling-in frequency" source (a reference pulse train) which can be e.g., a) n-bit timer with resolution enough to fit technical requirements you have for precision, b) an external counter mapped to MCU's I/O, with integrated logic and reference frequency.

    In terms of implementation Tamir gave a good start point. I would add, you may want to use the free-run timer mechanism with no real timer interrupts involved. The only interrupts could be from the signal in interest - you may want either to capture current timer content, or use timer capture mechanism suggested by Al. It is especially beneficial if the timer's discretization is high enough. In implementation, pay attention that the arithmetic should involve a timer overflow/underflow control mechanism since for the low-frequency signals it is normal that the timer may get overflown/underflown.

    Your measurement interval may be incommensurable if compared against arbitrary wide pulse, long enough to not fit the expected range...

    There are extentions of the period measurements at the top of proposed skeleton: e.g., a) to get a smooth output, use e.g., moving average filter; b) to measure a transient process, you have to avoid skipping any adjacent intervals - so the f/w would keep a track of history - a context associated with when signal fronts come relative to timer events and closings of measurement intervals, etc.

    It is good idea to use 2-threshold discriminator for the input signal (cleans the noise effectively) + ensuring the signal is free of glitches.

    Regards,
    Nikolay.