Rotary encoder, position change for 1 lap

Supporting 2.6 and up
YLM
Phidgetsian
Posts: 10
Joined: Mon Nov 18, 2019 9:38 am
Contact:

Rotary encoder, position change for 1 lap

Postby YLM » Wed Aug 26, 2020 6:12 am

Hi,

I have got the rotary encoder 4mm shaft (3530) and got the sample code example for quadrature encoder.

Code: Select all

from Phidget22.Phidget import *
from Phidget22.Devices.Encoder import *
import time

def onPositionChange(self, positionChange, timeChange, indexTriggered):
   print("PositionChange: " + str(positionChange))
   print("TimeChange: " + str(timeChange))
   print("IndexTriggered: " + str(indexTriggered))
   print("----------")

def main():
   encoder0 = Encoder()

   encoder0.setOnPositionChangeHandler(onPositionChange)

   encoder0.openWaitForAttachment(5000)

   try:
      input("Press Enter to Stop\n")
   except (Exception, KeyboardInterrupt):
      pass

   encoder0.close()

main()


Now, I am trying to understand the number of position change for 1 lap of the encoder.

By making some tests, it looks like for positionChange, I got around 1800 for 1 lap of the encoder, but how can I know the exact number ?

Thank you.

fraser
Engineering
Posts: 280
Joined: Thu Nov 19, 2009 4:41 pm
Contact:

Re: Rotary encoder, position change for 1 lap

Postby fraser » Wed Aug 26, 2020 8:08 am

I would expect 1440, due to 1 lap = 360 CPR (from the spec table)
Since our encoder interfaces measure in pulses instead of counts (PPR = 4*CPR)
360 * 4 = 1440 PPR.


Return to “Linux”

Who is online

Users browsing this forum: No registered users and 2 guests