Slow rotation with 28BYJ-48 and ULN2003APG driver with Teensy 3.2

623 views
Skip to first unread message

Frank Paynter

unread,
Aug 26, 2017, 11:07:27 AM8/26/17
to accelstepper
Hi,

I have a cheap 28BYJ-48 and the companion ULN2003APG driver, connected to a Teensy 3.2 running at 72MHz.  However, I can't seem to get the stepper to rotate any faster than about 6 RPM (one rotation every 10 sec), pretty much regardless of my setup.  I know I must be doing something wrong, but I'll be darned if I can find it ;-).

Here's my code:

#include <AccelStepper.h>

AccelStepper stepper; // Defaults to AccelStepper::FULL4WIRE (4 pins) on 2, 3, 4, 5

void setup()
{
//stepper.setMaxSpeed(1000);
stepper.setMaxSpeed(10000);
//stepper.setSpeed(400);
stepper.setSpeed(8000);
stepper.setMinPulseWidth(20);
//stepper.setMinPulseWidth(200);
}

void loop()
{
stepper.runSpeed();
delay(5);
//delay(2);
//delay(50);
}


The commented-out values were tried one at a time to see if they made any difference.  The only one that did was the 'delay(2)', which froze the motor; everything else resulted in a smooth rotation at about 10sec/rev.  The specs for the 28BYJ-48 show about 510 steps/rev so 10sec/rev equates to about 50 steps/second - much slower than the advertised max of ~1000 steps/sec.

Any idea what I'm doing wrong here?

Frank

gregor christandl

unread,
Aug 26, 2017, 11:21:28 AM8/26/17
to accelstepper

The 28byj-48 are equipped with an internal reduction gear. If i remember correctly the gear ratios can range from 1/16 to 1/64, but the model designation does not contain information on the internal reduction gear ratio.


--
You received this message because you are subscribed to the Google Groups "accelstepper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelstepper...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Frank Paynter

unread,
Aug 26, 2017, 11:21:47 AM8/26/17
to accelstepper
Update:

When I run the same hardware setup with the example program shown at http://www.mallinson-electrical.com/5v-28byj-48-4-phase-stepper-motor-with-uln2003-driver-board.html, I get about twice the rotation rate.

Frank

gregor christandl

unread,
Aug 26, 2017, 11:28:18 AM8/26/17
to accelstepper

More info on gear ratios: https://grahamwideman.wikispaces.com/Motors-+28BYJ-48+Stepper+motor+notes
Don't put a delay in your loop() - it will ibterfere with AccelStepper. AccelStepper will only step when a step is due.
In my experience the 28byj-48 maxes out at about 100steps/second @ 5V.


Frank Paynter

unread,
Aug 26, 2017, 11:52:57 AM8/26/17
to accels...@googlegroups.com
All,

Removing the delay(5) (or even reducing it to delay(2)) causes the motor to hang.

Moved the experiment to a Uno with the Mallinson Electrical example sketch, and verified it still rotates twice as fast (5sec/rev) as with AccelStepper.  Then I moved the AccelStepper example to the Uno, and verified that it still runs twice as slow (10sec/rev).

Seems like the only difference between the two experiments is the AccelStepper library. Since the hardware is identical, either there is some problem with the AcellStepper library or I'm doing something wrong in this extremely simple program.  Any ideas?

Frank


To unsubscribe from this group and stop receiving emails from it, send an email to accelstepper+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "accelstepper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to accelstepper+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
G.Frank Paynter, PhD
OSU ESL Research Scientist (ret)
EM Workbench LLC
614 594-2078 (home office)
Reply all
Reply to author
Forward
0 new messages