I am trying to use an Arduino Uno R3 as a tachometer (It is going to measure the RPM of my motorcycle). Basically it only has to count how many times an input pin goes HIGH in one second. The problem is pulseIn is too slow for it... The pin will be on for up to 230 times/ second (14.000 RPM). So that would be 1000/230 (approx. 4 ms per rotation, i believe). What is the easiest way to do the job? I can't figure any solution yet...


2 Answers 2


Similar to this response, I would suggest using an interrupt, but also start a timer, and then capture the time elapsed on the next interrupt.

Alternatively you could start a timer on a interrupt, and count the number of rising edges in for the duration of the timer. So of the timer was set to 1 sec, and there was x rising edges, the RPM can be now calculated.

In the automotive's are magnet and hall effect sensor is used to calculate RPM.

Good luck.


I'd comment instead, but I don't have the rep so I'll have to answer.

By attaching an interrupt to the rising edge of your signal you can increment a counter. You read the counter every X milliseconds and calculate the rpm from that. Of course, the counter needs to be reset each time it is read.

Alternatively, there's a frequency meter example here that looks promising (Arduino Zero only).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.