Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
Hello everyone! I hope you all will be absolutely fine and having fun. Today, I am going to share my knowledge about how to make a simple Virtual Instrument (VI) for Stepper Motor Speed Control in LabVIEW. In my previous tutorials, I have worked on Stepper Motor Speed Control using Arduino in which I have shown how to control the stepper motor speed using Arduino. Today, I am going to share a new tutorial in which I am gonna do the Stepper Motor Speed Control in LabVIEW. Moreover, you should also have a look at Stepper Motor Speed Control in Matlab, where I am sending stepper motor speed control commands from MATLAB. In this tutorial, I am going to work on the program for Stepper Motor speed Control using NI LabVIEW. So, before going into the details of this tutorial, you must go through my previous tutorials because I am going to use the same hardware setup and same Arduino source code as well. I will made a simple GUI (Graphical User Interface) for Stepper Motor Speed Control in LabVIEW. There will be five different buttons on the GUI for clockwise rotation, counter clockwise rotation, stopping  the stepper motor, accelerating and deaccelerating the stepper motor respectively.

Stepper Motor Speed Control in LabVIEW

In the tutorial Stepper Motor Speed Control in LabVIEW, I will explain you a complete step by step procedure to control the clockwise and counter clockwise direction of the stepper motor as well as accelerating and decelerating it with the help of the buttons on the GUI created in NI LabVIEW using serial communication between Arduino and NI LabVIEW.
  • You can download the complete simulation for Stepper Motor Speed Control in LabVIEW by clicking below button:

 Download LabVIEW Simulation

  • Download .rar file, extract the files from the folder and enjoy the complete simulation for Stepper Motor Speed Control in LabVIEW.
Block Diagram
  • First of all I would like to explain you the algorithm for Stepper Motor Speed Control in LabVIEW with the help of block diagram.
  • Block diagram for this project is shown in the figure below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • We send commands from the NI LabVIEW through the serial port i.e. NI LabVIEW serially communicates with the Arduino to control the speed of the stepper motor.
  • Arduino sends commands to the L298 motor controller and it decides what to do after manipulating the different commands from Arduino.
  • Executed commands are also printed on LCD (Liquid Crystal Diode).
