We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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?
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.