Serial Communication With Labview Tutorial Timed Rating: 8,7/10 8551 votes


Viewpoint developed a new test system that utilized new hardware and software, augmented by existing low level hardware and firmware. The test system was developed to perform both functional test for production and environmental testing, and was designed to handle up to 4 DUTs at once. Experiments: Labview, RS232 and Discovery board Page 2 There are many standards describing the connection between a PC and a microcontroller to exchange data (USB, RS232, GPIB. The RS232 standard ) describes wires, connectors, and signals to make a simple and reliable data transfer. The hardware implementing this standard is available in. With LabVIEW, you will need to include the proper termination character in your string input to Serial Port Write.vi, if your instrument requires it. Only after a second execution of the write command, increase the delay before read (ms) input to ensure that the write has time to complete before reading.

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
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.
Labview serial communication example
  • 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 blockand 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.
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.
  • 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 🙂


JLCPCB – Prototype 10 PCBs for $2 (For Any Color)

China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w

Category: LabView TutorialsBy Syed Zain Nasir1 Comment

Author: Syed Zain Nasir

https://www.theengineeringprojects.com/I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>



Hello friends, hope you all are fine and enjoying good health. Today’s post is my first post on LabView Software. I have worked on LabView quite a lot in past but these days I am continuously working on LabvView so I thought to write some tutorials on it. In today’s tutorial, I will explain in detail How to get continuous data from COM Port in LabView software. LabView is a very handy tool for the engineers. One can easily plot graphs and can work on different hardware modules with it. One of the best feature of LabView is its extensive help desk. There are many examples present in it which are ready to run and can help a lot, moreover their online is also very extensive. I got into many problems while working on it and I never get stuck, I just searched online and got the solutions for my problems. So, my suggestion is, if you are working on LabView then give Google a chance to help you out, if you stuck in something.Labview usb serial communicationLet’s start today’s post, in today’s post we will receive data from serial port and show it in LabView software. In order to do so, first of all you need to download LabView software, you can easily download it from their official website. They offer a trial period of around 45 days for the students and after that you have to buy it. Now, follow the below steps carefully and if you find any trouble anywhere, let me know in comments and I will try my best to sort them out.

Steps to Follow

Note:

Labview Arduino Serial Communication

  • I have given the complete working vi to download at the end but I suggest that you should design it by yourself so that you learn how to design.
  • Now, click on the Create Project Button and the below Window will pop up.
  • Now click on the Blank VI Template and click Finish.
  • A blank vi will open up, we will design the complete project in this vi.
  • These are two windows, one is called the Block Diagram, where we will place all the components and the second one is Front Panel, where user can interact with LabView i.e. the Serial data coming will be displayed in the Front Panel.
  • Another small window will also be there, this window is used for getting blocks.
  • Now design a vi as shown in the below figure:


Note:

Response is showing the complete data whatever is coming from the Serial Port, while the Data 1D is splitting the data and showing each data in each box and the separation character I selected is “,” (comma).That’s all for today, now play with the vi and I hope you will find it really amusing. In order to download the complete working vi click on the below button.Download the Labview viIn the next post, I have discussed how to Display Serial Data on Real Time Graph in Labview.Displaying data on graph is usually required in most of the projects. So have a look at it.


JLCPCB – Prototype 10 PCBs for $2 (For Any Color)

China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w

Category: LabView TutorialsBy Syed Zain Nasir28 Comments

Labview Tutorial Pdf

Author: Syed Zain Nasir

https://www.theengineeringprojects.com/I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>