Stepper Motor U3 | LabJack
 

Stepper Motor U3

6 posts / 0 new
Last post
Victor
victorpbr's picture
Stepper Motor U3

Hi, 

I'm trying to control a stepper motor using matlab and a L293D driver. The stepper motor is this one

http://www.ebay.co.uk/itm/Nema-17-Bipolar-40Ncm-12V-0-4A-Stepper-Motor-4...

Can you help me with a pseudocode to control its velocity using labjack U3-LV ou HV (I have both)

LabJack Support
labjack support's picture
The L293 is simply a driver. 

The L293 is simply a driver.  That is, it is just an H-bridge and you have to do the phase sequencing for the stepper.  First step is to hook it up and manually control it use the test panel in LJControlPanel to toggle the digital outputs as you need to make the motor move.  The details of phase sequencing are not LabJack specific but rather general stepper usage details, so beyond our realm of support.

See the following for different ways to control outputs:

https://labjack.com/support/app-notes/waveform-generation

Since you have to do phase sequencing you are not going to be able to use timers so are limited to Command-Response and the WAIT technique.  With the T7 you likely could use timers as it has a "PWM output with phase" feature that might work for this.

If you want to make things easier find a stepper controller rather than driver.

Victor
victorpbr's picture
Hi, Thanks for the reply.

Hi, Thanks for the reply.

I achieved control of one stepper motor with the command response and software timer. My problem now is that my final goal is controlling the speed of two different steppers. Is there any way I can do this with labjack, so I can have at the same one motor spinning at one velocity and the other motor spinning at a different velocity?

LabJack Support
labjack support's picture
With your motor driver, the

With your motor driver, the answer is just a matter of your programming.  You need to expand on the technique you have implemented so it can do 2 motors at different speeds.  For example, say you make a loop that updates FIO0 and FIO1 with the following values every 10 ms:

00
01
10
11
00
01
10
11

You can see that FIO0 is toggling at twice the rate as FIO1.

If you switched to a motor controller rather than your motor driver, this would be much easier because you could just use the 2 timers on the U3 to produce 2 different frequencies.

jsimeroth
jsimeroth's picture
I have a similar question,

I have a similar question, but I am using labview. LabJack support, can you please expand on what you mean by using the two timers on the U3 to produce 2 different frequencies? A screen shot could be very helpful here as well.

LabJack Support
labjack support's picture
The U3 has two timers that

The U3 has two timers that can be used to generate PWM or frequency outputs: https://labjack.com/support/datasheets/u3/hardware-description/timers-co...