Pages: [1]   Go Down
Author Topic: how to control a stepper with step and drivers  (Read 609 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 1
Posts: 342
UNO
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi all, i just have a new driver but this driver uses 3 pin command, so i cant find any reference yet, the pins are, STEP, DIR and ENABLE...


for now i just want and easy code just to guide me, if anyone can help me please
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8966
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You could use the third-party AccelStepper library:
http://www.open.com.au/mikem/arduino/AccelStepper/
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

0
Offline Offline
Sr. Member
****
Karma: 1
Posts: 342
UNO
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the matter its not the lib, its just that i dont know how to connect and run the driver using step and dir
Logged

South Texas
Offline Offline
Edison Member
*
Karma: 8
Posts: 1025
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Enable needs to be pulled either High  (5V) or Low(5V) to enable the device.
If DIR is low(0V) the motor will rotate 1 direction, if DIR is High(5V) it will rotate the other direction.
Every time STEP goes from either High(5V) to Low (0), or Low(0v) to High(5v) (It will be one combination or the other, but not both. the motor will move 1 step.

The reason I am a little vague here is that I don't know wheter the Enable is active High or active low. Active Low is generally a safe bet for Enable and STEP. If you have the controller connected to the motor and power it up, when the motor is anabled it will be much harder to turn by hand as the coils are then energized.
Logged

0
Offline Offline
Sr. Member
****
Karma: 1
Posts: 342
UNO
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

the Enable its active low
Logged

South Texas
Offline Offline
Edison Member
*
Karma: 8
Posts: 1025
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If the enable is active low then I would assume that step is also an active low signal. To make 1 step you take the STEP pin to 0v and then return it to 5v. Every time that cycle is repeated the motor will take 1 step.

DIR will be either 5V or 0V depending on direction.
Logged

0
Offline Offline
Sr. Member
****
Karma: 1
Posts: 342
UNO
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

im using this code but the stepper doesnt move

Code:
#define MI_PIN_STEP 8
#define MI_PIN_DIR 9
#define MI_PIN_EN      10

void setup()
{
  //Wire.begin ();
  Serial.begin ( 57600 );
 
  pinMode ( MI_PIN_STEP, OUTPUT );
  pinMode ( MI_PIN_DIR, OUTPUT );
  pinMode ( MI_PIN_EN, OUTPUT );

  digitalWrite ( MI_PIN_EN, HIGH );
}

void loop()
{
  digitalWrite ( MI_PIN_EN, LOW );
 
  digitalWrite ( MI_PIN_DIR, HIGH );
  //digitalWrite ( MI_PIN_DIR, LOW );
 
  // Step
  digitalWrite ( MI_PIN_STEP, LOW );
  delay ( 100 );
  digitalWrite ( MI_PIN_STEP, HIGH );

  delay ( 200 );
}
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 212
Posts: 8966
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Perhaps you are wrong and the ENABLE is not active-low.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pages: [1]   Go Up
Jump to: