LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

controling a 2 bipolar stepper motors with arduino+shield + LIFA (Labview)

Dear all

I have an old plotter with 2 bipolar steppers motors.

I am tryind to do a xy table.

After researching I found that I could control the 2 motors with arduino uno, Shiel from DFrobot (Dual Bipolar Stepper Shiel for Arduino A4988)

http://www.dfrobot.com/wiki/index.php/Stepper_Motor_Shield_For_Arduino_(SKU:DRI0023)

After readind the wiki it has an arduino code that uses this digital pins to control the motors

int M1dirpin = 4;

int M1steppin = 5;

int M2dirpin = 7;

int M2steppin = 6;

After instaling LIFA I developt a labview code (for now I connect 1 motor) but seems I need a lot to learn, it moves, but.....

I need to invert the movement

I can't see the pulses running in a window

The final project I must do a y lines (maximum travel about 40cm)) spaced in x by 1cm

For now I need to understand how to change direction, stop motor, (seems the pins must be in LOW) but in labview how do it?

Best regards

cpalka

0 Kudos
Message 1 of 18
(8,567 Views)

Hi friends

We have deverlopments.

The new version works good, seems I need to change between 6 and 7 for LOW and HIGHT and I choose the option 2 wires (pulse and direction).

Still no understand why need a case and where I can get the reading of pulses.

The stepper to go block do nothing....

0 Kudos
Message 2 of 18
(6,570 Views)

Init.vi must be before the while loop and Close.vi must be after the while loop.

0 Kudos
Message 3 of 18
(6,570 Views)

Thanks Nathan_B.

How can I do a mesh with motors is using multiple write.vi for each motor?

I want to do ylines (about 40cm) spaced in xx about 1cm.

The plotter maybe has 30cm large so I can do about 30 lines in yy axis (I must use 30!!! write.vis???)

This something like that, I will use this to measure the z profile with a distance laser.

--------------------------------------------------------------

--------------------------------------------------------------

--------------------------------------------------------------

--------------------------------------------------------------

0 Kudos
Message 4 of 18
(6,570 Views)

Another thing that I noticed is that the stepper pins should never change for a stepper motor.  The "Stepper Configure.vi" should also be before the while loop and the "Stepper Close.vi" should be after the while loop.  If you need to move in reverse, you should write negative steps.  Also, realize that each time the loop iterates, it will command the motor to move "# of Steps to Move".

You will have one "Stepper Configure.vi" for each motor which means that you'll reference each motor by the stepper number (1 or 2).

0 Kudos
Message 5 of 18
(6,570 Views)

Monday I will experiment in the service.

But this shield is strange it uses pins 4 and 5  for motor 1 and 6 and 7 for motor2.

I start with a code that I found here and the logic that I find is I have an array of 2 numbers and for motor 2 is 6 and 7.

You can see in my code if I want to stop the motor I send a 7 in first position array and 6 for moves, in secound positiion of the array is the same 6 for backword and 7 for forword....strange....this is this DFrobot shield? and should I use 4 wires (because my motors are bipolar 4 wires) or use the option 2 wire (pulse & direction) in stepper config.vi for logic should be the first but maybe for this shield the last one works for me.

The other part of loop iterates I do not understand, sorry.

cpalka

0 Kudos
Message 6 of 18
(6,570 Views)

Unfortunately, I'm not familiar enough with all this stepper motor stuff to be able to answer all of your questions.

0 Kudos
Message 7 of 18
(6,570 Views)

Ok, Nathan

No problem, I will try next monday, then I will give news and post the new example if it works for the people.

cpalka

0 Kudos
Message 8 of 18
(6,570 Views)

Hi Nathan

Here is a version with you suggestions.

Problems:

- If i need stop imediatly how to make it? I do stop in vi but stills moving, can be in case window (in false case I unput o speed??)

- In negative coordinates (-15000) the stepper remaining window starts in about 50350????

- And can you help how to do a repeater from 0 to 15000 pulses and from -15000 to 0 for example 7 times

best regards

cpalka

0 Kudos
Message 9 of 18
(6,570 Views)

Hi people

This is my actual version of a XY table

I make a sequence of a y line (front) + x small line + y line (back) + x small line, inside a for loop (for example 10 loops)

The results is similar

____________________________

|___________________________|

|___________________________|

|___________________________|

Now I need to save the pulses of yy and xx with stepper to go .vi but i put every where but nothing.

Can somebody give me a idea to change or make this solution with other way?

Thanks

CPalka

0 Kudos
Message 10 of 18
(6,570 Views)