# Bipolar stepper motor spins very slowly and makes a loud noise

I got a custom PCB. I am using DRV8428P driver (here is the datasheet) for a stepper motor. The problem I am facing is not being able to have the stepper rotate faster than 5 rpm. Also, the stepper makes a very loud noise.

Here is the schematic of my stepper controller:

Here are the specs of the stepper motor:

Here is how I wired up my stepper to the custom PCB:

My controller is Raspberry Pi Zero and I am using Python to drive the stepper:

import RPi.GPIO as GPIO
import time

delay = 0.0005 #time to settle

AIN1 = 21 # GPIO21
AIN2 = 26 # GPIO26
BIN1 = 20 # GPIO20
BIN2 = 8  # GPIO8

def setup():
GPIO.setmode(GPIO.BCM)
GPIO.setup(AIN1, GPIO.OUT, initial=GPIO.LOW)
GPIO.setup(AIN2, GPIO.OUT, initial=GPIO.LOW)
GPIO.setup(BIN1, GPIO.OUT, initial=GPIO.LOW)
GPIO.setup(BIN2, GPIO.OUT, initial=GPIO.LOW)

setup()

def setStep(w1, w2, w3, w4):
GPIO.output(AIN1, w1)
GPIO.output(AIN2, w2)
GPIO.output(BIN1, w3)
GPIO.output(BIN2, w4)
time.sleep(delay)

try:
while 1:
setStep(1,0,1,0)
setStep(0,1,1,0)
setStep(0,1,0,1)
setStep(1,0,0,1)
except KeyboardInterrupt:
pass
GPIO.cleanup()


When I decrease the delay value, the stepper mostly won't move but vibrates. The delay value that seems to work is 0.0005. However, the stepper makes a loud noise and barely rotates. I uploaded a short video of the stepper here: https://streamable.com/6kyayx.

I am not sure how get the stepper to spin as fast as 150 rpm as it is stated in the stepper's specs. I also have a hard time translating the hints to Python code, which are given in the steppers specs regarding high torque and initial phase setup.

Any ideas?

• Is this really a 5V motor, attempting to drive with 24V? Jan 19 at 13:21
• DVDD is 5v (measured it myself). Jan 19 at 13:50

500 Hz would correspond to 2 ms per step rather than 0.5 ms which is what your delay = 0.0005 is giving you.
• @mr-ma. Thanks for accepting my answer. Was 2 ms the solution? As TonyM pointed out, $t = \frac 1 f$ where $t$ is the periodic time and $f$ is the frequency. (Hertz means cycles per second, after all.) Jan 19 at 18:39