Arduino 6 Wire Stepper Motor Tutorial




About: I am a full time software engineer and enjoy working on various projects in my spare time, especially Arduino, electronics, 3D printing and woodworking.

Arduino Stepper Motor Tutorial

How to use an old six wire stepper motor and control it with an Arduino. This was an old stepper motor that I pulled out my junk pile, I'm not sure what it came from, I think it was an old printer from the 80s. In this tutorial I'll show you how we can figure out how to connect the stepper motor to an Arduino and control it using the Adafruit motor shield. The easiest way to do this is with a simple multimeter. If you don't have one, it's worth buying one as you can get one for just a few bucks nowadays, and even the cheapest one you can find is good enough for this sort of project.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Measure and Record the Resistance for All Six Wires

Most stepper motors come with four, six, or eight wires. This motor uses six wires. What we need to do is measure the resistance from one motor wire to another. This is because of the way stepper motors are made, stepper motors will have two coils and since this motor has six wires that means there are 3 wires per coil. Each of the two coils will have a common wire attached to the center of the coil, we don't want to use this wire. The way that we can determine which wire this is his by measuring resistance, and the resistance from one of the center wires to one of the other wires on the same coil will be smaller than the other pairs. If two wires are not on the same coil, you will measure an open circuit. Here are the resistances is that I measured

Step 2: Determine Which Wires to Ignore.

For this example that means we want to connect the orange and blue wires, and the white and red wires, we will ignore the gray wire and brown wire, because they have a smaller resistance. The Adafruit motor shield can run two stepper motors using four wires for each so we're going to connect white and red and orange and blue to stepper motor port to.

Step 3: Uploading the Sketch

The adafruit motor shield Has a library called AFmotor , which is a high level library running the motor shield, we will use this library.

Here's the code copied from the stepper motor example that is included with the AF motor library .

#include <AFMotor.h>

// Adafruit Motor shield library
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!

// Connect a stepper motor with 48 steps per revolution (7.5 degree)
// to motor port #2 (M3 and M4)
AF_Stepper motor(50, 2);

void <strong>setup</strong>() {
  <strong>Serial</strong>.begin(9600);           // set up Serial library at 9600 bps
  <strong>Serial</strong>.println("Stepper test!");

  motor.setSpeed(30);  // 10 rpm   

void <strong>loop</strong>() {
  <strong>Serial</strong>.println("Single coil steps");
  motor.step(50, FORWARD, SINGLE);
  motor.step(50, BACKWARD, SINGLE); 

Step 4: Running the Sketch

Here's a video of the sketch running I put a little piece of paper on the stepper motor just to observe how long it took to make a full rotation, the example code assume steps per rotation, but after tinkering with it for a while I believe this particular motor is not 48, but 50 steps per rotation. Here is another example application of a motor shield.

Be the First to Share


    • Assistive Tech Contest

      Assistive Tech Contest
    • Reuse Contest

      Reuse Contest
    • Made with Math Contest

      Made with Math Contest

    8 Discussions


    2 years ago

    When I measuring ohm any wire with red wire show half of resistance of any wire combination. But no open circuit show. have any problem in my motor?

    1 reply

    Reply 1 year ago

    it must be the center tap or the common wire.... the stepper motor you used must be having 5 wires and if it has 5 wires that means the red wire is the centre connected n common between coils


    2 years ago

    Thanks for this tutorial! Very helpful :D

    I have a question:

    How can i determine a starting position for a stepper motor ?

    I want to put my stepper indicator at 180 degrees trigonometrically and work from 180 to 0 (trigonometrically).

    Any ideas ?


    3 years ago

    Is it allowed topost urls here? testing.. :v


    3 years ago

    can i run six wire spteper motor without driver ic


    4 years ago on Introduction

    nice, basically what you did is to run a unipolar motor as a bipolar. But that is perfectly possible... as long as the motor has 2 common wires