You can read some more info on the cheap yet worthy 28BYJ-48 stepper motor here.
CheapStepper uses an 8 mini-step sequence to perform all moves
(a.k.a half-stepping): A-AB-B-BC-C-CD-D-DA
Depending on whom you ask, the 28BYJ-48 motor has an internal gear ratio of either:
- 64:1 (per manufacturer specs) or
- 63.68395:1 (measured... see this Arduino Forum topic for more info)
64:1 gear ratio * 64 steps (1 step = 8 mini-steps) per internal motor revolution =
4096 total mini-steps / revolution
or ~4076 (4075.7728) if the gear ratio is 63.68395:1
CheapStepper library defaults to 4096 mini-steps but you can call:
CheapStepper::set4076StepMode()
to use 4076 steps
or CheapStepper::setTotalSteps(int numSteps)
to use a custom amount
CheapStepper assumes a 5v power source for RPM calculations.
It's best to use an external power supply like this, wired directly to the ULN2003 driver board, rather than draw from the Arduino's onboard power, which may have insufficient amperage (>100mA needed).
The Arduino sketch "pauses" during move()
- move (boolean clockwise, int numSteps);
- moveTo (boolean clockwise, int toStep);
- moveDegrees (boolean clockwise, int degrees);
- moveToDegree (boolean clockwise, int toDegree);
The Arduino sketch will continue running during the move.
You must call run() on your stepper during loop()
- newMove (boolean clockwise, int numSteps);
- newMoveTo (boolean clockwise, int toStep);
- newMoveDegrees (boolean clockwise, int degrees);
- newMoveToDegree (boolean clockwise, int toDegree);
- must call run() during loop to continue move
- call stop() to cancel/end move
- step (boolean clockwise);
- or stepCW(); or stepCCW();
e.g.
- move 8 steps clockwise:
move (true, 8);
is the same as
moveCW (8);
- create new move of 90 degrees counter-clockwise
newMoveDegrees (false, 90);
is the same as
newMoveDegreesCCW (90);