2
\$\begingroup\$

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:

enter image description here

Here are the specs of the stepper motor:

enter image description here

enter image description here

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

enter image description here

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?

\$\endgroup\$
2
  • \$\begingroup\$ Is this really a 5V motor, attempting to drive with 24V? \$\endgroup\$
    – rdtsc
    Jan 19, 2022 at 13:21
  • \$\begingroup\$ DVDD is 5v (measured it myself). \$\endgroup\$
    – mr-ma
    Jan 19, 2022 at 13:50

1 Answer 1

5
\$\begingroup\$

Check with a multimeter that red-yellow is one coil and blue-orange is the other.

The chart shows that you've got to start the stepper at about 500 Hz and ramp up. Starting at too high a frequency will cause it to stall.

500 Hz would correspond to 2 ms per step rather than 0.5 ms which is what your delay = 0.0005 is giving you.

\$\endgroup\$
4
  • \$\begingroup\$ how did you convert 500 Hz to 2 ms delay in this case? Can you please share the formula? \$\endgroup\$
    – mr-ma
    Jan 19, 2022 at 12:40
  • \$\begingroup\$ @mr-ma, I imagine the formula was: freq period = 1/freq. You'll find that on about page 1 of many electronics books and you should take the time to learn such electronics basics if you hope to get your circuit working successfully. \$\endgroup\$
    – TonyM
    Jan 19, 2022 at 12:45
  • \$\begingroup\$ @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.) \$\endgroup\$
    – Transistor
    Jan 19, 2022 at 18:39
  • \$\begingroup\$ Does it work now? What was the solution? \$\endgroup\$ Jan 25, 2022 at 0:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.