Code for Bipolar 4 wire stepper?

I have a Uno with a http://www.seeedstudio.com/wiki/Motor_Shield_V1.0 Seeedstudio motor shield v1.2 [/url]and I'm trying to drive a STP-58D111 bipolar 4 wire stepper motor. I've found the 2 lead wires for each coil but I either don't have good code or I'm not connecting it properly. Can anyone help me with this? I'm not putting any load on the motor and when I connect just 1 coil it will jump but doesn't rotate. When I connect the 2nd set of lead wires it seems to lockup the motor and messes up the stepping on the motor shield.

Please help.

  1. pls show us your wiring
  2. show us your code in </>

You may find something useful in Stepper Motor Basics

Post a link to the datasheet for your motor.
Give details (volts and amps) for your motor power supply.

An L298 is a poor choice for driving a stepper motor.

...R
PS. your link does not work - it may have got mangled by the Forum software. If you use the View Source button (the one on the right) you may be able to fix it.

What winding resistance is your motor? If its less than 20ish ohms it is not really suitable for
any DC motor driver, it needs a stepper driver (steppers are current-driven, so a chopper driver is used).

Wow Thanks guys for all your info.

I think MarkT answered the question to my problem by stating the winding resistance should be more than 20 ohms or it’s not suitable for the motor driver I’m using. Because the resistance on the windings is 000.8 ohms way less than 20ohms.

I think this makes the other questions a moot point but I’ll address them since you went to the trouble to respond.

http://www.shinano.com/motors/docs/SKC_Full-line_Catalog.pdf

http://www.shinano.com/motors/docs/SKC_stepper_operation.pdf

Sorry Robin I don't have a datasheet for the motor the links provided above are the closest thing I could find.
I have 2 of these motors and they are both from old Zebra thermal printers. They look identical and the STP-57D114 had these specs on the back. 1.8 Deg/Step 1.4v 2.3A

I'm powering the shield with a 12v 800mA adapter. Let me know if you think I should be using one with at least 2 amps.

Here is the link from the original post for the motor shield.
http://www.seeedstudio.com/wiki/Motor_Shield_V1.0

Thanks again for your help.

rpt007:

  1. pls show us your wiring
  2. show us your code in </>

Hi rpt007

To answer your questions. I’ve connected the motor in every possible combination so I’m not sure which one to show.
Here are some links to the example codes I’ve used. I modified the code for my shield on the instructables link. So I just changed the const int to fit my needs.

http://www.seeedstudio.com/wiki/Motor_Shield_V1.0

rmhoutz:
They look identical and the STP-57D114 had these specs on the back. 1.8 Deg/Step 1.4v 2.3A

I'm powering the shield with a 12v 800mA adapter. Let me know if you think I should be using one with at least 2 amps.

Here is the link from the original post for the motor shield.
http://www.seeedstudio.com/wiki/Motor_Shield_V1.0

For a low impedance motor you definitely need a specialized stepper driver. Unfortunately the usual hobby drivers such as the Pololu DRV8825 cannot provide 2.3 amps and drivers that can provide 3 amps (or more) are considerably more expensive.

1.4v and 2.3A amounts to 3.22 watts and 12v at 0.8 amps amounts to 9.6 watts so should be enough - with a large capacitor and a specialized driver.

...R

Good to know.

Thanks Robin2 for all your help.

I realize this is almost a year late but I wanted to provide an update so anyone else trying to drive a 4 wire stepper like the ones found in old Zebra label printers will know how it can be done.
I’ve successfully driven this motor (STP-58D111) using the SparkFun Big Easy Driver and their example code found here. Big Easy Driver Hookup Guide - learn.sparkfun.com

/****************************************************************************** 
SparkFun Big Easy Driver Basic Demo
Toni Klopfenstein @ SparkFun Electronics
February 2015
https://github.com/sparkfun/Big_Easy_Driver

Simple demo sketch to demonstrate how 5 digital pins can drive a bipolar stepper motor,
using the Big Easy Driver (https://www.sparkfun.com/products/12859). Also shows the ability to change
microstep size, and direction of motor movement.

Development environment specifics:
Written in Arduino 1.6.0

This code is beerware; if you see me (or any other SparkFun employee) at the local, and you've found our code helpful, please buy us a round!
Distributed as-is; no warranty is given.

Example based off of demos by Brian Schmalz (designer of the Big Easy Driver).
http://www.schmalzhaus.com/EasyDriver/Examples/EasyDriverExamples.html
******************************************************************************/
//Declare pin functions on Arduino
#define stp 2
#define dir 3
#define MS1 4
#define MS2 5
#define MS3 6
#define EN  7

