You are on page 1of 13

Home (//www.ni.

com/) 
Community Home (/)  User Groups (/t5/User-Groups/ct-p/user-groups)  Product Groups (/t5/Product-Groups/ct-p/product-groups)
 LabVIEW Interface for Arduino (LIFA) (/t5/LabVIEW-Interface-for-Arduino/ct-p/7008)  LabVIEW Interface for Arduino Documents (/t5/LabVIEW-Interface-for-Arduino/tkb-p/7306)
LABVIEW INTERFACE FOR ARDUINO DOCUMENTS
Register for the community (https://lumen.ni.com/idp/profile/SAML2/Unsolicited/SSO?
providerId=https://forums.ni.com/auth/saml&cifaction=create&isoLang=en&target=https%3A%2F%2Fforums.ni.com%2Ft5%2FLabVIEW-Interface-for-
Arduino%2FArduino-Example-Stepper-Motor-Example%2Fta-p%2F3522948)
|
Log in (https://lumen.ni.com/idp/profile/SAML2/Unsolicited/SSO?
providerId=https://forums.ni.com/auth/saml&cifaction=login&isoLang=en&target=https%3A%2F%2Fforums.ni.com%2Ft5%2FLabVIEW-Interface-for-
Arduino%2FArduino-Example-Stepper-Motor-Example%2Fta-p%2F3522948)
| Help (/t5/help/faqpage)

Documents  Search the community

Document Options

Arduino Example: Stepper Motor Example  

by Kevin_F (/t5/user/viewprofilepage/user-id/195570) on 01-03-2012 03:45 PM - edited on 01-30-2017 09:52 AM by


Kevin_F (https://forums.ni.com/t5/user/viewprofilepage/user-id/195570)

Examples (/t5/LabVIEW-Interface-for-Arduino/tkb-p/7306/label-name/examples?labels=examples)

Before opening this example, make sure to install the LabVIEW Interface for Arduino. (/docs/DOC-15971)
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 (http://www.ni.com/gettingstarted/labviewbasics/examples.htm) 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.

Regards,
Kevin
Product Support Engineer
National Instruments
Arduino (/t5/tag/Arduino/tg-p/board-id/7306) example (/t5/tag/example/tg-p/board-id/7306) labview-2009 (/t5/tag/labview-2009/tg-p/board-id/7306)
Labview-2010 (/t5/tag/Labview-2010/tg-p/board-id/7306) labview_interface_for_arduino (/t5/tag/labview_interface_for_arduino/tg-p/board-id/7306)

View All (5) (/t5/forums/tagdetailpage/tag-cloud-grouping/tag/tag-cloud-style/frequent/message-scope/single/message-uid/3522948/user-scope/all/tag-scope/all/timerange/all/tag-visibility-


scope/all)

7K

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522948?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP
(/t5/LabVIEW-Interface-for-Arduino/Arduino-Example-Stepper-Motor-Example/ta-p/3522948) (/t5/LabVIEW-Interface-for-Arduino/Arduino-Example-Stepper-Mo

UINO-EXAMPLE-STEPPER-MOTOR-EXAMPLE%2FTA-P%2F3522948&TITLE=ARDUINO+EXAMPLE%3A+STEPPER+MOTOR+EXAMPLE&USERNAME=POWEREDBYLITHIUM)

COMMENTS

(/t5/user/viewprofilepage/user-id/224367) shellykk (/t5/user/viewprofilepage/user-id/224367) MEMBER 04-05-2012 03:06 PM Options 

how do i change the direction to anti-clockwise??

2 KUDOS (

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522949?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/375238) RobWal (/t5/user/viewprofilepage/user-id/375238) MEMBER 05-03-2012 09:10 AM Options 

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522950?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/375238) RobWal (/t5/user/viewprofilepage/user-id/375238) MEMBER 05-04-2012 05:52 AM Options 

Hi shellykk, I posted an example but It wont me upload the vi here. If you go to manage versions at the top of this page and go to version 2 it should be there.

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522951?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/224367) shellykk (/t5/user/viewprofilepage/user-id/224367) MEMBER 05-06-2012 11:32 AM Options 

