From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stepper Motor Control using NI USB 6211

Hi,

Could someone hep me with following:

I have a working model of the stepping motor control, but i am intending to change or add the following function:

  1. Speed of the motor - I have to stop and run again to change the speed, how can i accelerate the speed in real time
  2. Direction of the motor - how can I stop the motor or slow it down before i change the direction of the motor (mainly to avoid to the immediate jerk it gets)

I am new to programming, any help on the same would be appreciated.

 

Regards

Deepak

0 Kudos
Message 1 of 11
(3,156 Views)

Hi Deepak

 

You will need to use a encoder with three digital input lines for A, B, C with a counter input task set to velocity encoder (includes speed and direction).

 

Below is a link which you may find helpful;

http://www.ni.com/white-paper/14805/en/

 

Thanks,

 

Sarah

0 Kudos
Message 2 of 11
(3,074 Views)

Hey Deepak,
I am recently using NI USB6211 to control a stepper motor and I met some hardware problem.
My question is : with the program you attached above, does the DAQcard DO channel provide a pulse signal to motor driver or IO signal? I have this question because the supplier asked me to decide the type of driver. Should I choose pulse train control type or digital IO control type (two choices from supplier)?
Another question is did you use any interface between USB6211 and motor driver, such as an amplifier? I am worrying the power of output signal from DAQcard and input signal to driver are not match? I have an external power supply for driver though.
These two questions confused me for a long time, please share with me some of your experience.
Thanks in advance !
Tony

0 Kudos
Message 3 of 11
(1,922 Views)

The code that was posted uses a *Counter* output to deliver a TTL pulse train to the stepper driver.  Counter outputs *are* TTL digital signals, but the behavior available for counter tasks is quite different from digital tasks.

 

It's almost certain that a counter pulse train type of control will be your best option from a NI 6211.

 

Please also note that the posted code is nothing more than a way to confirm the most basic functionality.  Real code needs to be more careful about the timing of when direction or enable signals are written relative to when the pulse train is generated.

 

The 6211 will not be able to generate smoothly accelerating/decelerating trajectories, at least not without quite a substantial amount of work.  If you need such motions, you should at *least* look into an NI X-series device, but you may be better off buying a 3rd party stepper controller that can generate such trajectories and deliver the variable frequency pulse train (along with direction and enable signals) for you.  Or look for a different stepper drive that's integrated with a controller.

 

In summary, the kinds of motion you can readily accomplish with the 6211 will be:

- constant low speed with a precise # of steps

- variable speed with a imprecise # of steps

 

 

-Kevin P

 

 

P.S.  The signals you can generate with your 6211 are digital TTL logic signals.  You cannot source enough current to wire directly to a motor and make it spin.   The stepper *drive* is what supplies current to the motor windings.  You need a drive that can either accept your TTL logic control signals or which can do its own trajectory generation. 

    I don't know what stepper drive you're considering, but it shouldn't be difficult to identify one which can support one of those methods if not both.  They're both pretty standard.

 

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 4 of 11
(1,908 Views)

Hi Kevin,

As a new member of this community, I feel very warm and suprise for getting such a clear reply such soon. Thank you very much!

 

Regarding the answer, does the counter output through the digital output channel or a separated physical channel. I am asking this because I cannot find the voltage level information of the counter from NI 6211 spec. Assuming it is going out through digital output channel, the low voltage (logic 0) is  0.6max and high voltage logic 1) is 2.7 - 3.6V. The motor drive I am picking (AZD-K from oriental motor) needs an external power source (24V DC), but it still require the input signal at least 5V DC, so 2.7-3.6V VOH might not enough to directly run the drive (signal distortion problem?). So I am thinking to use a solid state relay (MOS 5VTTL/24VDC from Weidmuller) as a interface between NI 6211 and the driver. Would you think it is appropriate?

 

Thanks again for your explanation about the function of 6211card and the posted code. My design purpose is just precise position control, not much about speed control. The possible top requirement (not compulsory tho) might be fast approaching to a target and pushing it slowly with constant speed after contacting. 

 

I am grateful for your help!

Tony

0 Kudos
Message 5 of 11
(1,887 Views)

1. For the most part, digital and counter signals share a lot of characteristics.  Both are designed to work at TTL logic levels and both share a lot of I/O signal paths.  The finer details are beyond my expertise, but I'm pretty sure you won't need to worry about them.

 

