simon.ganne
Posts: 4
Joined: Sun Sep 30, 2018 8:12 pm

stepper motors rattling

Tue Apr 16, 2019 2:25 pm

Hey everyone, I am controlling a nema 17 stepper driver with a TB67S109 thats a stepper driver similar to the A4988. To control the stepper driver I need to send pulses to the STEP pin. Then the motor should make one step per pulse. I can make my stepper turn beautifully with a delay of 0.000408 in between the pulses, but if I increase that delay to slow down my stepper motor, the motor starts to rattle and he does not move the way I wanted to. He skips steps etc.

Code: Select all

from time import sleep
import RPi.GPIO as GPIO

DIR = 35  # Direction GPIO Pin
STEP = 33  # Step GPIO Pin
EN = 31     # enable GPIO pin
power = 37  # power GPIO pin
MS3 = 29    #set_mode GPIO pin
CW = 1     # Clockwise Rotation
CCW = 0    # Counterclockwise Rotation
SPR = 200   # Steps per Revolution (360 / 7.5)

GPIO.setmode(GPIO.BOARD)
GPIO.setup(DIR, GPIO.OUT)
GPIO.setup(STEP, GPIO.OUT)
GPIO.setup(EN, GPIO.OUT)
GPIO.setup(power, GPIO.OUT)
GPIO.setup(MS3, GPIO.OUT)

GPIO.output(power, GPIO.HIGH)
GPIO.output(DIR, CCW)
GPIO.output(MS3, GPIO.HIGH)
GPIO.output(EN, GPIO.HIGH)



delay = .000408
sleep(0.0001)
for y in range(20000):
    for x in range(1, 200):
        GPIO.output(STEP, GPIO.HIGH)
        sleep(delay)
        GPIO.output(STEP, GPIO.LOW)
        sleep(delay)
    sleep(0)


GPIO.cleanup()
Image
Is there anyone who knows what my mistake/problem is?

Return to “Other projects”