06-07-2013 09:22 AM
I'm having a problem controlling a stepper motor using an Arduino UNO rev3 and the official Arduino Motor Shield. When I open the stepper motor example, there are choices for which driver to use, easydriver, Adafruit, etc. Maybe this VI was written before Arduino made their own motor sheild? Anyway, the lights on the motor shield blink only on the A+A- ports and the B+B- maybe have the brakes on? And what results is the motor just vibrates. In the vi, its written to use pins 2,3 which I dont understand.
I did manage to control the motor with low level commands setting pins high and low for the coils and brakes alternating. But it would be nice I could get the example working. Maybe Adafruit motor shield is the same thing? or similiar to where I could just change pin numbers?
06-07-2013 01:25 PM
LIFA uses the Arduino Stepper Motor API, do you know of your shiled works with this API? That the first thing that I would check, write an Arduion program with that API (without LIFA) and make sure that that works first. Let us know the results with details.
06-07-2013 02:03 PM
Sorry, I'm not exactly sure what you mean but this works:
/*************************************************************
Motor Shield Stepper Demo
by Randy Sarafan
For more information see:
http://www.instructables.com/id/Arduino-Motor-Shield-Tutorial/
*************************************************************/
int delaylegnth = 30;
void setup() {
//establish motor direction toggle pins
pinMode(12, OUTPUT); //CH A -- HIGH = forwards and LOW = backwards???
pinMode(13, OUTPUT); //CH B -- HIGH = forwards and LOW = backwards???
//establish motor brake pins
pinMode(9, OUTPUT); //brake (disable) CH A
pinMode(8, OUTPUT); //brake (disable) CH B
}
void loop(){
digitalWrite(9, LOW); //ENABLE CH A
digitalWrite(8, HIGH); //DISABLE CH B
digitalWrite(12, HIGH); //Sets direction of CH A
analogWrite(3, 255); //Moves CH A
delay(delaylegnth);
digitalWrite(9, HIGH); //DISABLE CH A
digitalWrite(8, LOW); //ENABLE CH B
digitalWrite(13, LOW); //Sets direction of CH B
analogWrite(11, 255); //Moves CH B
delay(delaylegnth);
digitalWrite(9, LOW); //ENABLE CH A
digitalWrite(8, HIGH); //DISABLE CH B
digitalWrite(12, LOW); //Sets direction of CH A
analogWrite(3, 255); //Moves CH A
delay(delaylegnth);
digitalWrite(9, HIGH); //DISABLE CH A
digitalWrite(8, LOW); //ENABLE CH B
digitalWrite(13, HIGH); //Sets direction of CH B
analogWrite(11, 255); //Moves CH B
delay(delaylegnth);
}
06-07-2013 02:41 PM
Well, yeah that works because it was written specifically for that board. I'm asking if the Arduino Stepper Motor API (look at the include files that come with LIFA) works with the shield.
06-07-2013 04:06 PM
No they do not. I tried stepper_one_revolution and it was using pins 8,9,10,11. It vibrated and only lit up the B channel on the shield. I changed the pin numbers to 3,11,12,13 and all channel lights flickered, but still just vibrating.
SO its safe to say that LIFA will not work with this shield? Thats fine, like I said, I can still use the low-level commands.
03-17-2014 02:45 PM
Hi,
I'm having a similar problem to you and just wanted to ask how you go about editing low level commands. I dont have that much experience with LabVIEW unfortunately, so any help on this matter would be appreciated!
I'm using the same example VI as a starting point.
Thanks in advance!
03-22-2014 06:50 PM
There is an example for the Arduino Motor Shield in Documents. The title of the example is Arduino Motor Shield Demo.
hrh1818