Hi All
I have spent several days checking, but still have no joy on existing questions.
I am creating a backward/forward linear drive for a project, but I am having issues with the motor controller.
At the moment, I am using the code shown below, and this will move the head back and forth, but I would like to move this across to use the AccelStepper library to allow for high speed movement.
// Stepper MA860H Stepper Driver Connections
#define PULS_VCC_Pin 7 // Pin 7 connected to Driver PULS +5V
#define PULS_Pin 8 // Pin 8 connected to Driver PULS 1 input
#define DIR_VCC_Pin 9 // Pin 9 connected to Driver +5V - Steps pin motor driver LOW = FORWARD
#define DIR_Pin 10 // Pin 10 connected to Driver DIR - input
#define LED_Pin 13 // LED Pin
int Direction = 0;
int Count = 0;
int Travel = 1000;
int Speed = 1;
void setup()
{
pinMode(PULS_VCC_Pin, OUTPUT);
pinMode(PULS_Pin, OUTPUT);
pinMode(DIR_VCC_Pin, OUTPUT);
pinMode(DIR_Pin, OUTPUT);
pinMode(LED_Pin, OUTPUT);
Serial.begin(9600);
}
void loop()
{
if(Count!=Travel)
{
while(Count<Travel)
{
digitalWrite(LED_Pin, HIGH);
digitalWrite(PULS_VCC_Pin, HIGH);
digitalWrite(PULS_Pin, HIGH);
digitalWrite(DIR_VCC_Pin, LOW); // move forward
delay(Speed);
digitalWrite(PULS_Pin,LOW);
delay(Speed);
Count++;
}
}
else
{
while(Count>0)
{
digitalWrite(LED_Pin, HIGH);
digitalWrite(PULS_VCC_Pin, HIGH);
digitalWrite(PULS_Pin, HIGH);
digitalWrite(DIR_VCC_Pin, HIGH); //move backward
delay(Speed);
digitalWrite(PULS_Pin,LOW);
delay(Speed);
Count--;
//Serial.println("Direction = Backward");
//Serial.println(Count);
}
}
}
I currently have the MA860H connected as shown below:
MA860 Arduino
PULS+(+5V) Pin 7
PULS-(PUL) Pin 8
DIR+(+5V) Pin 9
DIR-(DIR) Pin 10
And according to the manual, the MA860 is set to CW/CCW Active High mode (All pins shorted together), even though it runs in different directions if I set Pin 9 High or Low.
If I try to run the driver using Pulse/Direction mode (J1 and J3 open), I get no movement when I pulse Pin 8 and Pin 10. When trying this, I re-wire this to
MA860 Arduino
PULS+(5V) 5V
PULS-(PUL) PIN 8
DIR+(5V) 5V
DIR- (DIR) PIN 10
So questions are:
Firstly- Looking at the connections, have I connected this correctly?
Secondly - Using the first wiring method, if I set up AccelStepper to use Pin 8 for step and Pin 9 for direction, I get no movement, is this set correctly?
Thirdly - How do I correctly set the microstep resolution for maximum speed?
Hopefully if I can get passed the basics, the rest may fall into place!
Thanks in advance
Lee