Wednesday, June 05, 2013
PX245 / PK245 step motor jerking problem
So I am replacing the very slow 64 times geared down 28BYJ48 step motor by no gear PX245. But there is another problem - the motor is jerking a bit.
.END
def Test4StepMotors(stepSequence, stepAngle, stepTime, direction, degrees):
ftprint.PrintDoubleSpaceLine("*** Start testing stepping motor ***")
print "Step sequence = ", stepSequence
print "Step angle = ", stepAngle
print "Step time = ", stepTime
print "Direction = ", direction
print "Degrees = ", degrees
spiChannel = spidev.SpiDev()
spiChannel.open(0, 0)
stepCount = int(degrees / stepAngle)
if (direction == Clockwise):
for i in range(stepCount):
for stepPattern in stepSequence:
stepPattern1 = stepPattern
stepPattern2 = stepPattern << 4
stepPattern3 = stepPattern1 | stepPattern2
spiChannel.xfer2([stepPattern3, stepPattern3])
time.sleep(stepTime)
else:
for i in range(stepCount):
for stepPattern in reversed(stepSequence):
stepPattern1 = stepPattern
stepPattern2 = stepPattern << 4
stepPattern3 = stepPattern1 | stepPattern2
spiChannel.xfer2([stepPattern3, stepPattern3])
time.sleep(stepTime)
spiChannel.close()
ftprint.PrintDoubleSpaceLine("*** Stop testing stepping motor ***")
.END
No comments:
Post a Comment