Thanx... I figured out a way.... Just reversd the inputs... Couldnt find ur vi.....

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522952?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/267760) ThePeppinator (/t5/user/viewprofilepage/user-id/267760) MEMBER 02-25-2013 09:49 AM Options 

hi. i am getting error 1073676294 when i try and run the program. i have been looking around and i know this is not an error. what i dont know is how to fix it.
did any one else have the same problem or whats going on. loosing my hair over this one.
thanks in advance......

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522953?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/224367) shellykk (/t5/user/viewprofilepage/user-id/224367) MEMBER 02-26-2013 07:33 AM Options 

if you've searched for the error you must have got the following solution. Try it & check if it works:
http://digital.ni.com/public.nsf/allkb/FDE6168683769D0886257975006D95B0 (http://digital.ni.com/public.nsf/allkb/FDE6168683769D0886257975006D95B0)
Besides check if the baud rate suits your processor & system.

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522954?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/258112) mudithadias (/t5/user/viewprofilepage/user-id/258112) MEMBER 05-20-2013 10:19 AM Options 

Hi guys I'm new to arduino and labVIEW. Could you please tell if if can run the same example using a L6470 stepper driver instead of an easy driver. Also, do
we have to upload any codes for the arduino before commanding the motor through the labVIEW front panel? I've got a stepper setup with a L6470 but the
motor is not running

any advice? Thanks in advance !!

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522955?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/264258) venkieeez (/t5/user/viewprofilepage/user-id/264258) MEMBER 07-01-2013 04:39 PM Options 

HI guys,
I am trying ti run an applied motion stepper with a Big Easy driver, arduino and labview. However when i connect the terminals as specified in the diagram,
the circuit runs fine but i get a warning OK 1073676294 and the stepper doesnt run at all. I need to work this out ASAP, please reply at the earliest.

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522956?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/258112) mudithadias (/t5/user/viewprofilepage/user-id/258112) MEMBER 07-02-2013 08:54 AM Options 

Hi,
I also had the same setup but it didnt work. Then I switched the step and direction pins so that the step pin is connected to arduino digital pin 2 and direction
pin to arduino digital pin 3. It worked fine then. Try that.

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522957?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/272982) giladd (/t5/user/viewprofilepage/user-id/272982) MEMBER 11-17-2013 02:14 AM Options 

i try to use this vi and it doesnt work


its running but nothing is moving,when i connect the step pin to pin 1(without changing the pin in the vi),the engine start moving even if i dont push the "start
stapping" button.when i do push it the engine rotate faster untill the green light go off and then it keep rotating..someone know why?

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522958?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/272982) giladd (/t5/user/viewprofilepage/user-id/272982) MEMBER 11-17-2013 02:29 AM Options 

venkieeez (/people/venkieeez),did it worked for you?

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522959?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO
(/t5/user/viewprofilepage/user-id/421552) ferreboogaerts (/t5/user/viewprofilepage/user-id/421552) MEMBER 01-16-2014 04:08 AM Options 

how do you change the baud rate to 115200?

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522960?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/437688) M.adabi (/t5/user/viewprofilepage/user-id/437688) MEMBER 01-19-2014 01:48 PM Options 

ferreboogaerts (/people/ferreboogaerts)
move your cursor on the arduino VI and then on the baudrate pin on its left, right click and create a constant, I presume it's already set to a default value of
115200.

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522961?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/440910) arash2007 (/t5/user/viewprofilepage/user-id/440910) MEMBER 02-28-2014 04:57 AM Options 

When I set the speed to anything above 400 the motor will never stop (i.e. the "step remaining" output misses zero and starts to count down from 65000...)
any idea? is the step remaining counter done at the Arduino or in Labview or both?

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522962?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/302812) ayyub (/t5/user/viewprofilepage/user-id/302812) MEMBER 03-12-2014 08:44 AM Options 

hi. i have a 5 wire stepper motor (5V-0.6A) . and i wrote a program in labview. i use two ULN2003 as interface. when i running the program, the motor work
slowly. i don't know that my program is incorrect or my interface connection!!
please show me what program is correctly.
thanks

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522963?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/302812) ayyub (/t5/user/viewprofilepage/user-id/302812) MEMBER 03-12-2014 08:45 AM Options 

