What is the Uno's maximum interupt speed? or max speed of encoder spin?

Hi Guys

Do you know how many interupts per millisecond an Arduino Uno can handle?

I am make a punching rig for my martial arts club. This current (flexible) plan is to mount a punching pad on the end of 500mm arm. Attached to the arms pivot rod will be a 2000p/r (according to data sheet) rotary encoder https://www.sparkfun.com/products/11102. I will do some maths on pulses over time to calculate peak speed and then G-Force.

My concern is this: if a fast & heavy strike will take 30ms to move the pad 45degrees (an approximate worst case senario for the arduino) that would deliver the ardiuno 8.3 (x 2 channels) interupts per millisecond.

Do you know if this is too much for the Uno to handle? If so would a bigger Arduino do a better job?

Thanks :)

Nick Gammon has a page for interrupts and speed, http://gammon.com.au/interrupts

The microcontroller on the Arduino board is capable to count pulses and determine pulse length without software interrupt.

All Arduino boards with AVR chips (a family of microcontrollers used in the Arduino boards) have the same timing. Only the Arduino Due uses a faster processor.

I did a bit more digging and found this:

"It is difficult for me to give you an exact number since it depends heavily on how much else is running on the controller. In my case I seem to get accurate counts up to about 4000 ticks per second. This is based on the controller program I use on my robot. It includes three PI loops, odometry calculations, and quite a bit of serial communication. I know this is not a very satisfying answer but it provides at least a ballpark number."

http://www.hessmer.org/blog/2011/01/30/quadrature-encoder-too-fast-for-arduino/

your last answer is a right one, it heavily depends.

Be sure to keep the ISR routine itself as small as possible, keep your math integer or long and only use float if you see no other option. Be aware that long has more digits than float. keep the number of division minimal as they are most expensive of the simple math functions

If you post your code we can help you to optimize it to meet the speed.

Do you want precise timing for the rotary encoder ? to calculate the speed ? The interrupt routine could place micros() timing in an array. http://arduino.cc/en/Reference/Micros And afterwards the timing can be used to calculate the speed.

Erdin: The interrupt routine could place micros() timing in an array. http://arduino.cc/en/Reference/Micros And afterwards the timing can be used to calculate the speed.

Yep I think that will be the way forward. fast to record to array so should be able to keep up easily.

Thanks your your responses everyone, I love this forum everyone is so helpful! :)

Hi, if you need the code for the ISR, thereĀ“s another thread running in sensors: http://arduino.cc/forum/index.php/topic,159187.0.html Best, Robert