1
\$\begingroup\$

I got a problem with controlling a bipolar stepper motor. It doesn't spin but vibrates. Here is the schematic of my stepper driver: enter image description here DVDD supplies 5v DC.

Here is the wiring map from the motor's specification: enter image description here

here are the motor and how I wired it up to my PCB: enter image description here enter image description here

There are some hints about acceleration and high torque in the specs as well.

enter image description here Full disclosure: I am not sure what to do with this info, I am not an electrical engineer. Now, I have tried to write a simple python script to drive the stepper. However, all my best efforts ended up with the motor vibrating.

import RPi.GPIO as GPIO
import time
 
delay = 0.005# time to settle
 
drv_m1 = 8 #GPIO08
drv_step = 20 #GPIO20
drv_dir = 26 #GPIO26
drv_nfault = 21 #GPIO21
 
def setup():
   GPIO.setmode(GPIO.BCM)
   GPIO.setup(drv_m1, GPIO.OUT, initial=GPIO.LOW)
   GPIO.setup(drv_step, GPIO.OUT,initial=GPIO.LOW)
   GPIO.setup(drv_dir, GPIO.OUT, initial=GPIO.HIGH)
   GPIO.setup(drv_nfault, GPIO.OUT, initial=GPIO.HIGH)
 
 
setup()
 
try:
   while 1:
       GPIO.output(drv_step, 1)
       time.sleep(delay)
       GPIO.output(drv_step, 0)
       time.sleep(delay)
except KeyboardInterrupt:
   pass
GPIO.cleanup()

I have tried a varius delay values (between 0.0001 and 0.1) and tried out using PWM with frequencies as low as 100hz to 14000hz with no luck.

Any ideas what could be causing the problem here?

\$\endgroup\$
5
  • \$\begingroup\$ it could be the 0.005# .... always leave a large space between code and comment ... also makes code less cluttered and easier to read \$\endgroup\$
    – jsotola
    Jan 15, 2022 at 2:17
  • 2
    \$\begingroup\$ the schematic does not show a driver module that has step and direction inputs ... refer to the datasheet ... try bit-banging the outputs ... Ain1 HI / Ain2 LO / Bin1 LO / Bin2 LO ... Ain1 LO / Ain2 LO / Bin1 HI / Bin2 LO ... Ain1 LO / Ain2 HI / Bin1 LO / Bin2 LO ... etc etc \$\endgroup\$
    – jsotola
    Jan 15, 2022 at 2:26
  • \$\begingroup\$ Always start the acceleration from zero then experiment with max "a "or the ramp duration especially with the added torque load to start the pump. Once started, the acceleartion might be possible to increase to overcome the stiction. \$\endgroup\$ Jan 15, 2022 at 2:27
  • \$\begingroup\$ Start with a link to the specs on the board and all the microcode installed. \$\endgroup\$ Jan 15, 2022 at 3:06
  • \$\begingroup\$ DRV8428 stepper motor datasheets: (1) digchip.com/datasheets/parts/datasheet/2/477/DRV8428.php, (2) ti.com/lit/ds/symlink/… \$\endgroup\$
    – tlfong01
    Jan 15, 2022 at 3:34

1 Answer 1

1
\$\begingroup\$

You're using the wrong chip. The DRV8428P that you're using is not a stepper driver, it's just a dual H-bridge. Your code is therefore simply switching one of the stepper motor's coils on and off, making it vibrate.

You need an actual stepper motor driver that has "step" and "direction" input pins. Alternatively, you'll have to generate the waveforms for the stepper coils manually.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ Why does the board with no spec link have stepper motor on the silk screen? \$\endgroup\$ Jan 15, 2022 at 2:38
  • \$\begingroup\$ @TonyStewartEE75 It's most likely meant to be used as a H-bridge for driving a stepper motor with manually generated per-coil signals and not dir/step signals as the OP wants. Both the schematic and the picture of the board show that the DRV8428P is wired as a simple dual H-bridge. \$\endgroup\$ Jan 15, 2022 at 13:18

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.