I got a problem with controlling a bipolar stepper motor. It doesn't spin but vibrates.
Here is the schematic of my stepper driver:
DVDD supplies 5v DC.
Here is the wiring map from the motor's specification:
here are the motor and how I wired it up to my PCB:
There are some hints about acceleration and high torque in the specs as well.
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?
0.005#
.... always leave a large space between code and comment ... also makes code less cluttered and easier to read \$\endgroup\$step
anddirection
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\$