Tutorial 3: DC motor Speed Control through LabVIEW and Arduino: In our previous article we have seen how to program Arduino with LabVIEW. We write our first program in which we controlled LED connected on pin 13 of Arduino UNO board with a push button created in LabView. Setting up the LabVIEW Interface for Arduino is a six step process that you will only need to complete once. Please follow the instructions below to start creating applications with the. Manually install Drivers on Windows. The following instructions are for Windows 7, Vista and 10. They are valid also for Windows XP, with small differences in the dialog windows. In the following instruction only the Leonardo board will be mentioned, but the same procedure is valid for all the Arduino boards.
In my previous article, I have made the Bridge Monitoring System using Wireless Sensor Network project, which allows me to display all the related measurements from Arduino on my PC. Therefore, in this article, I am going to explain in details on how to display the Arduino measurements using Laboratory Virtual Instrument Engineering Workbench (LabVIEW). Two analog inputs of Arduino will be measured and displayed on a graph in LabVIEW.
A brief introduction to LabVIEW, according to Wiki, LabVIEW is a system design platform and development environment using graphical programming made by National Instruments. In other words, it can be used for various purposes such as creating graphical user interface (GUI), programming and simulation, hardware interface and data acquisition (DAQ).
Even though there are many platforms or tools available that can be used to create GUI for Arduino, my personal preference is using LabVIEW, mainly is due to the my previous experience with LabVIEW. The graphical programming is also an advantage as it eliminates the need to learn a new programming language. Creating user interface is also an easy task as LabVIEW was designed to enable engineers without heavy programming background to easily configure and display measurements from DAQ devices.
To get started, I will explain what is actually going on in Arduino. In this project, I am using an Arduino Nano to acquire signals and send the data to PC. As mentioned earlier, two analog input channels (A0 & A1) will be used to measure input signals. To ensure an accurate measurement is performed at fixed sample rate, the Arduino is configured to wait the predefined interval before taking a measurement and send to PC serially. The concept used is similar to the BlinkWithoutDelay example in Arduino. The benefit of using this method is that there is a while loop that always checks if it has crossed the desired interval. If it is reached, it will take the measurement, else it will skip and you can make it to work on other task.
Here is the code for Arduino, it is also available at my github.
Mar 21, 2019 How to rip Blu-ray in Windows 10 using the best Windows 10 Blu-ray Ripper. Load Blu-ray files to the ripper. Download and install the best Blu-ray Ripper to your Windows 10 computer and run it. Now please insert the Blu-ray disc into your BD drive (necessary for ripping BD). DVD, DVD folders, ISO files and IFO files are also supported. If 3D Ripper DX is initialized properly, than âReady to captureâ label will be displayed at the top left corner of the screen. If not, than this is not a DirectX9 application â 3D Ripper DX will not work. Capture one or several frames with âF12â key (can be changed in options). 3d dx. The most popular versions among the software users are 1.8, 1.7 and 1.5. 3D Ripper DX lies within Photo & Graphics Tools, more precisely 3D Design. The actual developer of the free program is Roman Lut. This free PC software is compatible with Windows XP/Vista/7/8/10 environment, 32-bit version.
In this code, Arduino will continuously check the microseconds since the beginning of program using micros() and compare to a previous checkpoint if it is greater than interval defined. This time interval is the sample period, Ts desired in microseconds. The figure below is used to describe the concept of sampling (you can skip this part as it is not required to interface Arduino and LabVIEW, but I feel that it is interesting to introduce the concept of fixed sampling on Arduino here).
Sample period, Ts is the time interval between each successive measurement. Taking the reciprocal of sample period is the sample rate or sample frequency. Sample rate, fs is a measure of how many samples is taken in 1 second. From the diagram at t = 0s, the first sample is taken. Then it will wait for a time given by the sample period before taking the second measurement at t = Ts. Similarly, after the second sample, the third sample will occur at t = 2Ts. For a measurement, it is desired to have a fixed sample rate so that we can know what is really happening at the exact time and also able to reconstruct the actual signal.
Back to the code, I have configured the Arduino to measure at the sample rate of 20 samples per second (S/s). With that it is also important to note that this sample rate is only able to reconstruct any signals at half of the sample frequency given by Nyquist Shannon sampling theorem. In simpler words, if my sample rate is 20S/s, I am only able to measure signals up to 10Hz. Beyond that, aliasing will occur where higher frequency signal appear as lower frequency content.
Once the measurement on analog input A0 & A1 is made, this measurement together with the actual time interval is formatted into a string stored in the buffer[] variable. This buffer has a header, â$â and terminates with ârnâ which is used to move the cursor to the beginning of new line. Within this string, the information is stored in the position in the <>. Finally, this buffer is written serially to the COM port using Serial.write() and we are ready to move on to LabVIEW.
For this project, I am using LabVIEW 2015 to develop the VI. VI or virtual instrument is the file format used to store the program routine developed. In order to interface with Arduino through serial communication, you also need to install the NI-VISA driver. VISA allows you to communicate with instrumentation busses such as USB, Serial or Ethernet.
To give you a big picture of what it looks like for the GUI design, the front panel looks like this.
Arduino Labview Driver Windows 10
Breakdown of the elements in front panel:
And here is the block diagram of the VI. A block diagram is where you âdrawâ your program using blocks and connect them using wires. This looks a bit complicated or scary, donât worry, I am just adding a bunch of comments (blocks in yellow with text) to describe each section.
The program start from left to right according the flow of wires. Starting at the left, the COM port is configured with baud rate 115200, 8 bit mode with no parity. The serial communication has a timeout of 10s. And since I had defined the string format, the serial interface is set to read until every termination character and dump for further process.
Once the serial port is configured, the main loop will read 1000 bytes from the COM port. However, since it was configured to read anything until the term char, it will always return only the string specified. Then a property node is used to check how many bytes remaining in the serial buffer. Ideally, this should be 0 or at least some bounded value. If this value is growing, sooner or later, overflow will occur and some data will be lost. This will happen if the serial device is sending faster than it is read from the PC buffer.
The data read from the serial buffer is passed to a âScan from stringâ block. This block will convert the string input based on the format specified and return the individual values from the string. In this case, you can see that two signed 16 bit integer (I16) and an unsigned 32 bit integer (U32) are read. The two I16 corresponds to the two reading from analog inputs and U32 is the time interval taken by Arduino loop.
After the two variables are read from the string, they are combined into a cluster to display on the graph. Itâs that simple.
To show how the system works, I am using a myDAQ to generate signals to the Arduino analog inputs. I will cover more on myDAQ in the future article. For now, myDAQ will act as a function generator using the analog output feature. Arduino A0 is fed with a sine wave with 2V peak to peak at 0.5Hz with 2.5V offset and A1 is fed with a sine wave with 1V peak to peak at 1Hz with 2.5V offset. The overall system diagram is as below.
Once the VI is executed, this is how the front panel looks like. You can see that there are two sine wave from the graph indicate by two different colours. Besides that, the graph is also set to display actual samples points. In digital domain, the actual samples are just the individual points. The âanalogâ waveform seen is actually an interpolation and reconstruction by the software to visualise the actual signal measured.
All the Arduino codes and Labview files are available at https://github.com/zxlee/arduino-labview-voltage-display. Basically this is how you can create and visualise your Arduino data easily using LabVIEW. In my opinion, both Arduino and LabVIEW are very powerful tools which you can consider in your next projects. I hope this has covers much of the details needed for you to create your own. If you have any questions, feel free to drop me a comment below.
If you find this article is useful, give a thumbs up so I know what my readers actually interested and share this article with your friends.
Advertisements
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 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.
Flow Chart
Arduino Labview Driver Manual
Block Diagram
Vitual Instrumentâs (VIâs) Description
Connecting Arduino To Labview
Windows live mail help center.
The driving end of the sport appealed to me right away and itâs what I liked the most. Harness racing drivers killed. âIn my mind I couldnât wait to get through school so I could work with the horses on a full time basis too.
Arduino Labview Driver Software
Labview Lifa
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 ?
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 Arduino Labview DriversCategory: LabView TutorialsBy Syed Zain Nasir4 CommentsAuthor: Syed Zain Nasirhttps://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>Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |