Stepper Motor Projects
Hello everyone! I hope you all will be absolutely fine and having fun. Today, I am going to share a list of
Stepper Motor Projects using different software e.g. Arduino, Matlab and NI LabVIEW. I have already shared these projects but they are posted randomly. So, today I thought that I should combine all those projects into a single one. So I am going to share the links of all of those tutorials in this tutorial so that it may be helpful for engineering students or anyone who wants to visit. This tutorial will help you to visit all of my Stepper Motor Projects. You should also have a look at this Stepper Motor Simulation in Proteus.
The links of all the tutorials will be given and you will be able to download the desired project code or simulation from the corresponding link. I will make separate sections for each software to control stepper motor. In each section all the possible controls of stepper motor will be given in detail. If you have any sort of problem, you can ask in comments. I will try my level best to solve your issues. So, let's get started with Stepper Motor Projects. first of all, I will post projects i which I have done direction control of stepper motor:
Stepper Motor Projects
In this section of Stepper Motor Projects, I will provide you the list of the tutorials in which I have already controlled the direction of the stepper motor using three different software e.g. Arduino, Matlab and NI LabVIEW. I have used the same hardware and Arduino source code in all of these tutorials. In case of Matlab and NI LabVIEW I have sent commands through the serial monitor towards Arduino and hence the whole system works.
Stepper Motor Direction Control using Arduino
In the tutorial Stepper Motor Direction Control using
Arduino, I have interfaced a stepper motor with Arduino UNO board to control its clockwise and counter clockwise direction. I have used a motor controller named as H-Bdridge to control the direction of stepper motor. It can control only one stepper motor at a time.. The algorithm was very simple. Commands for clockwise and counter clockwise rotation are sent through the serial monitor of Arduino softwrare.
These commands are then passed to the motor controller and then it decides the direction of rotation of stepper motor after manipulating the Arduino commands. Direction of stepper motor can be reversed by simply changing the polarity so L298 controls the direction of the stepper motor by continuously making its pins low, high and vice versa.
- You can download the complete simulation there.
- Download .rar file, extract it and enjoy the complete simulation:
Stepper Motor Direction Control Using Arduino
Stepper Motor Direction Control using Matlab
In the tutorial Stepper Motor Direction Control in
Matlab, I have created a simple Graphical User interface (GUI) in Matlab having three different buttons for controlling the clockwise, counter clockwise direction of the stepper motor and to stop the stepper motor as well. Two more buttons are also there on the GUI for opening and closing the serial port.
As we press any of the buttons, corresponding command is sent through the serial port from Matlab to Arduino and then Arduino transfers those commands to the H Bridge and hence the entire process gets completed. Pressing the Open Serial Port button, serial port will be opened and we will be able to communicate with the Arduino using serial communication and at the end we must close the serial port in order to avoid the exchange of unnecessary commands being sent through the serial port.
- You can download the complete simulation here.
- Download .rar file, extract it and start playing with the simulation.
Stepper Motor Direction Control Using MATLAB
Stepper Motor Direction Control using NI LabVIEW
In the tutorial Stepper Motor Direction is Controlled in
NI LabVIEW, I have controlled the clockwise and counter clockwise direction of the stepper motor using serial communication between NI LabVIEW and Arduino. Commands like
C, S and
A are sent through NI LabVIEW towards Arduino for clockwise rotation of the stepper motor, stop the stepper motor and anti clockwise rotation of the same stepper motor respectively.
There are three different buttons on the front panel of NI LabVIEW. These buttons are used to send commands
C, S and
A from NI LabVIEW to Arduino using Serial communication.
- You can download the complete simulation here.
- Download .rar file, extract it and start playing with the simulation.
Stepper Motor Direction Control in LabVIEW
Stepper Motor Direction Control using PIC Microcontroller
First of all I have made
Stepper Motor Drive Circuit in Proteus ISIS and I have controlled the speed angle as well as the direction of the stepper motor using PIC micro controller. I have made a pretty simple logic. I have placed a serial terminal in my Proteus simulation. You have to sent the commands through that serial terminal. The stepper motor will change its direction as well the speed after manipulating those commands.
- You can download the complete simulation here.
- Download .rar file, extract it and start playing with the simulation.
Stepper Motor Direction Control using PIC Microcontroller
Stepper Motor Speed Control
In this section of Stepper Motor Projects, I will provide you the list of the tutorials in which I have already controlled the speed of the stepper motor using three different software e.g. Arduino, Matlab and NI LabVIEW. I have used the same hardware and Arduino source code in all of these tutorials. In case of
MATLAB and
NI LabVIEW I have sent commands through the serial monitor towards Arduino and hence the whole system works.
Stepper Motor Speed Control using Arduino
In Stepper Motor Speed Control using Arduino, I have actually used the builtin command
myStepper.step to control the speed for the stepper motor. For this purpose, I have not used PWM pins of L298 motor controller instead I only used input pins of it, to control the speed of the stepper motor. By assigning higher values to the myStepper.step motor can be rotated at higher speed. Similarly motor will rotate slowly if the value of myStepper.step is lower.
All the executed commands are printed on the serial monitor and I have also printed those executed commands on LCD as well for this project.
- You can download the complete Arduino Source code here.
- Download .rar file, extract it and start playing with the simulation.
Stepper Motor Speed Control using Arduino
Stepper Motor Speed Control in Matlab
In Stepper Motor Speed Control in Matlab, I have created a Graphical User Interface (GUI) in Matlab having two extra buttons as compared to the GUI of Stepper Motor Direction Control in Matlab. One for continuously accelerating the speed of the stepper motor and the other for continuously deaccelerating the speed of the same stepper motor.
As we press any button, corresponding command will be sent through the serial port from Matlab to Arduino using serial communication. The logic created is pretty simple, the speed of the motor will accelerate continuously as many time we press the button and if the maximum speed is reached, motor maintains the same speed even we continue to enhance its speed. Same procedure will be followed to reduce the speed of the stepper motor.
- You can download the complete simulation here.
- Download .rar file, extract it and start playing with the simulation.
Stepper Motor Speed Control using MATLAB
Stepper Motor Speed Control using NI LabVIEW
This one is the last one among Stepper Motor Projects, named as Stepper Motor Speed Control in NI LabVIEW, I have have placed five different buttons on the front panel to control the direction as well as the speed of the DC motor. By pressing the
Accelerate button again and again speed of the stepper motor will increase in proportion to the number of times the buttons is pressed.
Similarly, by pressing
Deaccelerate button again and again the speed of the stepper motor will decrease in proportion to the number of times the button is pressed. First of all you need to press the
Start button in order to start the serial communication between NI LabVIEW and Arduino. After pressing it you will be able to send the commands serially from NI LabVIEW towards Arduino.
- You can download the complete simulation here.
- Download .rar file, extract it and start playing with the simulation.
Stepper Motor Speed Control using LabVIEW
These are all
Stepper Motor Projects posted yet on our blog. I hope you all 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 issue in a better way, if possible. I will explore Arduino, Matlab and NI LabVIEW further in my later tutorials. Till then, Take care :)
How to Clear MATLAB Windows
Hello 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 Clear MATLAB Windows. If the command window and workspace window are not clear they present a very complicated look and hence the user feel it difficult to write code on command window. Here, I have compiled a list of awesome
MATLAB Image Processing Projects so must check them out to get some inspiration. :)
So, for the ease of the user we need to clear the both window specially the command window because it contains the entire code for any of the task. Before going into the details of this tutorial, you should go through
Introduction to MATLAB and
Declaration of Variables in MATLAB for the better understanding of this tutorial. If we want to avoid the complications while writing the code on command window we must need to clear the both command window as well as the workspace window. If you don't wanna work on Command Windows then you should have a look at
How to Create m File in MATLAB. Anyways, in today's tutorial we are gonna have a look at matlab clear command window and its quite easy but I must say its quite handy, especially when you are working on some complex MATLAB Project.. So, now let's get started with today's tutorial and have a look at How to Clear
MATLAB Windows:
How to Clear MATLAB Windows ???
In the tutorial,
Clearing MATLAB Windows I will show that which commands are required to use to clear the command window and workspace window In order to avoid the complications for the user while writing the source code on the command window.
- The commands for clearing the command window and workspace window are shown below.
- clear all (used to clear the workspace window)
- clc (used to clear the entire command window)
- The command window with some of the commands written on it is shown in the figure below.
- The workspace window having some of the variables is shown in the figure below.
Clearing both the Windows
- First of all I will show you that how to clear the workspace window.
- Go to the command window and write the command clear all and press
- All of the above steps are shown in the figure below.
- You will see that all the variables from the workspace window has been removed.
- The cleared workspace window is shown in the figure below.
- Now go to the command window and write the command clc on it.
- The command written on the command window is shown in the figure below.
- If you press Enter after writing the command show in the figure above, on the command, you will see that the command window has be cleared.
- The empty command window is shown in the figure below.
- So, by clearing both of these window a user can easily make an algorithm without any complication.
- You should also have a look at this video tutorial as well:
That is all from the tutorial, Clearing Command Window and Workspace in
MATLAB. I hope you enjoyed this tutorial. If you face any sort of problem in clear command window matlab, you can ask me in comments anytime without even feeling any kind of hesitation. I will try my level best to solve your issues in a better way, if possible. In my next tutorial I will explain you that how to Calculate the Values of the Trigonometric Functions in MATLAB. I will explore MATLAB further in my later tutorials and will share all of them with all of you as well. So, till then, Take Care :)
Creating First Program with myRIO
Hello everyone! I hope you all will be absolutely fine and having fun. Today, I am going to share my knowledge about
Creating First Program with myRIO. Before doing anything on NI myRIO you must know that how to configure this device. So, before going into the details of this tutorial I would like to suggest you to must visit
Getting Started with myRIO and
How to Configure myRIO on WiFi for the better understanding of this tutorial.
NI myRIO is an amazing processing tool that has a very high processing speed as compared to other microcontroller e.g. Arduino, raspberry pi, gellilio etc. So, it can be used for the real time projects where there is need to respond very quickly according to the assigned tasks. NI myRIO was launched by National Instrument. It has different models. In this tutorial I am going to use NI myRIO. This module has a built-in Wifi as well as USB cable supported. The device has its own IP address which helps while configuring it. If we want tmo connect it over internet then the IP address changes to access the device online. It operates on 667MHz. It’s a fully secured device with a strong casing around the circuitry. There are on board four LED lights on NI myRIO for the configuration test, whether the device is properly attached to the computer or not.
Creating First Program with myRIO
Here, in the tutorial
Creating First Program with myRIO, I will tell you the step by step procedure for creating your first program using NI myRIO. The tutorials basically focuses on controlling an LED on Front Panel with the help of the on board button on the device.
- You can download the complete Virtual Instrument (VI) for controlling LED using on board button here by clicking on the button below.
- Download .rar file, extract it and enjoy the LabVIEW NI myRIO’s simulation.
Virtual Instrument (VI) Creation
- First of all open the NI LabVIEW software from the softwares list.
- The starting window of the software is shown in the figure below.
- You can see a lot of options on the starting window having different individual functions.
- Now, click on the encircled button Create Project.
- As you press this button a new window will be appeared on your computer screen.
- The new window with multiple options is shown in the figure below.
- Go to the myRIO option as shown in the figure below.
- While clicking on myRIO option, you can see the display on the right side will change by doing so.
- Select the myRIO Project from the right portion of the window.
- The both of the above steps are shown in the figure below.
- Now, press the Next button as shown in the figure below.
- Just after pressing this button you will be able to see a new window on your computer’s screen.
- Select the Plugged into USB option and press Refresh button, your attached myRIO device will be detected in this way.
- IP address of the used NI myRIO is encircled in the below figure as 22. 11.2.
- The newly opened window with a bit detail is shown in the figure below.
- The destination of the file which is being created is shown in the figure below.
- Now, press the Finish button as highlighted in the figure shown below.
- As you press this button a new window will again appear on your computer’s screen.
- Go to the Medical Kit (172.22.11.2) as encircled in the figure below.
- The new window appeared with all of the above steps is shown in the figure below.
- Now go to the Medical Kit option and Right Click on it.
- By doing so, you can see a lot of options here in the new mini window, go to New-> VI.
- The above steps are shown in the figure given below.
- As u press the VI two windows, Front Panel and Block Diagram will be appeared on your computer’s screen.
- Both the windows are shown in the figure below.
- Now, press Ctrl+t, both of the windows will be aligned in this way.
- Now go to the Block Digram window and Right Click on it.
- Go to the Functions-> Programming-> Structures here you can see different structures blocks.
- Select the While Loop as encircled in the figure shown below.
- Select this block and place it on the Block Diagram window as shown I the figure below.
- Now, go to the Functions-> Programming-> Structures once again.
- Select the Flat Sequence and place it around the While Loop.
- Now put your cursor on the right side of the Flat Sequence and Right Click on it.
- Go to the Add Frame After as shown in the figure below.
- Now, Right Click on the Block Diagram window and go to Functions-> myRIO-> Device Management, here you can see the two different management blocks.
- Select the encircled block Reset myRIO as shown in the figure below.
- Place the encircled block Reset myRIO inside the second frame of the Flat Sequence.
- Now go to the Functions-> myRIO and here you can see the different myRIO blocks.
- Select the encircled block Button as shown in the figure below.
- Place Button inside the While Loop.
- As you place the button a new window will be appeared on your screen.
- New window is shown in the figure below, just press Ok as shown below.
- All of the above steps are shown in the figure below.
- Now go the Functions-> Programming-> Structures, here you can see the different structure blocks.
- Select the encircled block Case Structure as shown in the figure below.
- Now go to the Functions-> myRIO, here you will see a lot of myRIO blocks.
- Select the encircled block LED as shown in the figure below.
- Select the encircled block and place it inside the Case Structure.
- As you place the LED in the Case Structure a new window will be appeared on the screen, just press Ok.
- The figure shown below exhibits the above steps.
- Now to the First input terminal of the LED and Right Click on it and go to Create-> Constant.
- By doing so, four inputs will be added to the LED.
- The above step is shown in the figure below.
- And change the condition from False to the True e.g. F to
- The figure shown below exhibits the above step.
- Now copy the entire code inside the Case Structure and go to the False Option.
- Paste the copied code inside the False Option and change the condition from True to False i.e. form T to
- The above step is shown in the figure below.
- Now go to the bottom right of the While Loop and go to Create-> Control as shown in the figure below.
- Now go to output terminal of the Button right click on it.
- Go to the Create-> Indicator as shown in the figure below.
- By doing so, a new indicator will be added on the block diagram window to show the state of the button i.e. whether it is pressed or not.
- The above step is exhibited in the figure below.
- Now run the program and the code will be started to upload on the NI myRIO.
- The uploading in process is shown in the figure below.
- The Front Panel is shown in the figure below.
- Now if you press the button on the myRIO the Green LED on the Front Panel will be turned on.
- The figure shown below exhibits the above step.
- The ON state of the LED shows that the button on the myRIO is pressed.
So, that is all from the tutorial Creating First Program with myRIO. I hope you enjoyed this first project with myRIO. You should also have a look at these
LabView Projects. If you find any sort of problem, you can ask in comments anytime without even feeling any kind of hesitation. I will try my level best to solve your issues in a better way, if possible. In my next tutorial I will elaborate that how to control the servo motor using NI LabVIEW and NI myRIO. I will further explore NI LabVIEW and NI myRIO in my later tutorials. So, till then, Take Care :)
How to Create m File in MATLAB
Hello everyone! I hope you all will be absolutely fine and having fun. Today, I am going to share my knowledge about
How to Create m File in MATLAB. It is also known as
New Script or
Editor in the MATLAB. It's an amazing MATLAB tool. We can write the complete source code on editor. If we want to visualize the result of the particular statement we should not put a semicolon after that statement in MATLAB. Before going into the details of this tutorial, you must first have a look at
Introduction to MATLAB and if you don't know about MATLAB variables then you must read
Declaration of Variables in MATLAB.
By doing this and by pressing the
Run (Green Color) button at the top of the editor we will be able to see the result on the command window. In other words, we have to write the entire source code in the editor and to run the program and the desired results will be displayed on the command window. It is easy to do so as compared to write and manipulate every single statement on command window.
How to Create m File in MATLAB ???
Here, in the tutorial
How to Create m File in MATLAB, I will show you the step by step procedure to create an m file in MATLAB first and then to observe the desired results on command window.
- First of all you need to open your MATLAB software.
- Go to the top left corner of the front window of the MATLAB and click on New Script.
- The above steps are shown in the figure below.
- A new window will be appeared on your screen right after clicking on the New Script.
- The second window appeared on the screen is shown in the figure below and it is also known as an Editor.
- A very simple code written on the editor by declaring three different kinds of variables and their manipulation is shown in the figure below.
- Now, if you want to observe the result on the command window you have to do two things.
- The first thing is to remove the semicolon at the end of the statement as shown in the figure above.
- And the second thing is to press Run button encircled in the figure shown above.
- After following all of the above steps you will be able to visualize the results on the command window of the amazing software i.e. MATLAB.
- The result observed on the command window is shown in the figure below.
- You can see the result is obtained in the form of an equation.
- That was the detailed discussion on Creating m.file in MATLAB.
So, that is all from the tutorial Creating m.file in MATLAB. I hope you enjoyed this tutorial. If you face any sort of problem you can ask me in comments anytime without even feeling any kind of hesitation. I will try my level best to solve your issues in a better way, if possible. In my next tutorial I will explain you that how to Calculate the Values of the Trigonometric Functions in MATLAB. I will explore MATLAB further in my later tutorials and will share all of them with all of you as well. So, till then, Take Care :)
DC Motor Projects
Hello everyone! I hope you all will be absolutely fine and having fun. Today, I am going to share a list of tutorials on
DC Motor Projects using different software e.g. Arduino,
Matlab and NI LabVIEW. I have already shared these tutorials but they are posted randomly. So, today I thought that I should combine all those tutorials into a single one. So I am going to share the links of all of those tutorials in this tutorial so that it may be helpful for engineering students or anyone who wants to visit. This tutorial will help you to visit all of my tutorials related to DC motor control.
The links of all the tutorials will be given and you will be able to download the desired tutorial from the corresponding link. I will make separate sections for each software to control DC motor. In each section all the possible controls of DC motor will be given in detail. If you have any sort of problem, you can ask in comments. I will try my level best to solve your issues. In today's tutorial, I have simply combined all the DC Motor Projects posted on our blog. I will update this list in future. So, let's get started with
DC Motor Projects:
DC Motor Direction Control - DC Motor Projects
In this section of DC Motor Projects, I will provide you the list of the tutorials in which I have already controlled the direction of the DC motor using three different software e.g.
Arduino, Matlab and NI LabVIEW. I have used the same hardware and Arduino source code in all of these tutorials. In case of Matlab and NI LabVIEW I have sent commands through the serial monitor towards Arduino and hence the whole system works. So, let's get started with these DC Motor Projects:
1- DC Motor Direction Control using Arduino
In the tutorial DC Motor Direction Control using Arduino, I have interfaced a DC motor with Arduino UNO board to control its clockwise and counter clockwise direction. I have used a motor controller named as H-Bridge to control the direction of DC motor. It can simultaneously control two DC motors. The algorithm was very simple. Commands for clockwise and counter clockwise rotation are sent through the serial monitor of Arduino software. Its one of the basic DC Motor Projects.
These commands are then passed to the motor controller and then it decides the direction of rotation of DC motor after manipulating the Arduino commands. Direction of DC motor can be reversed by simply changing the polarity so L298 controls the direction of the DC motor by continuously making its pins low, high and vice versa.
- I have posted a detailed tutorial on DC Motor Direction Control using Arduino.
- You can read that tutorial and download the complete simulation & code by clicking the below button:
Download DC Motor Direction Control Arduino Source Code
2- DC Motor Direction Control using Matlab
In this DC Motor Project, I have done the DC Motor Direction Control in Matlab, I have created a simple Graphical User interface (GUI) in Matlab having three different buttons for controlling the clockwise, counter clockwise direction of the Dc motor and to stop the DC motor as well. Two more buttons are also there on the GUI for opening and closing the serial port.
As we press any of the buttons, corresponding command is sent through the serial port from Matlab to Arduino and then Arduino transfers those commands to the H Bridge and hence the entire process gets completed. Pressing the Open Serial Port button, serial port will be opened and we will be able to communicate with the Arduino using serial communication and at the end we must close the serial port in order to avoid the exchange of unnecessary commands being sent through the serial port.
- You can download the complete simulation here.
- Download .rar file, extract it and start playing with the simulation. I hope you have enjoyed this DC Motor Project.
Download DC Motor Direction Control Matlab Simulation
3- DC Motor Direction Control using NI LabVIEW
In the tutorial DC Motor Direction Control in NI LabVIEW, I have controlled the clockwise and counter clockwise direction of the DC motor using serial communication between NI LabVIEW and Arduino. Commands like
C, S and
A are sent through NI LabVIEW towards Arduino for clockwise rotation of the DC motor, stop the DC motor and anti clockwise rotation of the same DC motor respectively.
There are three different buttons on the front panel of NI LabVIEW. These buttons are used to send commands
C, S and
A from NI LabVIEW to Arduino using Serial communication.
- You can download the complete simulation here.
- Download .rar file, extract it and start playing with the simulation.
Download DC Motor Direction Control LabVIEW Simulation
4- DC Motor Direction Control with Arduino in Proteus
In the tutorial, DC Motor Direction Control with Arduino in Proteus, I have designed a complete simulation in Proteus, which will help you in understanding the controlling of DC motor. I have designed
DC Motor Drive Circuit in Proteus ISIS. for the DC Motor Direction Control.
I have provided the complete simulation and the source code for DC Motor Direction Control in Proteus but I would recommend you to design it on your own, it would be better for you. So, when you send the character
C on serial terminal then the motor will rotate in clockwise direction and when the character sent through the serial terminal is
A, the motor will rotate in counter clockwise direction and will stop when the character
S is sent.
- You can download the complete simulation here.
- Download .rar file, extract it and start playing with the simulation.
Download DC Motor Direction Control Proteus Simulation
DC Motor Speed Control - DC Motor Projects
In this section of DC Motor Projects, I will provide you the list of the tutorials in which I have already controlled the speed of the DC motor using three different software e.g. Arduino, Matlab and NI LabVIEW. I have used the same hardware and Arduino source code in all of these tutorials. In case of Matlab and NI LabVIEW I have sent commands through the serial monitor towards Arduino and hence the whole system works. So, let's get started with these DC Motor Projects:
1- DC Motor Speed Control using Arduino
In DC Motor Speed Control using Arduino, I have actually used the concept of Pulse Width Modulation (PWM). For this purpose, I have used PWM pins EnA and EnB of L298 motor control to control the speed of the DC motor. PWM basically control the electronic pulse duration. When the state of the PWM pins of L298 motor controller is high, the output power will be supplied. I have controlled the speed of the DC motor by turning applied voltage on and off.
Duty cycle is the main factor while controlling the speed of the DC motor. When the duty cycle is long i.e signal is power is supplied for a long time, Dc motor will rotate at fast speed and vice versa. Usually the PWM duty cycle is less than 90%. I have also printed the executed commands on LCD for this project.
- You can download the complete simulation here.
- Download .rar file, extract it and start playing with the simulation.
Download DC Motor Speed Control Arduino Source Code
Note:
2- DC Motor Speed Control in Matlab
In DC Motor Speed Control in Matlab, I have also created a GUI in Matlab having two extra buttons as compared to the GUI of DCMotor Direction Control in Matlab. One for continuously accelerating the speed of the DC motor and the other for continuously deaccelerating the speed of the same motor.
As we press any button, corresponding command will be sent through the serial port from Matlab to Arduino using serial communication. The logic created is pretty simple, the speed of the motor will accelerate continuously as many time we press the button and if the maximum speed is reached, motor maintains the same speed even we continue to enhance its speed. Same procedure will be followed to reduce the speed of the DC motor.
- You can download the complete simulation here.
- Download .rar file, extract it and start playing with the simulation.
Download DC Motor Speed Control Matlab Simulation
3- DC Motor Speed Control using NI LabVIEW
In DC Motor Speed Control in NI LabVIEW, I have have placed five different buttons on the front panel to control the direction as well as the speed of the DC motor. By pressing the
Accelerate button again and again speed of the DC motor will increase in proportion to the number of times the buttons is pressed.
Similarly, by pressing
Deaccelerate button again and again the speed of the DC motor will decrease in proportion to the number of times the button is pressed. First of all you need to press the
Start button in order to start the serial communication between NI LabVIEW and Arduino. After pressing it you will be able to send the commands serially from NI LabVIEW towards Arduino.
- You can download the complete simulation here.
- Download .rar file, extract it and start playing with the simulation.
Download DC Motor Speed Control LabVIEW Simulation
4- DC Motor Speed Control with Arduino in Proteus
In the tutorial DC Motor Speed Control using Arduino in Proteus, I have controlled both the direction as well as the speed of the DC motor. For the direction control of DC motor the functionality remains the same as it was in DC Motor Direction Control with Arduino in Proteus but for the speed control, I have placed an Light Dependent Resistor (LDR) sensor in the simulation and depending on the value of the LDR sensor the speed DC motor will either increase or decrease.
- You can download the complete simulation here.
- Download .rar file, extract it and start playing with the simulation.
Download DC Motor Speed Control Proteus Simultation
This is all from the tutorial DC Motor Projects. I hope you all 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 issue in a better way, if possible. I will explore Arduino, Matlab and NI LabVIEW further in my later tutorials. Till then, Take care :)
Declaration of Variables in MATLAB
Hello everyone! I hope you all will be absolutely fine and having fun. In the tutorial
Declaration of variables in MATLAB, I will elaborate you that how to declare different variables in MATLAB and how to manipulate those variables without assigning them with the values. Before going into the details of this tutorial you must go through
Introduction to MATLAB, because understanding MATLAB first is better. This will help you in better understanding of this tutorial.
Variable declaration is one of the most important and compulsory steps while writing the code to perform any task. Without the declaration of the variables we can not proceed further to perform our task properly. So, if we want to do the different tasks in a proper way we must need to declare the variable before doing anything in the code. Once the variables have been declared, we can proceed further to explore the desired task.
Declaration of Variables in MATLAB
Here, in the tutorial
Declaration of variables in MATLAB, I will show you that how the variables can be declared in the MATLAB and how to manipulate them without assigning them with the values. The command
syms is used to declare the different variables in the
MATLAB.
- Here, I will show you that what happens if you have not declared the variables.
- The error is shown in the figure below, when you have not declared the variables.
- I have written an equation having three different variables named as f,t and r without declaring these variables.
- MATLAB has shown an error on the command window as undefined function or variable.
- So the error shown in the above figure shows the desired results can not be obtained without declaring the variables first.
- Now, I am going to declare all the variables first and will then manipulate them.
- The declared variables are shown in the figure below.
- Since I have declared all of the variables now which are being used in the equation.
- So, now I am going to manipulate them and going to observe the results.
- The result of the addition of the two variables, which is stored in the third variable, is shown in the figure below.
- The above figure shows the result of the addition of the two different variables in the form of an equation.
- The result has been obtained because all of the variables has been declared first, i.e. declaration of variables plays a very important role while writing an algorithm to perform any task either simple or complicated.
- You can also see all of the process in the video given below:
So, that is all from the tutorial Declaration of Variables in
MATLAB. I hope you enjoyed this tutorial. If you find any sort of problems you can ask me in comments without even feeling any kind of hesitation. I will try my level best to solve your issues in a better way, if possible. In my next tutorial I will explain you that how to create an m.file in MATLAB. I will further explore MATLAB in my later tutorials and will share all of them with you as well. So, till then, Take Care :)
Introduction to MATLAB
Hello everyone! I hope you all will be absolutely fine and having fun. In this tutorial, I am going to give you a detailed
Introduction to MATLAB. I will explain in detail, step by step procedure of using
MATLAB for the first time. First of all, I would like to tell you a bit about the MATLAB software. MATLAB basically works on matrices and it is an excellent software for different kinds of simulation based projects as well as hardware based projects and specially, it is good for the
Engineering Projects.
MATLAB can be used for the manipulation purpose in order to obtain the proper results. It is very easy to use this software and most of the students prefer to use this software for their projects. So, this shows that MATLAB is a user friendly software as well. MATLAB has a very wide range of applications. It can also be used for the real time projects. Robotics, image processing and medical related projects are its major applications. You should also have a look at
How to Create GUI in MATLAB. So, let's get started with
Introduction to MATLAB:
Introduction to MATLAB
So, in the Introduction to MATLAB, I will show you the step by step procedure about how to use the MATLAB software for the first time.
- As you open the MATLAB software, a new window will be appeared on your screen.
- The window is shown in the figure below.
- The above window is the starting window which appears on the screen when you open the MATLAB.
- After sometime, you will be able to see another window on the screen.
- The second window is shown in the figure below.
Sections of MATLAB
There are six basic section of the MATLAB and understanding them is essential part of Introduction to MATLAB. The names of all of these sections are given below.
- Current Folder
- Command Window
- Workspace
- Command History
- View or Change Directory
- Help Section
Current Folder is the first section of the MATLAB’s front window at the left side of the window. It displays the files that has already been saved. You can open the files that are already saved somewhere in your PC or laptop.
- The current folder section is shown in the figure below.
Command Window is the second section and is used to show the results of the entire source code. If we want to observe the results on the command window, we must not put a semicolon after the statement then. If there is a semicolon at the end of the statement, result of that statement will not be shown on the command window.
- The command window section is shown in the figure below.
Workspace is the third section of the MATLAB’s front window which shows all the variables that are used while writing the complete algorithm.
- Workspace section is shown in the figure below.
Command History is the fourth and the last section of the MATLAB’s front window. It shows all of the commands that have been used in the entire algorithm.
- The command history section is shown in the figure below.
View or Change Directory helps us to view the directory or the complete destination of the file that is opened in the MATLAB. You can also open a new file by changing its directory.
- Directory box is shown in the figure below.
Help Section is also an amazing tool of the MATLAB. It provides help regarding of the command or any other thing related to MATLAB. By typing the thing which is not clear, you will be able to find a lot of help.
- The button to open the help section is shown in the figure below.
- As you press this button a new named as help will be appeared on your screen to help you.
- The help window is shown in the figure below.
- So that was the brief discussion about how to getting started with the MATLAB.
So, that is all from the tutorial Introduction to MATLAB. I hope you have enjoyed this tutorial. If you find any sort of problem in introduction to matlab, you can ask in comments anytime without even feeling any kind of hesitation. I will try my level best to solve your issues in a better way, if possible. In my next tutorial I will elaborate the
Declaration of Variables in MATLAB and how to manipulate them without assigning them with the values. Moreover, you should also have a look at
How to Create m file in MATLAB. I will further explore MATLAB in my later tutorials. So, till then, Take Care :)
Stepper Motor Speed 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.
- 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.
- 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.
- 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.
- 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.
- Place all the above blocks in a way shown in the figure below.
- Now, go to the Functions-> Programming-> Structures-> Flat Sequence.
- Flat sequence block is encircled and is shown in the figure below.
- Put your cursor and go to Add Frame After.
- Similarly ad another case after this as shown in the figures below.
- Newly added frame is shown in the figure below.
- 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.
- Make the connections as shown in the figure below.
- 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.
- Select the Case Structure block and place it on the block diagram window.
- The figure shown below displays the above step.
- 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.
- Now, go to Functions-> Programming-> Structures and you can see different structures blocks there.
- Choose the encircled block as shown in the figure below.
- 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.
- Go to the input terminal of this local variable and go to Create-> Constant.
- Place C inside that constant.
- The figure below elaborates the above step.
- 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.
- You can see three different case structures in above figure.
- The command box variable having command C will rotate the stepper motor in clockwise direction.
- A command box variable having command A will rotate the stepper motor in counter clockwise direction.
- The command box variable having command H will rotate the stepper motor at higher and higher speed if it is rotating with a lower speed.
- A command box variable having command L will rotate the stepper motor with slower and slower speed if it is rotating at a higher speed.
- .
- The command box variable having command S 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.
- 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.
- 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.
- 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.
- Now add another case structure to start the program when you want so.
- The figure below shows the newly added case structure.
- Now, go to the Front Panel, the button encircled in the figure shown below is used to start the program when needed.
- 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.
- A complete NI LabVIEW Virtual Instrument (VI) is shown in the figure below.
- 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.
- Go to Controls, Modern-> Decorations you can see different decoration blocks there.
- All these blocks are shown in the figure displayed below.
- 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 :)
Stepper Motor Direction 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 Direction Control in LabVIEW. In my previous tutorial, I have worked on
Stepper Motor Direction Control using Arduino, in which I have controlled Stepper Motor Direction Control using Arduino and I am gonna use the same setup but this time I am gonna do the Stepper Motor Direction Control in LabVIEW. Moreover, you should also have a look at
Stepper Motor Direction Control using Matlab.
In this tutorial, I going to work on the program for Stepper Motor Direction Control in 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 Direction Control in LabVIEW. There will be three different buttons on the GUI for clockwise rotation, counter clockwise rotation and stopping the stepper motor respectively.
Stepper Motor Direction Control in LabVIEW
In the tutorial Stepper Motor Direction 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 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 NI LabVIEW simulation here.
- Download .rar file, extract the files from the folder and enjoy the complete NI LabVIEW's simulation:
Download LabVIEW Simulation
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.
- Go to the first input terminal of the VISA Configure Serial Port block and go to Create-> Constant.
- 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.
- 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.
- 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.
- Place all the above blocks in a way shown in the figure below.
- Now, go to the Functions-> Programming-> Structures-> Flat Sequence.
- Flat sequence block is encircled and is shown in the figure below.
- Put your cursor and go to Add Frame After.
- Similarly ad another case after this as shown in the figures below.
- Newly added frame is shown in the figure below.
- 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.
- Make the connections as shown in the figure below.
- 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.
- Select the Case Structure block and place it on the block diagram window.
- The figure shown below displays the above step.
- 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.
- Now, go to Functions-> Programming-> Structures and you can see different structures blocks there.
- Choose the encircled block as shown in the figure below.
- 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.
- Go to the input terminal of this local variable and go to Create-> Constant.
- Place C inside that constant.
- The figure below elaborates the above step.
- The above case structure is for the clock wise rotation of the stepper motor.
- Similarly make two further case structures for counter clockwise rotation and stopping the rotation of the stepper motor.
- All the three case structures are shown in the figure below.
- You can see three different case structures in above figure.
- The command box variable having command C will rotate the stepper motor in clockwise direction.
- A command box variable having command A will rotate the stepper motor in counter clockwise direction.
- The command box variable having command S 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.
- 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.
- 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.
- 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.
- Now add another case structure to start the program when you want so.
- The figure below shows the newly added case structure.
- Now, go to the Front Panel, the button encircled in the figure shown below is used to start the program when needed.
- 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.
- A complete NI LabVIEW Virtual Instrument (VI) is shown in the figure below.
Decorated Front Panel
- Since, I want to make the better external look of the program so I have decorated a bit.
- The figure shown below shows the decorated Front Panel.
- Go to Controls, Modern-> Decorations you can see different decoration blocks there.
- All these blocks are shown in the figure displayed below.
- 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.
Complete Hardware Setup
[ultimate_spacer height="10:]
- A complete hardware setup for different commands is shown in the figure below.
- When you send the command C through the serial port from LabVIEW to the Arduino, the statement Clockwise will be printed on the LCD as shown in the figure below.
- When you send the command S through the serial port from LabVIEW to the Arduino, the statement No rotation will be printed on the LCD as shown in the figure below.
- When you send the command A through the serial port from LabVIEW to the Arduino, the statement Anti Clockwise will be printed on the LCD as shown in the figure below.
This is all from the tutorial Stepper Motor Direction Control in LabVIEW. I hope you all enjoyed this tutorial. If you face any sort of problem you can ask me anytime without feeling any kind of hesitation. I will try my level best to solve your issue in a better way if possible. I will explore NI LabVIEW further in my later tutorials. Till then, Take care :)
DC Motor Direction Control in LabVIEW
Hello friends! I hope you all will be absolutely fine and having fun. Today, I am going to share my knowledge with all of you about how to make a simple program for
DC Motor Direction Control in LabVIEW. In my previous tutorials, I have also worked on
DC Motor Direction Control using Arduino. You should go through these tutorials they will be helpful in better understanding of the tutorial DC Motor Direction control using NI LabVIEW. The word DC
is basically an abbreviation of
Direct current. So, a direct current motor is commonly used motor having two input terminals, one is positive and the other one is negative. If we connect these terminals with the voltage supply the motor will rotate. If you change the polarity then motor will rotate in opposite direction. You should also have a look at
Difference between DC & AC Motors to get a better idea about these motors.
DC motor has a lot of applications. You can use it in automation projects, for controlling static as well as mobile robots, in transport system, in pumps,fans,bowers and for industrial use as well. In this tutorial I will work on
DC Motor Direction Control using NI LabVIEW. In my previous tutorial, I have done the
DC Motor Direction Control in MATLAB and I have used the same hardware but instead of controlling it from NI LabVIEW I have controlled it using MATLAB so you must have a look at that tutorial. Now let's get started with DC Motor Direction Control in LabVIEW.
DC Motor Direction Control in LabVIEW
In this tutorial, I will make a simple program to work on the DC Motor Direction Control in LabVIEW. NI LabVIEW is an amazing software tool specially for the students, because it is very easy to use and understand. So, its a student friendly tool. 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) in LabVIEW for
DC Motor Direction Control in LabVIEW. There will be three different buttons on the GUI for clockwise rotation, counter clockwise rotation and stopping the stepper motor respectively.
- You can download the complete SImulation for DC Motor Direction Control using NI LabVIEW here:
Download LabVIEW Simulation
- Download .rar file, extract it and enjoy the complete simulation for DC Motor Direction Control using NI LabVIEW.
How to Build Complete VI
- First of all open NI LabVIEW software on your laptop or PC so that we could design the GUI for DC Motor Direction Control in LabVIEW.
- 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.
- Go to the first input terminal of the VISA Configure Serial Port block and go to Create-> Constant.
- 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.
- 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.
- 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.
- Place all the above blocks in a way shown in the figure below.
- Now, go to the Functions-> Programming-> Structures-> Flat Sequence.
- Flat sequence block is encircled and is shown in the figure below.
- Put your cursor and go to Add Frame After.
- Similarly ad another case after this as shown in the figures below.
- Newly added frame is shown in the figure below.
- 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.
- Make the connections as shown in the figure below.
- 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.
- Select the Case Structure block and place it on the block diagram window.
- The figure shown below displays the above step.
- 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.
- Now, go to Functions-> Programming-> Structures and you can see different structures blocks there.
- Choose the encircled block as shown in the figure below.
- 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.
- Go to the input terminal of this local variable and go to Create-> Constant.
- Place C inside that constant.
- The figure below elaborates the above step.
- The above case structure is for the clock wise rotation of the stepper motor.
- Similarly make two further case structures for counter clockwise rotation and stopping the rotation of the stepper motor.
- All the three case structures are shown in the figure below.
- You can see three different case structures in above figure.
- The command box variable having command C will rotate the stepper motor in clockwise direction.
- A command box variable having command A will rotate the stepper motor in counter clockwise direction.
- The command box variable having command S 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.
- 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.
- 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.
- 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.
- Now add another case structure to start the program when you want so.
- The figure below shows the newly added case structure.
- Now, go to the Front Panel, the button encircled in the figure shown below is used to start the program when needed.
- 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.
- A complete NI LabVIEW Virtual Instrument (VI) is shown in the figure below.
Decorated Front Panel
- Since, I want to make the better external look of the program for DC Motor Direction Control in LabVIEW, so I have decorated a bit.
- The figure shown below shows the decorated Front Panel.
- Go to Controls, Modern-> Decorations you can see different decoration blocks there.
- All these blocks are shown in the figure displayed below.
- I have used three decoration block encircled with the red color, to decorate my program.
- Thick red boundary shows all of the decoration blocks to make your program attractive.
- You can also decorate your programs using this amazing tool.
This is all from the tutorial DC Motor Direction Control in LabVIEW. I hope you all enjoyed this tutorial. If you face any sort of problem in DC Motor Direction Control in LabVIEW, then you can ask me anytime without feeling any kind of hesitation. I will try my level best to solve your issue in a better way if possible. I will explore NI LabVIEW further in my later tutorials. Till then, Take care :)