Go Down

Topic: Stepper motors and drivers problem (Read 3 times) previous topic - next topic

standby

Hello,
I have the following equipment:
1 x Arduino MEGA
3 x Wantai 57BYGH115-003 stepper motors
3 x Wantai DQ-542MA drivers
1 x Wantai PSU 350W 24V/14,4A

Could you give me a wiring/connection diagram for this equipment and tell me how many Volts/Amperes I need to run these motors?
I need the highest possible speed for the motors.
Is it also possible to give me  a simple Arduino code to run these 3 motors but in different speed each other??

I appreciate your help!

Thank you!!! ;)

Msquare

Try entering "57BYGH115-003 " in your google search. That usually gets you several web pages where the specfications (voltage, amperes etc ) are shown.

In your Arduino IDE try the menu File - Examples - Stepper - One revolution. There is the code fo one stepper. You only need to replicate the line defining the Stepper varaible (with a new name) and one call to each steper variable's move at different speeds. I also suggest you Google for "Arduino Stepper nonblocking " to run them simlultaneously.

Running at max speed depends on the load, and a bit of tweaking the (software) acceleration and driver current "curves" (if the DQ-542MA supports that)

standby

Thank you for your reply!

Basically this Driver is a Step/Dir type so I think the Stepper.h library that is used in these examples, don't support it, that's why I am asking for a simple code to run the motors in different speed each other.

The ports of the driver are: PUL+, PUL-, DIR+, DIR-, ENA+, ENA- so... Pulse or Step/Dir type, I think.

Msquare

OK, here is some very simple code I have recently used to drive two steppers at the same time. I do not use any library, prefering to drive them directly. One is a Dir/Step type driver, the other a full H-bridge. The idea here is the StepCoil runs continuously (the MoveSteppers() is called as often) determined by "Slowdown", and the StepWireRatio() calls the other stepper (the one using dir/step) so I get the right kind of diagonal movement.
Code: [Select]
void MoveSteppers() {
analogWrite(CoilPWM,45);
if ( micros()/100-Timer > Slowdown ) {
    Timer=micros()/100 ;
    StepCoil() ;
    StepWireRatio() ;
  }
}

void StepWireRatio() { // Step according to ratio and respect limits
  TFC_Ratio += TFC_Ratio_Nom ;
  if ( TFC_Ratio > TFC_Ratio_Den ) {
    TFC_Ratio -= TFC_Ratio_Den ;
    if (TFC<TFC_Left) TFC_Dir=HIGH ;
    if (TFC>TFC_Right) TFC_Dir=LOW ;
    StepWire() ;
  }
}

void StepWire() { //step always
  digitalWrite(WireDir,TFC_Dir); // adjust direction as needed
  delayMicroseconds(50);
  digitalWrite(WireStp,(TFC%2>0)?HIGH:LOW) ;  // Step the Wire motor
  TFC = (TFC_Dir==HIGH)?TFC+1:TFC-1 ;
  CursorGoto(3,12);
  if (TFC_Dir==HIGH)
    Serial.print(TFC-TFC_Left);
  else
    Serial.print(TFC_Right-TFC) ;
  Kolon();
  Serial.print((TFC-TFC_Left)*100/(TFC_Right-TFC_Left));
  Serial.print(TFC_Dir==LOW?" <":" >");Space(3);
}

void StepCoil() {
  // Change to next Coil state
  TurnState++ ; CursorGoto(2,13);
    Serial.print(TurnState/CoilTickTurn);
    Kolon();
    Serial.print((TurnState%CoilTickTurn)*100/CoilTickTurn);
    Space(2);
  switch (TurnState%4) {
    case 0:    // 1010
      digitalWrite(Coil_A, HIGH);
      digitalWrite(Coil_B, LOW);
      digitalWrite(Coil_C, HIGH);
      digitalWrite(Coil_D, LOW);
      break;
    case 1:    // 0110
      digitalWrite(Coil_A, LOW);
      digitalWrite(Coil_B, HIGH);
      digitalWrite(Coil_C, HIGH);
      digitalWrite(Coil_D, LOW);
      break;
    case 2:    //0101
      digitalWrite(Coil_A, LOW);
      digitalWrite(Coil_B, HIGH);
      digitalWrite(Coil_C, LOW);
      digitalWrite(Coil_D, HIGH);
      break;
    case 3:    //1001
      digitalWrite(Coil_A, HIGH);
      digitalWrite(Coil_B, LOW);
      digitalWrite(Coil_C, LOW);
      digitalWrite(Coil_D, HIGH);
    }
}

You Milage may vary. No Garantees :)

Carsten53T

hi Stanby
I've got some basic code that works on ports
EnA, EnB, I1, I2, I3, I4 (enable A & B are the two outputs/coils ..  1 & 2 for A and 3 & 4 for B (i1 high + i2 low is uppersit direction from i1 low + i2 high)
if you can make a link between these ports and the
PUL+, PUL-, DIR+, DIR-, ENA+, ENA- you've got, then I'll pop my code

Go Up