Vitual Instrument's (VI's) Description
  • First of all open NI LabVIEW software on your laptop or PC.
  • Go to the Block Diagram window and Right Click on it.
  • Go to Functions-> Instrument I/O-> Serial and you can see different serial blocks like VISA Write, VISA Read, VISA Serial etc.
  • Choose the encircled VISA Configure Serial Port and place it on the Block Diagram window.
  • VISA Configure Serial Port block will help us to open the Serial Port before executing the algorithm.
  • The screen shot of the Block Diagram is shown in the figure below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Go to the first input terminal of the VISA Configure Serial Port block and go to Create-> Control.
  • Above step will be helpful to select the COM port of the Arduino board in order to run the program properly.
  • Updated Block Diagram window is shown in the figure below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Now go to Functions-> Instrument I/O-> Serial, you can see there different serial blocks.
  • Choose the encircled VISA Close block and place it on the Block Diagram window.
  • The VISA Close block is shown in the figure below and it will be help in closing the Serial Port if needed.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Now, go to the Functions-> Programming-> Structures and you can see the different structures there like For Loop, While Loop, Case Structure etc.
  • Choose the encircled block as shown i the figure below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Place all the above blocks in a way shown in the figure below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Now, go to the Functions-> Programming-> Structures-> Flat Sequence.
  • Flat sequence block is encircled and is shown in the figure below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Put your cursor and go to Add Frame After.
  • Similarly ad another case after this as shown in the figures below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor speed with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Newly added frame is shown in the figure below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Now, go to Functions-> Instrument I/O-> Serial, you can see different serial blocks there.
  • Choose the encircled VISA Write Block and place it on the Block diagram window.
  • The figure shown below elaborates the above steps.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Make the connections as shown in the figure below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Now, go the Functions-> Programming-> Structures and you can see different types of structures like for loop, while loop, flat sequence etc.
  • Choose he encircled block as shown in the figure below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Select the Case Structure block and place it on the block diagram window.
  • The figure shown below displays the above step.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Now, go to the input terminal of the write block and go to Create-> Control.
  • Change the name of this  block to Command box as shown in the figure below.
  • The block diagram window is shown in the figure below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Now, go to Functions-> Programming-> Structures and you can see different structures blocks there.
  • Choose the encircled block as shown in the figure below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Select the Local Variable Block and place it on the Front Panel.
  • Right click on it and select Command box as shown in the figure below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Go to the input terminal of this local variable and go to Create-> Constant.
  • Place inside that constant.
  • The figure below elaborates the above step.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • The above case structure is for the clock wise rotation of the stepper motor.
  • Similarly make four further case structures for counter clockwise rotation, accelerating, de-accelerating and stopping the rotation of the stepper motor.
  • All the three case structures are shown in the figure below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • You can see three different case structures in above figure.
  • The command box variable having command will rotate the stepper motor in clockwise direction.
  • A command box variable having command will rotate the stepper motor in counter clockwise direction.
  • The command box variable having command will rotate the stepper motor at higher and higher speed if it is rotating with a lower speed.
  • A command box variable having command will rotate the stepper motor with slower and slower speed if it is rotating at a higher speed.
  • .
  • The command box variable having command will stop the rotation of the stepper motor.
  • Now, go to the Front Panel and Right Click on it.
  • Go to Controls-> Modern-> Boolean and you can see there different Boolean blocks.
  • Choose the encircled block as shown in the figure below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Select the Round LED block and place it on the front panel.
  • Similarly select two more round LED blocks and place them on the front panel as well.
  • Change their names from default to Clockwise, Anti clockwise and  Stop Motor.
  • All of the above steps are explained visually in the figure shown below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • The LED shown in the above figure will control the stepper motor on clock wise, counter clock wise direction and will stop the motor as well.
  • Now go to the block diagram window and connect these blocks as shown in the figure below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • At the end, after sending all the commands we must need to close the serial port so that unnecessary exchange of commands could be avoided.
  • So I have cleared the all the commands in third frame of the case structure i.e I am sending no commands through the serial port.
  • This will be helpful in closing the serial port.
  • The figure show below explains all of the above steps visually.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Now add another case structure to start the program when you want so.
  • The figure below shows the newly added case structure.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Now, go to the Front Panel, the button encircled in the figure shown below is used to start the program when needed.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Now add a Stop button in order to terminate the program whenever you want so.
  • The complete output of the program is shown in the figure below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • A complete NI LabVIEW Virtual Instrument (VI) is shown in the figure below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • I have decorated the front panel to make it attractive for the users.
  • The final look of the Front panel is shown in the figure below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • Go to Controls, Modern-> Decorations you can see different decoration blocks there.
  • All these blocks are shown in the figure displayed below.
Stepper Motor speed control using NI LabVIEW, Stepper motor speed control using LabVIEW, stepper motor speed control with LabVIEW, How to control Stepper motor with LabVIEW, Stepper motor control with the LabVIEW, Stepper motor control in LabVIEW
  • I have used three decoration blocks encircled with the blue color, to decorate my program.
  • Red boundary shows all of the decoration blocks to make your program attractive.
  • You can also decorate your programs using this amazing tool.
That is all from the tutorial Stepper Motor Speed Control in LabVIEW. I hope you enjoyed this tutorial on Stepper Motor Speed Control in LabVIEW. If you face any sort of problem you can ask me anytime without even feeling any kind of hesitation. I will try my level best to solve your issues in some better way, if possible. I will explore NI LabVIEW, will make different projects on it and will share them with all of you as well. Till then, Take care :)