I have a 24v servo motor coupled to a 2,000 segment optical encoder that runs on 5v.

That's 2,000 "ticks" per revolution at it's base resolution. (Full quad reading allows 8,000 ticks per revolution, which I have no idea how a person could really USE! Egads that's tiny slices of a circle.)

It ALSO has a 'full-circle' index, a "Z" line.

That Z SEEMS to be coincident with A. Meaning that the clear slot in the rotor seems to be in the same place for both ONE of the A ticks and the only Z tick. I do not have an oscilliscope to verify this, but timestamping two different interrupts makes it seem like they do line up (one on A one on Z).

The motor runs at max 1075 RPM. So if I did the maths correctly that means there are 2,150,000 ticks per minute on the A/B lines plus 1075 ticks per minute on the Z line.

35,833.33-ish ticks per second on the A line.

17.9166-ish ticks per second on the Z line.

I have used sample code from a number of sources on both a Nano v3 and an Uno r3. I can't get counting to be accurate on either device, both lose ticks counting the A trigger and the coincidence of the A and Z ticks makes the interrupts 'stack' (both trigger almost instantaneously, but whichever was first gets processed and THEN the other gets processed...)

I do know that I can get IC's that will count for me, but there are MANY models and I do not have the ability to determine which would suit this situation the best.

Despite reading a great number of posts about encoders and the Arduino code to read them I still don't understand if the Nano or Uno COULD do this on their own at this speed.


  1. Accurately track all 2000 pulses per revolution at 1075 RPM.
  2. Accurately track FULL rotation pulses at 1075 RPM.
  3. Use full rotations as error-checking against the 2000 count.
  4. Provide error-checked count as an absolute count to external device.
  5. Provide resettable zero-point to external device (remotely reset the count).

So please, if you would, inform me about or direct me to proven methods and resources for achieving the above goals?

  • 1
    Do you have to track rotation in both directions? Sep 4, 2019 at 7:21
  • 1
    Yes. Intended use is in small CNC machine.
    – 111936
    Sep 4, 2019 at 9:23
  • For this you would typically pick a microcontroller that has a quadrature encoder interface in it. You could count the pulses with a timer, but you wouldn't get direction information with that.
    – Majenko
    Sep 4, 2019 at 13:21


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.