LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to control on the movement of stepper motor in Labvie

Hello everyone, 

I want to control on a valve which is run by stepper motor. I am using labview 2015. the stepper motor is controlled by sending digital signals from CompactDAQ. it is six wires, two wires for power taking power from the feed of the valve and four wires are for control of movement. I am not good in Labview and dont have much knowldge about stepper motor, but this part of my project and I have to do. 

I want the labview send signls to the motor and when the motor finish movment in one direction stop sending signals.ie within a range.

how can I know the exact number of steps in the stepper motor as I noticed it move for 6.5 revelutions and stop. the datasheet of the stepper motor attached below.

secondly, when I run the program, how can I make the program knows the initial position of the stepper motor.

please give your opinion and help me to solve these issues.

thank you

Jawad

0 Kudos
Message 1 of 6
(4,052 Views)

@JAWADMURDOCH wrote:

I am not good in Labview and dont have much knowldge about stepper motor, but this part of my project and I have to do. 

 


It seems, to me, you have two logical choices:  spend the time (perhaps finding a Guru to mentor you) and get up to speed in LabVIEW and get knowledge about stepper motors, how they work, how to control them, how to read position, etc., or hire someone with these skills.

 

Bob Schor

Message 2 of 6
(3,998 Views)

Thanks Bob, I am student and I'm doing my final project. I know how to work on Labview but not that good. My supervisor doesnt help me and everything I have to do it myself. 

What I need now, how to make a code in labview to stop sending signal to the stepper motor when the stepper motor finish its rotations.

Thanks

Jawad

0 Kudos
Message 3 of 6
(3,974 Views)

Jawad,

 

     I, personally, find it very frustrating that schools provide LabVIEW to their students but spend almost no effort in teaching it, so there are students, such as yourself, who know about LabVIEW, who have tried to teach themselves LabVIEW, but who have no faculty guidance and don't learn how to design with LabVIEW.  Too many faculty members say "Oh, LabVIEW is so easy, why should anyone teach it?".

 

     Your project is tailor-made for a version of a Queued State Machine, or possibly a Queued Message Handler (which is a Queued State Machine that allows data to be passed into the State Machine).  Here's the basic Idea -- you have a device (let's call it a Stepper Motor) that you want to control.  You may have a Start Movement button, a Velocity dial, a Start Position dial, an End Position dial, a Stop Movement button, perhaps a few others.  Once "things are moving", you want to Check Position every so often (let's say every Delta-t milliseconds).

 

     What "States" are important for your motor?  Well, Start Movement, certainly.  Set Velocity.  Stop Movement.  Check Position.  Maybe Initialize System.  Maybe Handle Errors.  Maybe Shutdown and Exit.

 

     A State Machine (in LabVIEW) is a While Loop inside of which there is a Case Statement being "fed" with a "State" to do a particular set of instructions (usually taking very little time) and, depending on design and circumstances, setting up to do the next instruction in the series.  Here's how it might work:

 

  • You start with Initialize System (which sets Shift Registers, perhaps starts DAQmx, generally gets ready).
  • User pushes "Start Movement" button on Front Panel which causes State Machine to be given the Start Movement command.  When State Machine finishes Start Movement, it gives itself the Check Position command (somehow incorporating the Delta-t wait).
  • Check Position can (if you've reached the final end point) give the Stop Movement command, as can the Front Panel Stop Movement button.

I hope you've had enough LabVIEW experience to recognize that you handle the Front Panel interactions using an Event Structure inside a While loop.

 

To help you get started, download the JKI State Machine, which comes with tutorials, examples, etc.  There are many ways to design State Machines, but this is one that works, has explanations, examples, and should be easy to adapt to your situation.

 

Bob Schor

Message 4 of 6
(3,959 Views)

Thank you Bob Schor so much. I am really appreciat your help and detailed explain. I am rearly solved the problem of stepper motors, but I didnt use  a state machine. I did experiment the the motors by calculated the values that go to motors until it stop.

now I move to design a control on the movement of these motors which run a valve to control a flow and temperature. the system is two inputs flow of water and the temperature of the water. the output the signals which go to valves. I want to design MPC controller in LabVIEW. I went through the examples in labVIEW and I read the control and simulation manual. the examples are only for simulation.

if I want to implement MPC in real-time, do I have to simulate the sistem along with real time implementation or it depents if I like to do simulation separately. it confussing to me is it necessary to find the model of the system and convert to state space?

Thank you  for any advice.

0 Kudos
Message 5 of 6
(3,898 Views)

See my response to your new post -- learn Control Theory (on your own time).

 

Bob Schor

0 Kudos
Message 6 of 6
(3,882 Views)