

There are several AccelStepper examples included with the motor shield library.Now, I mentioned that stepper motors have a pre-defined number of steps per revolution (i.e. If you want to have more of a 'background task' stepper control, check out the AccelStepper library. The stepping commands are 'blocking' and will return once the steps have finished.īecause the stepping commands 'block' - you have to instruct the Stepper motors each time you want them to move. If you want to release all the coils, so that it can spin freely, call release() You can use whichever stepping method you want, changing it "on the fly" to as you may want minimum power, more torque, or more precision.īy default, the motor will 'hold' the position after its done stepping.

Theres tons of information about the pros and cons of these different stepping methods in the resources page. "Microstepping" is a method where the coils are PWM'd to create smooth motion between steps."Interleave" means that it alternates between single and double to get twice the resolution (but of course its half the speed)."Double" means 2 coils are activated at once (for higher torque).direction is either FORWARD or BACKWARD and the step type is SINGLE, DOUBLE, INTERLEAVE or MICROSTEP. #steps is how many steps you'd like it to take. Then every time you want the motor to move, call the step(#steps, direction, steptype)procedure. Running a stepper is a little more intricate than running a DC motor but its still very easy then coil 1 should connect to one motor port (say M1 or M3) and coil 2 should connect to the other motor port (M2 or M4).įor bipolar motors: its just like unipolar motors except theres no 5th wire to connect to ground. The center taps should both be connected together to the GND terminal on the motor shield output block.

Theres plenty of tutorials online on how to reverse engineer the coils pinout. If its a 5-wire motor then there will be 1 that is the center tap for both coils. The library works identically for bi-polar and uni-polar motorsīefore connecting a motor, be sure to check the motor specifications for compatibility with the shield.įor unipolar motors: to connect up the stepper, first figure out which pins connected to which coil, and which pins are the center taps. This motor shield supports up to 2 stepper motors.

Stepper motors are great for (semi-)precise control, perfect for many robot and CNC projects.
