Introduction: Arduino 6 Wire Stepper Motor Tutorial

Picture of Arduino 6 Wire Stepper Motor Tutorial

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.

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

Picture of 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.

Picture of 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

Picture of 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.

Comments

VladD26 (author)2017-04-23

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 ?

Mehadi_Saki (author)2017-03-01

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?

ElizandroG (author)2016-11-06

Is it allowed topost urls here? www.youtube.com testing.. :v

nitish.mano (author)2016-09-02

can i run six wire spteper motor without driver ic

nitish.mano (author)2016-09-02

thanks

diy_bloke (author)2015-06-24

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

seamster (author)2014-09-23

Nice!

About This Instructable

78,600views

55favorites

Bio: I am a full time software engineer and enjoy working on various projects in my spare time, especially Arduino, electronics, 3D printing and woodworking.
More by astrodan3:Arduino 6 wire Stepper Motor Tutorial how to make vermicompostArduino Infrared Remote tutorial
Add instructable to: