RE: Motor Bridge Cape and Stepper.py/MotorBridge.py

Hello,

I just made the stepper.py file at https://github.com/Seeed-Studio/MotorBridgeCapeforBBG_BBB/blob/master/tests/StepperMotortest.py work.

I am trying to understand the MotorBridge.py source more. So…

# init stepper motor A
def StepperMotorAInit(self):
    WriteByte(TB_1A_MODE, TB_SPM)   # Stepper
    time.sleep(DelayTime)
    WriteHalfWord(TB_1A_DUTY, 1000)    # Voltage
    time.sleep(DelayTime)
    
# MoveSteps > 0 CW 
# MoveSteps < 0 CCW
# StepDelayTime : delay time for every step. uint us
def StepperMotorAMove(self,MoveSteps,StepDelayTime):
    if MoveSteps > 0:
        WriteByte(TB_1A_DIR, TB_CW)   #CW
    else:
        WriteByte(TB_1A_DIR, TB_CCW)   #CW
        MoveSteps = -MoveSteps
    time.sleep(DelayTime)    
    WriteOneWord(TB_1A_SPM_SPEED, StepDelayTime)  # unit us
    time.sleep(DelayTime)
    WriteOneWord(TB_1A_SPM_STEP, MoveSteps)
    time.sleep(DelayTime)

Would this source create a background for forward and reverse steps on a stepper?

I cannot get the source to move my stepper on my small ball screw and slide. It makes noise and seems to spin but the noise and movement are not making the stepper move the slide on the ball screw.

Please see here:

def StepperMotorBTest():
print('Movement!')
motor.StepperMotorBInit()
motor.StepperMotorBMove(1000, 1000) # 1000 steppers  1000us every step
time.sleep(1)
motor.StepperMotorBMove(-1000, 1000) # 1000 steppers  1000us every step
time.sleep(1)


if __name__=="__main__":
    motor = MotorBridge.MotorBridgeCape()
    while True:
        # StepperMotorATest()
        StepperMotorBTest()

This source was typed up by Jiankai Li on the above link for the Motor Bridge Cape on github.com.

What exactly am I to expect on this source from the MotorBridge.py to Stepper.py? Is it supposed to move 1000 steps or move 1 step every 1 us?

Seth

Hello,

First off, sorry for the post. I should have checked the continuity of the coils on the stepper first. Oops.

Seth