Stepper Motor Controller – Part 2

Share on facebook
Share on google
Share on twitter
Share on linkedin
A VPN is an essential component of IT security, whether you’re just starting a business or are already up and running. Most business interactions and transactions happen online and VPN

Continuing our saga from Part 1, We finished soldering up the controller shield with all the components. We have downloaded the library, and have connected the stepper motor. The motor has 4 wires, which we have attached to the M1/M2 connector. The wires connect top to bottom:

1. Orange
2. Yellow
3. N/C
4. Green
5. Brown

A 12v power supply connects to the motor external power connector. Make sure you do not enable the Arduino power jumper just to the right of the motor external power connector.

Video can be seen at

Discuss this project at


#include <AFMotor.h>

AF_Stepper motor(48, 1);

void setup() {

motor.setSpeed(10); // 10 rpm

motor.step(100, FORWARD, SINGLE);

void loop() {
motor.step(100, FORWARD, SINGLE);
motor.step(100, BACKWARD, SINGLE);

motor.step(100, FORWARD, DOUBLE);
motor.step(100, BACKWARD, DOUBLE);

motor.step(100, FORWARD, INTERLEAVE);
motor.step(100, BACKWARD, INTERLEAVE);

motor.step(100, FORWARD, MICROSTEP);
motor.step(100, BACKWARD, MICROSTEP);

Learn more by reading:
Arduino Internals, by Dale Wheat

Steve Spence

Steve Spence

Leave a Reply

Leave a Comment

Your email address will not be published. Required fields are marked *