Hi every one I have some trouble in my rotary encoder project
encoder is incremental type with A B phase 360 P/R
A phase Ext interrupt
B phase Ext interrupt
So I can judge it is CCW or CW (4 different state)
when the speed is low it seems OK , but when speed increase Arduino fail.
Interrupt to fast??
I have no ideal how to fix this.
MorganS
December 10, 2015, 4:07pm
2
"Fail"? What do you mean "fail"? You need to be more specific.
Many encoders are simple mechanical switches. They can have 'bounce' which means you need to apply debouncing. I recently had to add some 0.1uF capacitors to an encoder circuit to eliminate this problem.
when the speed is low it seems OK , but when speed increase Arduino fail.
First, answer MorganS's question "What do you mean fail"?
And then, I have some more:
Does 360P/R mean your total encoder count per revolution is 360 or is it 4x360 = 1440 when counting full quadrature.
At what rpm does it "fail"?
Do you have pullup resistors on the A/B lines?
If your encoder is truely running faster than the interrupts can handle, you can modify the algorithm to read less than full quadrature.
Robin2
December 10, 2015, 5:17pm
4
It seems to me that your title should say "Are Arduino interrupts too slow ?"
Post your code.
And please use the code button </> so your code looks like this and is easy to copy to a text editor
...R