pcbway




Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motorHello everyone! I hope you all will be absolutely fine and having fun. Today, I am going to share my knowledge with all of you guys, about how to make a simple Virtual Instrument (VI) for DC Motor Speed Control in LabVIEW. In my previous tutorials, I have worked on DC Motor Speed Control using Arduino, in which I have controlled the DC Motor Speed using Arduino and after that I made some advancements in it and then created DC Motor Speed Control in Matlab in which commands were sent from Matlab. So, now we are gonna do the DC Motor Speed Control in LabVIEW.If you are working on DC Motor then you should also have a look at DC Motor Direction Control using Arduino.

In this tutorial, I am going to work on the program for DC Motor speed Control using NI LabVIEW. So, before going into the detail of this tutorial, you must go through my previous tutorials because I am going to use the same hardware setup and Arduino source code with a bit modification. I will made a simple GUI (Graphical User Interface) for DC 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.

DC Motor Speed Control in LabVIEW

In the tutorial DC 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 DC motor as well as accelerating and deacelerating 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 DC Motor Speed Control in LabVIEW here:

 LabVIEW Simulation

  • Download .rar file, extract the files from the folder and enjoy the complete DC Motor Speed Control in LabVIEW simulation.
Flow Chart
  • First of all I would like you to explain the algorithm of DC Motor Speed Control in LabVIEW with the help of a flow chart.
  • Flow chart for this project is shown in the figure below.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • The figure given above can help you to understand the entire algorithm for DC Motor Speed Control in LabVIEW.
Block Diagram
  • You can see the assembling of all the components used in DC Motor Speed Control in LabVIEW, in the block diagram.
  • Block diagram for this particular tutorial is shown in the figure below.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • Initially commands are exchanged from NI LabVIEW to the Arduino using serial communication.
  • Then Arduino transfers these commands to L98 motor controller, hence in this way the DC motor.
  • LCD displays the executed commands.
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.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • 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.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • 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.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • 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.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • Place all the above blocks in a way shown in the figure below.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • Now, go to the Functions-> Programming-> Structures-> Flat Sequence.
  • Flat sequence block is encircled and is shown in the figure below.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • Put your cursor and go to Add Frame After.
  • Similarly ad another case after this as shown in the figures below.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • Newly added frame is shown in the figure below.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • 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.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • Make the connections as shown in the figure below.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • 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.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • Select the Case Structure block and place it on the block diagram window.
  • The figure shown below displays the above step.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • 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.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • Now, go to Functions-> Programming-> Structures and you can see different structures blocks there.
  • Choose the encircled block as shown in the figure below.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • 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.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • 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.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • 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.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • 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.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • 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,Stop Motor, Accelerate and Deaccelerate.
  • All of the above steps are explained visually in the figure shown below.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • 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.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • 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.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • Now add another case structure to start the program when you want so.
  • The figure below shows the newly added case structure.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • Now, go to the Front Panel, the button encircled in the figure shown below is used to start the program when needed.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • 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.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • A complete NI LabVIEW Virtual Instrument (VI) is shown in the figure below.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • 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.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • Go to Controls, Modern-> Decorations you can see different decoration blocks there.
  • All these blocks are shown in the figure displayed below.

Dc Motor speed control using NI LabVIEW, DC motor speed control in LabVIEW, DC motor speed control via NI LabVIEW, How to control speed of the DC motor in LabVIEW, NI LabVIEW to control the speed of the DC motor

  • 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 tools.

That is all from the tutorial DC Motor Speed Control in LabVIEW. I hope you enjoyed this tutorial. 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 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment