How to Automate Measurements on NI ELVIS III with LabVIEW

Updated Sep 14, 2021





  • LabVIEW

The NI ELVIS III integrates instrumentation and control into a single solution for project-based learning. In this article, we introduce two LabVIEW based APIs: the Instruments API and the Control I/O API. Stepping through each of these APIs and understanding the use of LabVIEW, students, and educators can be create labs and projects for a host of applications including electronics, mechatronics, controls, and measurements.

Learning LabVIEW

If you are not yet familiar with LabVIEW we recommend using the training "Learn LabVIEW " to become better acquainted with the software. These multi-media modules are free and self-guided.

As you continue through the rest of this article, please note that a basic understanding of LabVIEW including the environment and structures is required.

Install Instrumentation and Control I/O APIs

There are two options for installation: either install the NI ELVIS III Software Bundle which will include LabVIEW, Real-Time, the NI ELVIS III Toolkit, and everything else needed to program NI ELVIS III or you can just install the NI ELVIS III Toolkit. See "Installing the NI ELVIS III Software Bundle" for further details including where to find the download.

Locating the VIs in the Pallets

In LabVIEW the Instruments and RIO pallets are found in the Academic I/O Functions Pallet as seen below:

Figure 1: LabVIEW Pallet for NI ELVIS III APIs

The Academic I/O pallet is available only when the VI is under the ELVIS target.


Using the Instruments API

NI ELVIS III has seven instruments that can be accessed through a soft front panel that represents the same controls as a traditional benchtop instrument panel to measure, output, and customize the instrument. For NI ELVIS III, videos of how to use instruments including the oscilloscope and bode analyzer see Explore NI ELVIS Instruments.

However, if there is a need to automate measurements or there is a requirement for post-processing data, the LabVIEW API for the instruments can be used to program a  fully customizable interface.

Each instrument API closely follows a standard pattern you will find throughout LabVIEW. This pattern is found in thousands of LabVIEW instrument drivers and APIs used by professionals in industry around the world.

Understanding this pattern enables the rapid use of any of those drivers in your application. The pattern is as follows:

Figure 2: Standard LabVIEW instrument program

The complete set of instruments can be found in the Instrument pallet.

Each instrument has its own set of Vis which can be found in the Instruments folder within the Academic I/O pallet. See the image below to see how the oscilloscope instrument VI follows the standard pattern mentioned previously.

Figure 3: Oscilloscope Pallet

An example of how these VIs can be connected together to program an instrument is seen below. The Function Generator and Variable Power Supply Instruments are demonstrated in a singular automated dataflow below.

Depending upon the instrument, an explicit Run command might be required in the code to begin execution, and if used in a loop must be stopped before changing its configuration.

It is a good rule of thumb to stop an instrument before making changes to its settings.

Figure 4: Example of FGen and VPS program in LabVIEW

Building a MOSFET IV Trace with the LabVIEW Instrumentation API

LabVIEW can be used to quickly and simply automate a sequence of tasks and record the data. The built-in IV Analyzer is perfect for BJT and diode analysis but if you want to go further and automate your own MOSFET analysis LabVIEW is the perfect tool for the job.

To test a MOSFET we need to set the gate voltage and then sweep the drain voltage while monitoring its current. We then repeat this for a series of gate voltages. This results in a graph like this:

Figure 5: Output Characteristics Graph for ZVN2110A

When written in LabVIEW, this is implemented using nested for loops where the outer loop sets the gate voltage and the inner loop sweeps the drain voltage.

Figure 6: Sweeping gate and drain voltages

The Function Generator and the Variable Power Supply will be included within the code to fulfill the functions we need. 
The Function Generator will control the gate voltage while the Variable Power Supply will control the drain voltage. The Variable Power Supply instrument will report the actual output voltage and current. 

Implementing this results in the following example code:

Figure 7: Completed MOSFET IV curve trace

All that is now needed to test the code is to grab a MOSFET. To Utilize a MOSFET:

  1. Download the full, completed example code here.

  2. Place the MOSFET onto the prototyping board and add a jumper wire to each MOSFET connection

  3. Connect a BNC Scope Probe to Function Generator CH 1 and a pair of Banana to Alligator Clip Set to the Variable Power Supply Ground and +15V.

  4. Connect probes to MOSFET jumper wires as shown below:

    Figure 8: MOSFET Jumper Wire Connections

  5. Click run on the example code and view the VI to display the graph of the automated measurements.

    Figure 9: Example Code Front Panel

Using the Control I/O API

The control I/O pallet consists of a set of Express VIs and low-level VIs which allow direct command over the NI ELVIS III control I/O. These commands are implemented on a real-time processor based upon a reconfigurable I/O (RIO) architecture. The RIO architecture is the exact same technology used in over 35,000 companies around the world.