this is my program (for half step):


 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522964?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/38107) hrh1818 (/t5/user/viewprofilepage/user-id/38107) ACTIVE PARTICIPANT 03-12-2014 11:14 AM Options 

It appears you are using LIFA to generate pulses to drive a step motor. LIFA is to slow to drive a step motor. You should instead be using Aduino to generate
the pulses and only use Laview to tell Aduino in which direction to move and how many steps to move. This is how the stepper VI that comes with LIFA
works.
Here is an example for a 5 volt 4-phase 5 wire stepper motor and a UNL2003 driver bard that will show you how to write the code for Arduino.
hrh1818

3 KUDOS (

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522965?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/291948) RutsT (/t5/user/viewprofilepage/user-id/291948) MEMBER 04-11-2014 02:56 AM Options 

Here is an example for a 5 volt 4-phase 5 wire stepper motor and a UNL2003 driver bard that will show you how to write the code for Arduino.

Hey hrh1818
Where is the example? The setup you describe is almost the same as mine and I can't figure out how to make it work. Could you please share your exampe
with me?
Kind regards
Ruts

2 KUDOS (

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522966?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/287493) Zahkay (/t5/user/viewprofilepage/user-id/287493) MEMBER 04-11-2014 03:00 AM Options 

hello i am having the same issue with this VI.


i did my own driver which is L298 connected to some diodes .
Have you been able to do your LIFA code

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522967?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

N/A 12-13-2014 08:29 AM Options 

Hello hrh212 (/people/hrh212),


where is it an example?
Could you share with us?
Thanks in advance

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522968?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/317494) mr_three (/t5/user/viewprofilepage/user-id/317494) MEMBER 01-21-2015 12:29 PM Options 

Hello all,
I notice that the maximum number of counts in this program is limited to a 16 bit integer, i.e. (2^16/2)-1 (because of both directions). This is a problem for me
as I have modified this program so that I can move the motor a set number of pulses, but my requirement is larger than this limit. I tried just changing the
representation to a 32 bit integer in the VI and the LIFA subVIs, but this caused the motor not to turn at all.
Could someone please give me some help in trying to fix this?

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522969?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/444874) arash.pyk (/t5/user/viewprofilepage/user-id/444874) MEMBER 01-24-2015 12:41 PM Options 

LIFA was limiting and slow for me too. I ended up replacing LIFA with a very small sketch that recieves the number of steps and speed (as a string of bytes)
on an UART port. At the labview side, I used VISA to access the COM port and concatenate a string containging the number of steps etc. (the string is made
of bytes of data) I used VISA WRITE vi to transmite the string. to move the stepper I used AccelStep library for Arduino. It is more complicated to build but
you would have control over everything.

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522970?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/317494) mr_three (/t5/user/viewprofilepage/user-id/317494) MEMBER 01-24-2015 01:34 PM Options 

This sounds interesting! Could you perhaps send the sketch that you used? It would be much appreciated!

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522971?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/310343) spica (/t5/user/viewprofilepage/user-id/310343) MEMBER 02-02-2015 12:25 AM Options 

Hi Arash
Could you enlighten on how to modify the code to control two stepper motors?
The help and documentation on this are quite hard to come by.
Thanks a lot.

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522972?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/109310) David_NMRSA (/t5/user/viewprofilepage/user-id/109310) MEMBER 03-11-2015 11:59 PM Options 

Hi - I have a slightly adjusted version of the Arduino Uno (Orion - see MakeBlock) that uses 2 more analogue inputs, instead of the 6 that normally comes
with it.
In the LIFA_Base code group (LabVIEWInterface.cpp to be exact) there is a call to "analogRead(x)", where 'x' is the pin#. I wish to extend beyond '5' so I can
include A6 and A7 but i'm not having much luck.
Can anyone give me some direction on this? I'd like to look into the 'analogRead' function call more but I can seem to find it anywhere (i've searched all the h
files included)...
thanks.
David.

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522973?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/441636) Miguel89 (/t5/user/viewprofilepage/user-id/441636) MEMBER 05-28-2015 04:15 PM Options 

