Hi
I use the code for rotary encoder from you tube and I send in the attachment. The connection of the rotary encoder with the arduino is also in the attachment. When I have small speeds of the rotary encoder arduino is reading full resolution but when I turn the shaft of the rotary encoder little bit faster arduino is missing pulses. In the datasheet of rotary encoder is write speed 2000 rev/min.For capacitor in the connection I use 100 nF. What could be the problem?
Regards
Riste
Shuffling between RISING and FALLING interrupt triggers is not the way to do this. Use CHANGE, read the state of the interrupt pin in the ISR to see whether it is high (interrupt triggered by rise) or low(interrupt triggered by fall) and proceed with your routine based on what occurred.
... but your circuit shows 10 nF. So the signal has 10x higher filtering. If the encoder's output can switch 5mA, then you could replace the pullup resistors with 1K, if you don't have the smaller capacitors available.
Note the time constant you now have for filtering is 1ms. The circuit shown would result in 0.1ms time constant.