Page 1 of 1

Rotary encoder, position change for 1 lap

Posted: Wed Aug 26, 2020 6:12 am
by YLM
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.

Re: Rotary encoder, position change for 1 lap

Posted: Wed Aug 26, 2020 8:08 am
by fraser
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.