can you share the arduino library? the one I have doesnt include the stepper motor, the ir transmit and the lcd. Thanks in advance
 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522974?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/38107) hrh1818 (/t5/user/viewprofilepage/user-id/38107) ACTIVE PARTICIPANT 05-28-2015 06:19 PM Options 

Please explain in more detail what you mean by "share the Arduino library". LIFA includes the stepper motor example your comment applies to . You can
examine the Arduino stepper code in LIFA. How dies what is avslible now differ from what you are asking.
hrh212

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522975?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/109310) David_NMRSA (/t5/user/viewprofilepage/user-id/109310) MEMBER 05-28-2015 08:18 PM Options 

Miguel -
You don't need any extra labview drivers other than those that come with LabVIEW. The front interface (LabVIEW) just needs the VISA drivers.
What you need is the code on the Arduino itself, set up to drive a stepper motor. To understand this and find the code you need (and examples), you are best
going to the arduino website (http://www.arduino.cc (http://www.arduino.cc)). You'll need to do this to ensure you are interfacing with your particular stepper
motor and pin connection properly. You will also learn how to upload the firmware to the arduino. Once you have this up and working you don't need to touch
the code any further. The rest is in LabVIEW.
Once you have the ports and code established on the arduino, you simply send commands from your LabVIEW code to run particular ports/pins - which you
can see from the example code on this page.
I pretty much used the example here. I hacked it to what I needed but it provided a pretty good foundation for what you'll need.
EDIT: of course, you'll need to install the LabVIEW interface for Arduino; link and instructions found at top of the example.

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522976?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/441636) Miguel89 (/t5/user/viewprofilepage/user-id/441636) MEMBER 05-31-2015 12:52 PM Options 

hrh212, David
thank you both for your response. I didnt notice I had an old version of the Arduino interface for LabVIEW, I now have it updated and its working fine

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522977?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/326063) Liu9079 (/t5/user/viewprofilepage/user-id/326063) MEMBER 06-08-2015 01:41 PM Options 

How can I make mutiple stepper motor move at the same time?

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522978?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/109310) David_NMRSA (/t5/user/viewprofilepage/user-id/109310) MEMBER 06-08-2015 09:20 PM Options 

Sending a command to the stepper motor (Arduino) is very fast. This means you can send a RIGHT and then a FWD command and it will look like both
stepper motors are moving at the same time.
 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522979?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/321758) amkamyab (/t5/user/viewprofilepage/user-id/321758) MEMBER 01-21-2016 10:26 AM Options 

hello everyone
if anybody knwo about how i change direction of stepper motor in this example , please tell me. i need it really
thanks

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522980?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/54027) Eric_BOB (/t5/user/viewprofilepage/user-id/54027) MEMBER 01-21-2016 11:28 AM Options 

If my memory is ok, you just need to put negative value to "Steps to move" to go to the opposite direction.
Eric

1 KUDO (

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522981?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/321758) amkamyab (/t5/user/viewprofilepage/user-id/321758) MEMBER 01-21-2016 11:32 AM Options 

thanks for you help


i already down that like image i send bellow. the problem is when i put negative value for first step and posetive value for other step both of them going in one
direction.
can you help me with that?

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522982?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/109310) David_NMRSA (/t5/user/viewprofilepage/user-id/109310) MEMBER 01-21-2016 07:16 PM Options 

amkamyab -
all you're doing here is adding a negative sign to the # of steps to move variable. This does not change the direction.
it is the input stepper # that you need to change.
I suggest you study the code on your Arduino (firmware) and determine which stepper motor has the stepper # value associated with it.
you will also need to understand that the direction of the stepper motor is given a separate stepper # value (if you are using the base LabVIEW Arduino
code). The quick test here would be to change the value from '0' to '1'.

