From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW Interface for Arduino Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

Arduino Example: Stepper Motor Example

Before opening this example, make sure to install the LabVIEW Interface for Arduino.

Description:

This example shows how to use a stepper motor on the Arduino using the LabVIEW Interface for Arduino.

Tutorial:

  1. Make sure you have installed the LabVIEW Interface for Arduino.
  2. Open the Arduino Stepper Motor Example VI (search for "Arduino" in the example finder once the toolkit is installed).
  3. On the front panel, select the stepper motor # you want to use. If using preset movement enter the speed, number of steps, and acceleration. 
  4. Connect your steper motor driver to the Arduino.  The block diagram shows a connection diagram for using an Easy Stepper motor driver.
  5. Click Run.
  6. The VI will run until you select Stop.  You can adjust the dial for interactive movement and change the preset constants at run time.

stepper motor FP.png

stepper motor BD.png

Kevin Fort
Principal Software Engineer
NI
Comments
hrh1818
Active Participant
Active Participant
on

How do you get the stepper motor to stop when you hit a limit stop?   AS far as I know when you send a command to move N steps the program will keep running until N steps are completed.  You can't use interrupts because interrupt capability is not built into LIFA. 

I claim you will need to  develop a Labview VI and Arduino sketch to meet your requirements.

hr212

David_NMRSA
Member
Member
on

LIFA really screwed me over in regards to backward compatibility, so I don't use those subvi's.

I use the old Arduino vi's, and simply poll the analogue inputs that the limit switches are connected. When I read a TRUE input, i handle it as per the state of the program and steppers.

FutureTECH
Member
Member
on

I want to know how to add limit switches.. @David_NMRSA , the method you have mentioned is not working for me. can you send screenshot of your vi?? How can you read analog input as TRUE?

David_NMRSA
Member
Member
on

I apologise - I deterime a TRUE state by comparing the input voltage on a particular analogue input to a threshold voltage.

I've attached the limit switch port read and analysis subvi:

PS. this would be a lot easier to explain in a forum thread, wherein I can post a vi.

LIMIT switch vi.jpg

FutureTECH
Member
Member
on

can you send me vi on my email id? sumukh208@gmail.com

please send if possible. I gurantee you I am not going to use it for commercial purpose.

Jwerhhh23
Member
Member
on

sir is this example vi compatible with my stepper motor and driver??  I'm using a stepper motor byj48 and a ULN2003 motor driver module instead of a L298 motor driver. When I run the example vi using the LIFA stepper motor example, my motor is not rotating nor vibrating but the motor driver is working well and the TX/RX are ON. Any suggestions to solve my problem?

David_NMRSA
Member
Member
on

you have taken the time to identify what isn't working, but i'm not really sure what the real problem is - are you sending the correct commands to the stepper motor driver; have you investigated the firmware on the arduino to verify your input commands are doing what they should; is the firmware controlling your stepper motor correctly, as the driver expects? I suggest you spend a little more time with this and attempt to understand the different stages of the example, from LV to Arduino firmware to SM driver to SM. I believe, from there, you will gain a deeper understanding on what is required in your design, including what is compatable and what is not. Good luck.

Jwerhhh23
Member
Member
on

sir how can i change the direction of the stepper motor? ive already done series of steps like making one input value (no. of steps) to negative. but still it wasn't the solution. Im using the example stepper motor example of LIFA but it only runs in one direction.

Jwerhhh23
Member
Member
on

I already fixed the problem.. my stepper motor pins are placed reverse in the other direction.

dual_fuel
Member
Member
on

I don't understand what it means by stepper #. Can anyone help me determine what the "stepper number" is of my motor?

Bowxx
Member
Member
on

Hi everyone,

I tried the code, but got stuck at the "Stepper Configure" part. There's no error report but the program just keep running after I clicked  "Run", and the light on Arduino board just keep flashing. May I ask what's going on? Thank you in advance.

 

(I'm using easy driver for a 4 wire motor, I tried changing wiring but did help. It works when I use the Arduino program)

 

ardurino labview error.JPG

Bowxx
Member
Member
on

Hi, 

Some help please! I have a Sparkfun Easy driver and I uploaded the LIFA_Base.ino to the Arduino and the program runs without error, but there's no response from the motor. I tried changing many settings and wiring, but none of them work. The motor works when I use the Arduino software following instruction on (https://learn.sparkfun.com/tutorials/easy-driver-hook-up-guide?_ga=1.32294654.1180837971.1490400140#...).  

 

The TX and RX are always on when the program is running, I'm wondering if that's normal? 

Also, what should be the "Stepper#"? Is it always 0?

Can someone give me some suggestions? I would really appreciate it !

AhmetA
Member
Member
on

Am I the only one losing steps when changing the direction. Somehow if I change the direction from pos to neg and do this a few times the motors always end up beeing to far on the neg side.

615431
Member
Member
on

Hey ther
how can I download this example?

polymdg
Member
Member
on

 hello

who can provide a code for using labview and arduino to move a stepper motor to and fro continuously to a specified points until you stop it. thanks

Shiv007
Member
Member
on

hi I want to run this stepper program with analog read simultaneously , but facing problem .

Please tell me how can i read an analog pin with stepper control.

Melissa_A
Member
Member
on

Would you mind sharing the file? My labview is not allowing me to reach the example files. 

Tema1034
Member
Member
on

@Kevin_F wrote:

Before opening this example, make sure to install the LabVIEW Interface for Arduino.

 

Description:

This example shows how to use a stepper motor on the Arduino using the LabVIEW Interface for Arduino.

 

Tutorial:

  1. Make sure you have installed the LabVIEW Interface for Arduino.
  2. Open the Arduino Stepper Motor Example VI (search for "Arduino" in the example finder once the toolkit is installed).
  3. On the front panel, select the stepper motor # you want to use. If using preset movement enter the speed, number of steps, and acceleration. 
  4. Connect your steper motor driver to the Arduino.  The block diagram shows a connection diagram for using an Easy Stepper motor driver.
  5. Click Run.
  6. The VI will run until you select Stop.  You can adjust the dial for interactive movement and change the preset constants at run time.

stepper motor FP.png

stepper motor BD.png


 

Contributors