Visualize your data easily with a veteran in the engineering industry – National Instrument’s LabVIEW! It is a perfect solution to every makers’ test, measurement, and control needs.
Introduction
LabVIEW is a staple tool in testing and controlling sytems. That was established to me even in my early days in the university. It provides a user-friendly graphical approach in programming as well as it provides quick visualization into data but I never knew it can interact with Arduino and Raspberry Pi as well.
In this post, I’ll discuss some LabVIEW essentials, Makerhub LINX, and a sample project using an Arduino UNO.
LabVIEW
Overview
According to their website, LabVIEW is a systems engineering software for applications that require test, measurement, and control with rapid access to hardware and data insights.
It offers a graphical programming approach that helps you visualize every aspect of your application, including hardware configuration, measurement data, and debugging. This visualization makes it simple to integrate measurement hardware from any vendor, represent complex logic on the diagram, develop data analysis algorithms, and design custom engineering user interfaces.
Okay, so how does it work?
Getting Started
First of all, there are two environments in LabVIEW that you can work on – Front Panel and Block Diagram. The Front Panel appears immediately when you start a new project. Basically, this is where the UIs (user interfaces) appear when you run the program. By right clicking, you can open the controls palette to add controls and indicators. More on that later.
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-2-1024x656.png)
On the other hand, the Block Diagram is where we create the visual program. One of LabVIEW’s best features is that you can literally create a program with just icons and wires. You can open it by pressing CTRL + E.
The Functions Palette provides for loops, while loops, data types, mathematical operations, and many more. Let us discover how in the next section.
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-3-1024x657.png)
Controls and Functions Palettes
Controls Palette
Let us start with the Controls Palette. I’ll right click on the front panel to bring out the toolbox.
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-4-1024x658.png)
You will see a wide selection of controls and indicators. Basically, controls are user inputs while indicators are outputs. Let us see how this work. (Tip: You can pin the controls palette on your front panel so you won’t have to bring it up every time. The pin is located in the upper left corner of the toolbox.)
On the modern category, click on Numeric.
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-7.png)
As you can see, these are UIs where you can show user input data (control) or visualize the output (indicator). LabVIEW provides a vast amount of these two to help you visualize your data for different kinds of projects. They are categorized by their style or function. No need to worry as most of them are self explanatory. Also, you can find the perfect control and indicator for your project by using the search box in the upper right corner of the toolbox. For now, let’s add Numeric Control and Numeric Indicator
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-9.png)
You can rename them by double clicking their labels. I’ll name them like their names in the toolbox so you can easily follow.
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-8.png)
So how can we use this? Turns out to actually make the user interfaces in the front panel work, we’ll need to program it in the block diagram first. Let us bring out the block diagram to understand this.
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-12-1024x654.png)
As you can see, the two icons on the front panel are here. We’ll need to connect them with wires to make them work. Moreover, let’s spice things up by using the functions palette. I’ll right click on the block diagram to include an add function. I’ll also add another numeric control for the sake of demonstration.
Functions Palette
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-11-1024x875.png)
You can set the two environments to both appear on your screen by pressing Ctrl + T. You can also click on Window and from there, choose Tile down.
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-13-1024x552.png)
We now have the basic requirements to create a program that adds two numbers. Let’s connect them with wires.
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-14.png)
Before I run the program, I’ll adjust the values of the numeric controls to the values I want to add.
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-15.png)
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-16.png)
Finally, we can press run!
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-17.png)
The front panel now shows the expected value.
That’s how LabVIEW works. Simple and straightforward. The software offers a lot more features than this though. I’ll leave them up to you to explore as I’ll focus on how I can use it in my Arduino projects.
Makerhub Linx
Here’s the interesting part. Up until awhile ago, I never knew this module exists in LabVIEW.
LabVIEW Makerhub Linx makes use of LabVIEW’s VIs to interact with common development boards like Arduino, Beaglebone, and Raspberry Pi. This module also has a vast amount of sensor libraries so you can directly access sensor data from the computer. Aside from that, there are peripheral VIs to access your devices digital I/O, analog I/O, SPI, I2C, UART, PWM and more. With this tools, you can now use LabVIEW to program your Arduino and create a user interface for data visualization simultaneously! Talk about hitting two birds with one stone.
You can access sample VIs easily with Find Example in the Help toolbar. Just use linx as a keyword to see the various examples available.
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-19.png)
I tried to open the “Hello World” of hardware development, blinking an LED. It brings out a user-friendly VI filled with helpful notes and instructions on how to use it.
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-18-1024x556.png)
We can use these examples as references or sometimes even a start point for projects. They’re easily modifiable. Just don’t forget to save them as a different file. Next, let us explore Makerhub in the Functions palette.
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-20.png)
Inside LINX
Here we can see the essential functions we can use in interacting with our development boards.
- Open – This marks the starts of the program for your board. This is placed after a serial port function. A serial port function indicates the port location of your development board.
- Close – This marks the end of the program for your board.
- Peripherals – This access your devices digital I/O, analog I/O, SPI, I2C, UART, PWM, and etc.
- Sensors – This provides interaction capabilities with LINX compatible sensors.
- Utilities – This consists of various helpful functions for embedded systems development.
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-21.png)
Now that we’re familiar with how Makerhub LINX work, let’s try using it with a sample project.
Sample Arduino Sonar
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/IMG_20200127_114343-1-1024x695.png)
Hardware
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/Sonar-1024x448.png)
Things you’ll need:
- Arduino UNO
- Any servo Motor
- Ultrasonic Ranging Sensor Bracket
- Any ultrasonic sensor
- Any two non-polarized capacitors (Value between 10pF to 100?F)
This sonar works with an Arduino as its brain. It controls the servo motor to sweep over a 180 degrees cycle with the ultrasonic sensor attached to it through a bracket. The data from the ultrasonic sensor travels to the Arduino then to the computer via serial to USB communication. The capacitors are used for decoupling.
Software
We need to upload a specific firmware in order to make LabVIEW communicate with the Arduino UNO. In the LabVIEW home screen, under Tools/Makerhub/LINX, open LINX Firmware Wizard.
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-22.png)
Next you’ll indicate what board you’re using and what upload method you’re going to use. In this case, an Arduino UNO.
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-23.png)
Select the COM port your Arduino is connected.
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-24.png)
Choose Pre-built Firmware as the upload type.
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-25.png)
Done!
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/image-26.png)
Click Finish to return to home screen. After this, your Arduino can now communicate with LabVIEW. Download the VIs I used here:
Open the sample file. Click CTRL + E to bring out the Block Diagram. Select the COM port of your Arduino UNO and run the program.
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/Capture2-1024x556.png)
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/Capture-1024x553.png)
![](https://learn.circuit.rocks/wp-content/uploads/2020/01/ezgif.com-video-to-gif.gif)
And that’s it! It’s quite fun relearning LabVIEW. It is indeed convenient for visualizing data for embedded systems.
Check out my previous post about making your own Arduino in a breadboard here. I also wrote some tips about preserving battery life for embedded systems. Check it out here. Stay creative!
References
- https://github.com/SINConsulting/LabVIEW-Basics
- https://www.labviewmakerhub.com/doku.php?id=learn:tutorials:labview:start