1 KUDO (

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522983?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO
(/t5/user/viewprofilepage/user-id/54027) Eric_BOB (/t5/user/viewprofilepage/user-id/54027) MEMBER 01-22-2016 04:50 AM Options 

HI
There is few error in you program.
1) Remove unused "Close Visa" . "Close Arduino" at the end is enough.
2) "Stepper Move "Vi is used for send value of move one time before moving.
3) After, you need wait the end of moving,before send another moving command.
4)To know if the move is finish , you can use Stepper toGo Vi. Put it in while structure and watch step remaining value.
5) if you want prematurely, use "Stepper Move "Vi with 0 in "To Move Value. Place it in case structure place in previous while.
6) When all steps are finish, Duplicate 2)(with negative value on "step toMove"input) and 3)4)5) to go on the opposite direction .
7)and finish with "Close arduino Vi.
Eric

1 KUDO (

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522984?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/321758) amkamyab (/t5/user/viewprofilepage/user-id/321758) MEMBER 01-22-2016 05:24 AM Options 

thank you for your help.


it work now correctly.

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522985?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/430545) moien.t (/t5/user/viewprofilepage/user-id/430545) MEMBER 03-10-2016 10:43 AM Options 

Hi everyone,
I had a question regarding using Labview in combination of Arduino + Reprap 1.4 + Stepper motors. In fact I am using Labview to control my stepper motors
which are NEMA 17. I got the Labview interface for Arduino installed, but I cannot even run the Arduino example for stepper motors. I think the problem is
setting the correct pin numbers for the stepper motor. I cannot find the proper matching for the pin numbers as I am using the Reprap 1.4. Has anyone any
suggestion or idea how to resolve this problem?
Best,
Moien

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522986?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/529125) javier.gandara (/t5/user/viewprofilepage/user-id/529125) MEMBER 04-22-2016 08:01 PM Options 

you put negative numbers (I found out the hard way)

1 KUDO (

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522987?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/385918) FutureTECH (/t5/user/viewprofilepage/user-id/385918) MEMBER 08-01-2016 07:53 AM Options 


I tried this to get opposite direction for stepper motor with little changes in program. I want to add limit switches to stop the motor and it should start in
opposite direction and should be able to move in some steps till that switch gets inactive. How to do this? I am attaching vi
here.https://app.box.com/s/0ecasief8yctg67k2q7czxmc6zl6azvu (https://app.box.com/s/0ecasief8yctg67k2q7czxmc6zl6azvu)

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522988?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/109310) David_NMRSA (/t5/user/viewprofilepage/user-id/109310) MEMBER 08-01-2016 08:36 AM Options 

I'm not entirely sure what's going on in the last three (3) comments...I see a bunch of odd characters from FutureTECH and possible advertisement from
erickalfonso (Outlook...really?)
FutureTECH, if you're serious about looking for assistance, I suggest you post your vi in the forum here, or start your own thread to do so.

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522989?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/385918) FutureTECH (/t5/user/viewprofilepage/user-id/385918) MEMBER 08-01-2016 09:20 AM Options 

I have already posted my vi here in the link.. I don't know how to post it directly in forum so I uploaded in box.com account. Which is available for download
and run on your machine. (The blue link where you have to click and download it. 1.5mb file is there.) I seriously need an assistance that is the reason I
posted it here. I don't know who posted the advertisement as an answer to my question.

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522990?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/109310) David_NMRSA (/t5/user/viewprofilepage/user-id/109310) MEMBER 08-01-2016 08:55 PM Options 

this may not be the best place to seek further discussion over code (vi), as it really isn't supported with the option to upload files. I suggest you go to the
forums and have a little search there (forums.ni.com). If you can't find a post there that can assist, create one and post the link here (or send me a personal
message). You can attach files with your posts there. That way you'll get a better hit rate from those who are able to assist you in resolving your problem.
Good luck!

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522991?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/395373) DrpDsgn (/t5/user/viewprofilepage/user-id/395373) MEMBER 08-01-2016 11:30 PM Options 

hi there..
I have the same problem, i can´t get the motor to turn to the opposite way, can you upload the screenshoot of the vi that is all done and worked, please.

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522992?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/81341) barddya (/t5/user/viewprofilepage/user-id/81341) MEMBER 08-02-2016 10:52 AM Options 

How many wires your motor have?-B


