SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By jkimman
#192173
Hi everyone,

I have a 6 wired stepper motor driven by a Big Easy driver, which I connected according to the hookup guide on the sparkfun website. The stepper is rated at max 0,7A Bipolar and 48V.
It is connected to an Ardruino Uno and powered by an 12V 1,4A DC power supply.
I tried running the code from the hookup guide before I altered the code. (which worked)
But after running the new code for a few times (about 20x), the led from the BED turned off and it doesn't work anymore.
I tried the steps from this post, but it didn't work. https://forum.sparkfun.com/viewtopic.ph ... driver+led

Do I have to get a new BED or is it solvable?

The code I used was:
Code: Select all
//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. Step stop interval at 1/4th microstep mode.");
  Serial.println("2. Turn at 1/4th microstep mode.");
  Serial.println("3. Turn short at 1/4th microstep mode.");
  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')
      {
        ForwardIntervalStep();
      }
        else if(user_input =='2')
      {
        SmallStepMode();
      }
          else if(user_input =='3')
      {
        SmallShortStepMode();
      }  
      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);
}

//1/4th microstep forward interval mode function
void ForwardIntervalStep()
{
  Serial.println("Alternate between stepping and stopping.");
  digitalWrite(dir, LOW);  //Pull direction pin low to move "forward"
  digitalWrite(MS1, HIGH);  //Pull MS1,MS3 low and MS2 high to set logic to 1/4th microstep resolution
  digitalWrite(MS2, LOW); //Pull MS1 high and MS2,MS3 low to set logic to 1/2 microstep resolution
  digitalWrite(MS3, LOW);  //Pull MS1,MS2 and MS3 low to set logic to full microstep resolution
  for(x= 1; x<6; x++)      //Number of cycles turns and stops
  {
   {
    for(y=1; y<450; y++) //Number of steps per movement
    {
      digitalWrite(stp,HIGH); //Trigger one step
      delay(2);
      digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
      delay(2);
    }
    delay(1000); //Time of the stop between two movements
   }
  }
  Serial.println("Enter new option");
  Serial.println();
}

// 1/4th microstep foward mode function
void SmallStepMode()
{
  Serial.println("Stepping at 1/4th microstep mode.");
  digitalWrite(dir, LOW);  //Pull direction pin low to move "forward"
  digitalWrite(MS1, HIGH);  //Pull MS1,MS3 low and MS2 high to set logic to 1/4th microstep resolution
  digitalWrite(MS2, HIGH); //Pull MS1 high and MS2,MS3 low to set logic to 1/2 microstep resolution
  digitalWrite(MS3, LOW);  //Pull MS1,MS2 and MS3 low to set logic to full microstep resolution
  for(x= 1; x<3530; 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();
}

// 1/4th microstep foward mode function
void SmallShortStepMode()
{
  Serial.println("Stepping short at 1/4th microstep mode.");
  digitalWrite(dir, LOW);  //Pull direction pin low to move "forward"
  digitalWrite(MS1, HIGH);  //Pull MS1,MS3 low and MS2 high to set logic to 1/4th microstep resolution
  digitalWrite(MS2, HIGH); //Pull MS1 high and MS2,MS3 low to set logic to 1/2 microstep resolution
  digitalWrite(MS3, LOW);  //Pull MS1,MS2 and MS3 low to set logic to full microstep resolution
  for(x= 1; x<1760; 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();
}
Hookup:
https://cdn.sparkfun.com/assets/learn_t ... pFixed.jpg