Go Down

Topic: RC helicopter UAS (Read 8505 times) previous topic - next topic


Any reason you are doing it like that?

The code I gave you only uses a "timer" with millis(), you decide how often you want to get the rpm, and it then calculates how many revolutions it had, over how long time, and then returns rpm when you want to know it.

So no matter if it spins with 500 rpm or 3000 rpm, you will still get the reading at a constant rate.
captain-slow.dk | non contagious!


Mar 15, 2011, 11:43 pm Last Edit: Mar 15, 2011, 11:45 pm by zitron Reason: 1
I wonder if there's a better algorithm of measuring RPM. The two ways that are often used both have advantages and disadvantages:

1. Measuring how long it takes for N revolutions
- More accurate at lower RPM, but slower update as well
- Inconsistent update rate, could be a problem for your control system

2. Measuring the number of revolutions in N seconds
- Consistent update rate
- Less accurate at lower RPM
- Less RPM resolution if you want high update rate


in measuring a motorcycle engine speed i track the time for 10 rpm.  It does give variable update times - up to a second at low rpm but it's much more accurate than counting the pulses in (say)100ms.  I tried some variations on the theme like timing 5 interrupts at low speeds and 10 at higher, and counting the time for the 10 preceding pulses.  neither of these added any real value.


Mar 19, 2011, 10:32 pm Last Edit: Mar 19, 2011, 10:43 pm by davidbrowne Reason: 1
In my case, I am creating a controller to make a rotor turn at ~ 300rad/s which is approximately 50rev/s or 1 rev per 20ms.

For my control system it was desirable to have a high resolution reading, and a fast reading rate. Using an interval of one revolution I got a fast reading rate, but a low resolution. With a rolling average over 10 laps I got the same reading rate, but with a higher resolution.

The same reasoning applies to why I didn't use the fixed time interval; If I used a small time interval I would get a fast reading rate, low resolution. If I used a long time interval I would get a slow reading rate but high resolution.



LOL, watch those fingers !!!!


Go Up