I'm using a DRV8825 mounted on an expansion board, wired as this example:
I'm using the same code as the above example.
Please note that the driver is missing in the foto, but I've mounted it and checked for correct orientation. I've set the Vref = 0.5v
(Max Curr/2) as specified for this stepper and driver.
I get no stepper movement ! Why ?
Appreciate your help.
The link to the stepper brings up the sales page, not a real datasheet.
My idea was to see which cable colours belong to which coil. I suspect the cables to the coils are connected wrongly to the driver.
Do like this:
1). Disconnect all 4 stepper wires from the driver. The motor can be turned easily by hand.
2). Connect 2 wires to each other. Turn the motor by hand. If it's heavy, Youhave found matching cables. If the motor turns easily, change one of the cables to one of the free cables. Turn the motor.
What is the voltage and current capability of the stepper power supply? For a DRV8825 the stepper motor power supply must be more than 8.2V, minimum.
The test code in the linked page may be pulsing too fast. Steppers can't go from zero to high speed all at once without acceleration. Try the following code and see if the stepper moves.
@Railroader Pls scroll down the Amazon page and you'll see the motor's specs. Yes you are right the cables were wrong ! The expander has a male attachments, so I took it for granted that they should match the stepper ones.
@groundFungus I power the DRV8825 with a bench top power supply but I had it set to 4.2v -wrong- I switched motor cables, increased the power to 9v and used your code, now the stepper moves. But only in one direction and not smooth. I guess I must use 1/2 or 1/4 stepping to get a smoother run.
Stepper motors don't ever run really smoothly like a DC motor. They step, always. Microstepping will make it smoother, of course. Microstepping will also mitigate the effects of resonance. I would recommend at least x4 microstepping.
The original code sets the steps to 10 per second so it will take 200 seconds (over 3 minutes) to go 2000 steps. Change both of the the
for (Index = 0; Index < 2000; Index++)
to
for (Index = 0; Index < 20; Index++)
and try it again. To go 20 steps takes only 2 seconds.
Can you please post a copy of YOUR circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, component names and pin labels.
Stepper specs:
OUYANG 17HS4023Rated voltage DC 4.1V
Rated current DC 1 A /phase
Holding torque ≥130 mN.m
Step angle 1.8°±0.09°
Moment of inertia 30.8 g.cm²
Phase (1KHz) 4.1x (1±20%) mH/phase
Maximum no-load operating frequency ≥2500PPS
Steering(shaft extended looking) A-AB-B-Clockwise
Wire colours on the Dupont connector of stepper are Red-Blue-Green-Black.
I have found that Red-Blue = coil1, Green-Black = coil2.
However this stepper can NOT be plugged into the expansion board because the male white plug on the expansion board is marked 2B-2A-1A-1B. I used jumper wires to connect the correct sequence.
The rest of the wiring is as the photo posted by TomGeorge.
As I mentioned before, the DRV8825 is missing in the photo but I have it plugged in with the correct orientation and have adjusted the current limit pot to =0.47v.
I'm using a 30v/10A bench top power supply set at 9v.
The stepper turns but it's not smooth. It's the first time I'm using this setup. In the past I used the cheap 28BYJ steppers with old ULN2003 drivers and had no smoothness issue.
I'll post a hand drawn set up as soon as I can.
The 28BYJ steppers are on the order of 2048 steps per revolution full step. The 17HS4023 motors are 200 steps per revolution full step (1.8 degree per step) so will seem a lot more "notchy". That is normal.