blapcb
Full Member level 3
- Joined
- Jan 7, 2007
- Messages
- 188
- Helped
- 2
- Reputation
- 4
- Reaction score
- 0
- Trophy points
- 1,296
- Location
- Planet earth (most of the time)
- Activity points
- 2,766
calculate rpm from pulse
I am designing a box that is supposed to calculate vehicle speed (from a hell effect sensor, 4 pulses per revolution) and RPM (from tach input). Both are square waves with max frequency of 300Hz or so (in reality much less).
I am wondering what the best way to get the values is (for RPM and speed): to count the pulses or to measure the pulse width. I guess both can be done, but I am wondering what is a more proper/elegant method and also which one would require the least amount of resources from the microcontroller.
One important input is that I would like to know these values at a rate of say 100ms to 1sec (variable).
Perhaps this itself would preclude the counting idea?
Then again, actually if the idea is to measure the pulse width (and derive the values using a formula), would you not need to "count" anyway to measure the pulse width? (i.e. with the internal timer, which I presume should be there).
Hope the question is clear, sorry I am slightly new to this. Thanks for your inputs and ideas.
My the way my micro is running at 6MHz.
I am designing a box that is supposed to calculate vehicle speed (from a hell effect sensor, 4 pulses per revolution) and RPM (from tach input). Both are square waves with max frequency of 300Hz or so (in reality much less).
I am wondering what the best way to get the values is (for RPM and speed): to count the pulses or to measure the pulse width. I guess both can be done, but I am wondering what is a more proper/elegant method and also which one would require the least amount of resources from the microcontroller.
One important input is that I would like to know these values at a rate of say 100ms to 1sec (variable).
Perhaps this itself would preclude the counting idea?
Then again, actually if the idea is to measure the pulse width (and derive the values using a formula), would you not need to "count" anyway to measure the pulse width? (i.e. with the internal timer, which I presume should be there).
Hope the question is clear, sorry I am slightly new to this. Thanks for your inputs and ideas.
My the way my micro is running at 6MHz.