//Declare variables for functions
char user_input;
int x;
int y;
int state;

void setup() {
  pinMode(stp, OUTPUT);
  pinMode(dir, OUTPUT);
  pinMode(MS1, OUTPUT);
  pinMode(MS2, OUTPUT);
  pinMode(MS3, OUTPUT);
  pinMode(EN, OUTPUT);
  resetBEDPins(); //Set step, direction, microstep and enable pins to default states
  Serial.begin(9600); //Open Serial connection for debugging
  Serial.println("Begin motor control");
  Serial.println();
  //Print function list for user selection
  Serial.println("Enter number for control option:");
  Serial.println("1. Turn at default microstep mode.");
  Serial.println("2. Reverse direction at default microstep mode.");
  Serial.println("3. Turn at 1/16th microstep mode.");
  Serial.println("4. Step forward and reverse directions.");
  Serial.println();
}

//Main loop
void loop() {
  while(Serial.available()){
      user_input = Serial.read(); //Read user input and trigger appropriate function
      digitalWrite(EN, LOW); //Pull enable pin low to set FETs active and allow motor control
      if (user_input =='1')
      {
         StepForwardDefault();
      }
      else if(user_input =='2')
      {
        ReverseStepDefault();
      }
      else if(user_input =='3')
      {
        SmallStepMode();
      }
      else if(user_input =='4')
      {
        ForwardBackwardStep();
      }
      else
      {
        Serial.println("Invalid option entered.");
      }
      resetBEDPins();
  }
}

//Reset Big Easy Driver pins to default states
void resetBEDPins()
{
  digitalWrite(stp, LOW);
  digitalWrite(dir, LOW);
  digitalWrite(MS1, LOW);
  digitalWrite(MS2, LOW);
  digitalWrite(MS3, LOW);
  digitalWrite(EN, HIGH);
}

//Default microstep mode function
void StepForwardDefault()
{
  Serial.println("Moving forward at default step mode.");
  digitalWrite(dir, LOW); //Pull direction pin low to move "forward"
  for(x= 1; x<1000; x++)  //Loop the forward stepping enough times for motion to be visible
  {
    digitalWrite(stp,HIGH); //Trigger one step forward
    delay(1);
    digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
    delay(1);
  }
  Serial.println("Enter new option");
  Serial.println();
}

//Reverse default microstep mode function
void ReverseStepDefault()
{
  Serial.println("Moving in reverse at default step mode.");
  digitalWrite(dir, HIGH); //Pull direction pin high to move in "reverse"
  for(x= 1; x<1000; x++)  //Loop the stepping enough times for motion to be visible
  {
    digitalWrite(stp,HIGH); //Trigger one step
    delay(1);
    digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
    delay(1);
  }
  Serial.println("Enter new option");
  Serial.println();
}

// 1/16th microstep foward mode function
void SmallStepMode()
{
  Serial.println("Stepping at 1/16th microstep mode.");
  digitalWrite(dir, LOW); //Pull direction pin low to move "forward"
  digitalWrite(MS1, HIGH); //Pull MS1,MS2, and MS3 high to set logic to 1/16th microstep resolution
  digitalWrite(MS2, HIGH);
  digitalWrite(MS3, HIGH);
  for(x= 1; x<1000; x++)  //Loop the forward stepping enough times for motion to be visible
  {
    digitalWrite(stp,HIGH); //Trigger one step forward
    delay(1);
    digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
    delay(1);
  }
  Serial.println("Enter new option");
  Serial.println();
}

//Forward/reverse stepping function
void ForwardBackwardStep()
{
  Serial.println("Alternate between stepping forward and reverse.");
  for(x= 1; x<5; x++)  //Loop the forward stepping enough times for motion to be visible
  {
    //Read direction pin state and change it
    state=digitalRead(dir);
    if(state == HIGH)
    {
      digitalWrite(dir, LOW);
    }
    else if(state ==LOW)
    {
      digitalWrite(dir,HIGH);
    }
    
    for(y=1; y<1000; y++)
    {
      digitalWrite(stp,HIGH); //Trigger one step
      delay(1);
      digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
      delay(1);
    }
  }
  Serial.println("Enter new option");
  Serial.println();
}