From: DrpDsgn <web.community@ni.com>
To: barddya <barddya@yahoo.com>
Sent: Monday, August 1, 2016 9:32 PM
Subject: Re: (LabVIEW Interface for Arduino) - Arduino Example: Stepper Motor Example
|
|
NI Community
|
Arduino Example: Stepper Motor Example
new comment by DrpDsgn View all comments on this documenthi there.. I have the same problem, i can´t get the motor to turn to the opposite way, can you
upload the screenshoot of the vi that is all done and worked, please.Reply to this email to respond to DrpDsgn's comment.

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522993?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/385918) FutureTECH (/t5/user/viewprofilepage/user-id/385918) MEMBER 08-02-2016 11:19 AM Options 

This is for stopping stepper motor...

This is for changing the direction.

This is front panel...


This is link to updated vi
https://app.box.com/s/0ecasief8yctg67k2q7czxmc6zl6azvu (https://app.box.com/s/0ecasief8yctg67k2q7czxmc6zl6azvu)
 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522994?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/109310) David_NMRSA (/t5/user/viewprofilepage/user-id/109310) MEMBER 08-02-2016 08:07 PM Options 

I've noticed a couple of things in your screenshots. I don't know the structure of your firmware (on the Arduino) so I'm going to have to make a couple of
assumptions on how you're calling and initialising your stepper motor.
For me, I use a 4-wire stepper motor driver (I use 2 stepper motors). To initialise, I need to use the init subvi in the same manner as you, but for each
direction that I use (one motor handles FWD and REV; the other, LEFT and RIGHT - it's a plotter).
In your code you are initialising only one stepper motor, being the forward direction. But in all this (and what people are saying above), I don't use -ve
numbers to attempt a reverse direction. I simply initialise a motor with the ports (wires) swapped. You can try something similar but again, it'll depend on your
firmware.

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522995?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/385918) FutureTECH (/t5/user/viewprofilepage/user-id/385918) MEMBER 08-02-2016 11:11 PM Options 

I am using A4988 motor driver and 4 wire bipolar stepper motor. so the stepper I select from the vi is "2wire pulse and direction". Where pin 2 and 3 from
arduino are connected to step and DIR input of driver.

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522996?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

(/t5/user/viewprofilepage/user-id/109310) David_NMRSA (/t5/user/viewprofilepage/user-id/109310) MEMBER 08-03-2016 08:16 AM Options 

ok. I noticed in your screenshot that you select the 'easydriver'. Is this correct?
Have you tried swapping the port allocation on the init; switch '2' and '3' in the array ?

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522997?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO
(/t5/user/viewprofilepage/user-id/385918) FutureTECH (/t5/user/viewprofilepage/user-id/385918) MEMBER 08-03-2016 11:48 AM Options 

I select 2 wire step and direction. Easy driver is selected in the vi by default. and yes I tried with swapping, it didn't work for me.

 (HTTPS://FORUMS.NI.COM/T5/TKB/V2_4/ARTICLEPAGE.KUDOSBUTTONV2.KUDOENTITY:KUDOENTITY/KUDOSABLE-GID/3522998?T:AC=BLOG-ID/7306/ARTICLE-ID/430&T:CP=KUDO

 Previous 1

2 (https://forums.ni.com/t5/LabVIEW-Interface-for-Arduino/Arduino-Example-Stepper-Motor-Example/ta-p/3522948/page/2/show-comments/true) Next 

CONTRIBUTORS

(/t5/user/viewprofilepage/user-id/195570) Kevin_F (/t5/user/viewprofilepage/user-id/195570)

(https://www.lithium.com/powered-by-lithium)

+ PRODUCT

+ SUPPORT

+ COMPANY

(http://www.facebook.com/NationalInstruments) (http://twitter.com/niglobal) (http://www.ni.com/rss/)

(http://www.youtube.com/NIEasternEurope)

MISSION
NI equips engineers and scientists with systems that accelerate productivity, innovation, and discovery.

Contact Us (http://www.ni.com/contact-us/) or Call 0800 070 071

Legal | (http://www.ni.com/legal/) Privacy (http://www.ni.com/legal/privacy/unitedstates/us/) | © 2018 National Instruments. All rights reserved.

You might also like