LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with Arduino/Labview stepper motor loop

Disclaimer:  I am just starting out with Labview and Arduino.  I am a mechanical engineer with robotic programming skills, but this is my first Labview/Arduino project.

I am using a NEMA 34 stepper motor, a 3.5A microstepping driver and a 24V power supply.  Ths setup works perfectly with I run it using the Stepper Motor Example that came with LIFA.

The point of this project is to turn a stepper motor a specified number of revolutions (say for example 1000 rev = 800,000 steps), record the voltage of an analog input (append to array) once the steps have been reached, and continue the test by rotating again and collecting voltage until the total number of revs is reached.

I have attached a VI that is supposed to do the following:

1. Initiate connection to Arduino

2. Enter a while loop with a cancel buttom to terminate the loop

3. Enter a case when Start button is pressed

4. Enter a for loop with the number of loop iterations = the number of revs in test / the number of revs per data point

5. Write the number of steps (revs per data point * 800 steps/rev in this case) to move in between data collection points, the speed (revs/second * 800 steps/rev in this case)

6. Wait for the stepper to move the specified number of steps between data points

7. Enter a case to record the voltage from pin A0 and append it to an array once the stepper has completed its steps per data point

8. Reenter the for loop and repeat until N is reached.

9. Close connection to Arduino

When I run the program, the motor starts turning, but at a very slow speed (i.e. much lower than the specified rev/sec) and then I have no way to interrupt the program because I have included a Stepper Wait Till Steps VI in there.

Again, the motor, stepper and driver all work perfectly when using the Stepper Motor Example that came with LIFA, but it goes crazy when I introduce the for loop.  Can anyone take a look and let me know how to correct the motor speed and help me add an interrupt button so I can terminate the test without waiting for steps to complete?  I have inserted text comments in the program to help understand the intent of each function.

0 Kudos
Message 1 of 1
(3,154 Views)