Hello guys,
I'm using an incremental rotary encoder HN38-06-N you can find it's datasheet here (http://www.ekt2.com/pdf/96_ROTARY_ENCODER_HN38-06-N.pdf) it's 400 ppr etc...
So I'm using this encoder to control 3 servo motors depending on the encoder's angular position.
The encoder is attached to a shaft which is constantly rotating.
I'm using the arduino UNO ATMEGA328p.
In my code the number of pulses are transformed from 400 to 360 by mutilpying by a factor of 0.9, which gives me 360 degrees per rotation of shaft.
I noticed a a problem where the zero-position of the shaft is being shifted to another zero-position(the zero position of the shaft is unstable). What I'm guessing is that the encoder is too fast for the ATmega328p and that I might be missing some rising edges. What if I Use an arduino mega with ATmega2560 which has a bigger and faster processor. Will that do the trick?
You can find the code attached to this topic.
Thank you for taking your time to read my topic.
God bless
FSD13QBIM3QGLHR.ino (1.66 KB)