Measurements for Data Acquisition

Online LabVIEW Evaluation: Exercise 2

Tutorial


Online LabVIEW Evaluation: Exercise 2

Goal:

This exercise will teach you how to use LabVIEW to acquire and analyze data from a connected DAQ device.

  • You will not need any hardware for this exercise. We’ve preconfigured a simulated DAQ device that you can access in our Evaluation environment.
  • In future scenarios where you have a DAQ device connected to your computer, you can follow these same steps to acquire measurements.


Objective:

Create a VI that acquires Accelerometer measurements from a simulated DAQ device, analyzes the data and displays the results.

Before You Begin

We recommend you use the following equipment to complete the exercise:

  • A mouse for easy maneuverability
  • Two monitors, one to show the exercise steps and another for LabVIEW

Exercise Instructions


  1. Creating a new VI
    • Open a blank VI by clicking File > New VI
  2. Acquiring Signals
  3. First, we will use an Express function to acquire measurements from the preconfigured simulated DAQ.

    • Right click on the Block Diagram, navigate to Express >> Input >> DAQ Assistant
    • A DAQ Assistant dialog will appear. Select Acquire Signals >> Analog Input >> Acceleration -> IEPE and press Next.
    • We have preconfigured the environment to simulate a connection with an NI 9234 module, which contains 4 channels of Accelerometer inputs. Hold Shift Key and select the first two channels, ai0 and ai1 and click Finish.
    • We would like the program to continuously acquire a signal until we stop it, so change the Acquisition Mode to Continuous Samples.
    • Before clicking OK, you can quickly test this out by clicking Run in the DAQ Assistant. The simulated channels are configured to simulate a sine wave. Once you're done, you can press Stop and then OK.


    • Because you selected Continuous Samples LabVIEW will prompt you to allow it to automatically create a loop around the DAQ Assistant Function. Click on Yes.
  4. Displaying the signals acquired: Place a Waveform Chart
  5. You now have a program that is acquiring measurements from two channels of a simulated DAQ device. To display this data on the user interface, let's add a chart.

    • Right-click on the Front Panel, navigate to Graph and select Waveform Chart
    • On the Block Diagram, place the chart indicator inside the loop, and connect a wire from the data output node of the DAQ Assistant to the input node of the chart.
    • On the Front Panel, change the label of the chart to Accelerometer Data, and expand the plot legend to show both channels
    • Now you can run and watch the chart display the acquired data from our simulated DAQ device.

  6. Analyzing the acquired signals
  7. Let's go a step further and explore how we could analyze this data as we acquire it. In this case, let;s say we'd like to perform a Power Spectrum analysis of the signal we are acquiring.


    • Right click on block diagram and navigate to Express >> Signal Analysis >> Spectral Measurement and place the function inside the While Loop.
    • Select Power Spectrum and select Linear result. Press OK.
    • Connect a wire from DAQ Assistant Data output node to Spectral Measurement Signals input node
    • To display this on the User Interface, right-click on the Front Panel, navigate to Graph and select Waveform Graph. Change the label of the graph to Power Sepctrum Data. Change the label of the x-axis from Time to Frequency (Hz).
    • Right-click the Waveform Graph and select Properties. In the Scales tab, for the x-axis, uncheck the Autoscale box and change the Maximum to 20.

    • On the block diagram, connect a wire from Spectral Measurement's Power Spectrum output node to Power Spectrum Data input node.
    • Your program is now ready to run!

      • Click on the Run Button on the Front Panel toolbar
      • Watch as the program acquires data from the DAQ device and displays it. The program also analyzes the data and displays the calculated Power Spectrum. 
      • Once you are done, press on the Stop Button. This will end the program

Where to Go Next

Resources

To continue learning about using LabVIEW, NI provides you with a number of options.

Find more content about the Online LabVIEW Evaluation

Back to Quickstart