Unlike the Instruments I/O, the control I/O prompts users to drop an Express VI (a VI whose settings you can configure interactively through a dialog box).

The Express VI configuration dialog contains the open, configuration, and read/write commands in a single setting.

Figure 10: Details of the Control I/O pallet
By placing an Express VI onto a block diagram, it automatically opens its configuration window. All Express VIs can be reconfigured by double clicking on them at any time. As an example, the Analog Output configuration window is seen below:

Figure 11: Analog output configuration window
As can be seen above, the configuration window sets the mode (single vs n sample), what channel is used, and the sample rate. The data to output is fed into the input that is automatically generated on the Express VI when the configuration window is closed.
If more customization is needed than the Express VI configuration window, then low-level VIs can be used to achieve the same outcome.

Using the Control I/O to Monitor and Control a BJTs Temperature

In addition to the instruments available with the NI ELVIS III, there are integrated Analog Inputs, Analog Outputs, and Digital I/O connections. Internally they are used in various ways to read encoders, output PWM signals, and communicate via digital protocols like SPI and I2C.

In this example, we will build a simple temperature control application to limit a BJTs temperature so that it stays near a target temperature value. Most control applications require tight timing and most instruments are designed to deliver a set of data which it has collected during a previous time period and not simply return the value as quickly as possible. This can introduce an unnecessary time delay if they were used. Instead, we will read a Thermistors value directly using the Analog Input, condition the voltage value to convert to resistance, convert the resistance to Temperature, and finally evaluate the temperature to control the BJT. The final circuit diagram will be:

Figure 12: Thermal Plant Circuit Diagram
Start by building the Sensing Circuit as follows:

  1. Supply 5V and ground signal from the workstation to the breadboard.

    1. Using a jumper wire, connect the +5 V DC from the breadboard strip to the + rail of breadboard.

    2. With another jumper wire, connect the AGND from the breadboard strip to the – rail of the breadboard.

  2. Connect the 10 K resistor R1 to 5V DC.

    1. Locate a 10 kΩ resistor in the kit, the color code is brown, black, orange. Connect one end to the + rail of the breadboard.

    2. Connect the other end to an empty area in the breadboard.

  3. Connect thermistor to the R1 and ground.

    1. Connect one end of the thermistor to the same node as R1.

    2. Connect the other end to the – rail, to ground the circuit.

  4. Connect AI0 (analog input) from bank A to measure the voltage divider.

    1. Use a jumper wire to connect from analog input AI0 to the same node as the voltage divider RI and thermistor.

It should look like this image:

Figure 13: Sensing Circuit
With the Temperature Sensing circuit in place we can now build the Thermal Plant. We will add the BJT and attach it to the Thermistor.

  1. Place the BJT on the breadboard such that it is in contact with the Thermistor

    1. Ideally heat shrink can be used to keep the Thermistor and BJT touching so that the heat can be measured. Tape can be used if heat shrink is not available.

  2. Connect the 10 K resistor R2 to the NPN Transistors Base.

    1. Locate a 10 kΩ resistor in the kit, the color code is brown, black, orange. Connect one end to the Base connection of the BJT.

    2. Connect the other end to an empty area in the breadboard.

  3. Connect AO0 (analog output) from bank A to control the BJT.

    1. Use a jumper wire to connect from analog output AO0 to the empty area connected 10kΩ resistor.

  4. Connect the BJT to the Ground and Voltage Rails.

    1. Connect the Collector to the 5V rail of the Breadboard.

    2. Connect the Emitter to the Ground rail of the Breadboard.

Figure 14: Final Thermal Plant Circuit
The code itself is quite simple and broke into several steps. The overall flow will be described below and then the two conversion steps will be covered in more detail. The code accomplishes the following:

  1. The Analog Input VI reads a single sample from A/AI0 (Pin 0)

  2. The value is converted from Voltage to the Thermistor's Resistance (Ohm) based on the Voltage Divider Parameters.

  3. The Thermistor Resistance is then converted to Temperature (C) using the Thermistor Parameters.

  4. The Temperature is then compared to the Temperature Setting (C) to determine whether the Analog Output A/AO0 (Pin 48) is turned on or off.

  5. The current status of the Analog Output is indicated by LED0

Figure 15: LabVIEW Top Level Thermal Plant Control Code


Figure 16: Voltage Divider SubVI

Figure 17: Thermistor Volt to C Conversion SubVI

With the circuit constructed and the example code downloaded you are now ready to open and run the example.

  1. Extract the which can be downloaded from here.

  2. Open the Academic IO - Control IO - BJT Temperature Control.lvproj

  3. Open the RT from the Project Window.

  4. Run the VI

  5. You can adjust the temperature using the Temperature Setting knob.