2.  Both Digital and Counter outputs will be TTL-compatible at a nominal 5.0 V, provided you aren't trying to source too much current.  When connected to another device expecting TTL logic signals, it won't demand much current, and you'll have output voltages near the nominal 5 V.  And the logic circuit on the other side (your motor driver) should recognize anything in the 3-5 V range as logic high.   That's all part of being compatible with TTL.

     The specs that concern you are *NOT* meant to describe normal or typical behavior.  They are meant to describe the extreme conditions where expected behavior is still guaranteed.

 

3. No, I wouldn't use a solid-state relay.  You shouldn't need one as described above.

    Besides, it'd have some switching speed limit and I'd be worried about transients from that switching.  (This is uneducated worry.  I don't know that there would be a problem, but also don't know that there won't be.)

   Way back before year 2000 we ran into stepper pulse interface problems because the pulses had an opto-coupler inline that behaved erratically at the pulse rates we were trying to achieve.   I'm wary of putting things inline unless necessary, and the specs would need to show *LOTS* of margin beyond our requirements.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 6 of 11
(1,880 Views)

Dear Kevin,

 

I started to searching USB 6341 and asking relevant question based on your previous suggestion about X-serise DAQcard.

 

From your reply, I have following question to ask (please bear with my slow brain):

 

Is this statement: ''Digital/Counter outputs will be TTL-compatible at a nominal 5.0V'' true  for both USB6211 or 6431? I am asking because when I check the spec for USB6211, it says the maximum output VoH is 2.7-3.8V. So I suspect that for 6211, the outputs are TTL-compatible but might not at standard 5V?  I totally understand your words about spec 'margin', but I am afraid that signal requirement of my drive is out of the 'margin'.


I think you've made a quite clear explanations regarding why 6341 is better than 6211 as a choice for controlling stepper motor. However, except the 'functionality' part, does 6341 Digital outputs higher nominal voltage (or signal power) than 6211?


(Question 2 is a bit repeating after Question 1)

 

I will avoid using solid-state relay as you suggested. However, I have not got a solution if 6211's output power is really not enough for the driver I picked. Also I do not have much choice on the driver since most of the driver options working at similar condition (DC5-24V). Hopefully 6341 can solve this. 

 

My question might be a bit boring for you (an experienced expert), but this is the core issue for me in the stage of hardware purchase.

 

Tony

0 Kudos
Message 7 of 11
(1,861 Views)

As I said before, I don't have solid expertise in the details of those electrical specs.  By my reading, the specs you reference are describing the *extreme* condition when sourcing significant current (significant for a logic circuit anyway), not the *typical* condition.

 

I found this in a quick search, maybe it helps to summarize the meaning of those specs?  But more generally, I'd recommend you contact NI Sales so you can get more official and definitive advice on compatibility of your driver with specific devices from NI.

 

I can say from experience that over a long history using NI multifunction boards, I've had no issues interfacing with TTL circuits in external equipment.   Here's a summary chart from NI showing that both M-series (like your 6211) and X-series (like the 6341) devices declare the digital side of their boards (which includes counter operations) to be TTL.

 

Double-check with NI Sales because I don't want to steer you wrong somehow, but I'm pretty confident you'll be fine with the 6341.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 8 of 11
(1,856 Views)

Hi Kevin,

The NI sale staff in my country is not knowing much regarding my questions (after 4-5 calls, I know this).

I will finally select USB6341 to minimize the risk and reserve the possibility to explore the ‘robust’ motion control. I will kick off the programing and testing work after it is delivered.

This reply is just for letting you know that, from your reply these days, I think I have learnt many basic concepts and got answers for almost all my questions about hardware selection.

Thank you so much! And hope we still have chance to discussion in the future substantial working stage.

Tony

 

0 Kudos
Message 9 of 11
(1,838 Views)
Hey Kevin, It has been long time since last time I posted my question in this topic. Now I have achieve a very basic control of stepper motor using USB 6341. As you mentioned before, the X-series can do more motion control comparing with M-series DAQ card. Could you please tell me what is the key advantage of 6341(better than 6211 in high speed velocity control)?Should I use counter output or digital output to achieve it? I asked because it seems hard to change period and duty ratio when I using counter output to generate a pulse train signal.
0 Kudos
Message 10 of 11
(1,731 Views)