06-25-2018 11:21 AM - edited 06-25-2018 11:50 AM
I'm trying to use LabView 2018 to control a bipolar stepper motor. I have an arduino Mega 2560 and a motor shield from RobotDyn. Here is the link to the product. I was trying to manipulate the program called Arduino Stepper Motor that came with the Labview Interface for Arduino (LIFA) download. In that program there is only options for 2 wire (pulse and direction), 2 wire, 4 wire, EasyDriver, AF motor shield (Stepper 1 & 2 only). I have a different type of driver and have been selecting the AF motor shield (Stepper 1 & 2 only) option for now since its the most similar. My first concern is if the AF motor shield is connected in the same way or not and if not how can I change the underlying code in LabView to be able to manipulate the stepper motor. I was given a code to control my specific motor shield in the Arduino coding environment but I'm trying to use LabView in this case. Thank you for the help! Attached is the code for Arduino I was provided, and the original VI for Arduino Stepper Motor that I was trying to change.
int E1 = 10;
int in1 = 9;
int in2= 8;
int E2 = 11;
int in4 = 12;
int in3 =13;
void setup()
{
pinMode(E1, OUTPUT);
pinMode(E2, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
}
void loop()
{
motor_forward();
delay(3000);
motor_hardstop();
delay(500);
motor_reverse();
delay(3000);
motor_hardstop();
delay(500);
}
void motor_forward()
{
// motor 1
digitalWrite(E1,HIGH);
digitalWrite(in1,HIGH);
digitalWrite(in2,LOW);
// motor 2
digitalWrite(E2,HIGH);
digitalWrite(in3,LOW);
digitalWrite(in4,HIGH);
}
void motor_reverse()
{
// motor 1
digitalWrite(E1,HIGH);
digitalWrite(in1,LOW);
digitalWrite(in2,HIGH);
// motor 2
digitalWrite(E2,HIGH);
digitalWrite(in3,HIGH);
digitalWrite(in4,LOW);
}
void motor_stop()
{
digitalWrite(E1,LOW);
digitalWrite(E2,LOW);
}
void motor_hardstop()
{
digitalWrite(E1,HIGH);
digitalWrite(in1,HIGH);
digitalWrite(in2,HIGH);
digitalWrite(E2,HIGH);
digitalWrite(in3,HIGH);
digitalWrite(in4,HIGH);
}
06-26-2018 02:18 PM
Hey,
What happened when you selected the AF Motor Shield Setting? Are you controlling multiple motors? What type of motors?
From the link you provided, it seems that any two wire connection can work. Steppers main inputs they need are step and direction. But this would also depend on your type of stepper motor. Also, if you want to regulate the speed you may need the 4 wire connection to account for the PWM.
Thanks,
Brian J.
06-26-2018 02:21 PM
Check out some of the other forum posts involving this process as well. There are a few good ones I saw talking about a couple different motors!