How to Use PXI Modules through gRPC from LabVIEW on a PC Connected via LAN

Updated Aug 8, 2024

Environment

Hardware

  • PXIe-4137

Software

  • LabVIEW

Driver

  • NI-DCPower

Previously, to use instruments in a PXI system running Windows OS, it was necessary to execute a program on the Windows OS of each PXI controller. This approach required separate software development, management, and maintenance for each PXI system, and measurement modules had to be used exclusively with each system.

To address this issue, LabVIEW 2024 introduces the ability to use modular instruments on a PXI system connected via LAN from LabVIEW on a different client PC using gRPC . Note that there are limitations on the modules, functions, and features that can be remotely controlled via gRPC.
 
gRPC overview.png

In this example, we will use the PXIe-4137 (SMU) in the PXI system (PXIe-8840, Windows 10, IP = 10.128.1.34) to demonstrate how to run the LabVIEW voltage sweep sample VI on a client PC (Windows 10, IP = 10.128.10.33). In this setup, the PXI system acts as the gRPC server, while the client PC functions as the gRPC client. The PXI system is connected via wired LAN, and the client PC is connected via wireless LAN, with both devices able to communicate over IP. For software and versions, we will use NI gRPC Device Server 2.6.0, LabVIEW 2024 Q1, DCPower 2024 Q1, and Python 3.10.11.

Server Side Configuration (PXI System)

In this section, we will configure the PXIe-4137 installed in the PXIe-8840 (Windows 10, IP = 10.128.1.34) to be accessible from a client PC on the same network. The following two settings are required:
  • PXIe-4137 is recognized in NI MAX.
  • Installing and running the gRPC server
First, you need to install the necessary driver. For the PXIe-4137 (SMU), install NI-DCPower. You can download the driver from NI Package Manager or the NI website.

Second, follow the detailed instructions provided in this article:
1. Install Microsoft Visual C++ Redistributable for Visual Studio 2017 and 2019 .
2. Download ni-grpc-device-server-windows-x64.zip , modify the IP address setting in server_config.txt, and run the NI gRPC Device Server. (In this example, the IP is 10.128.1.34, so update server_config.txt to "address": "10.128.1.34".)

Ensure the PXIe-4137 is recognized in NI MAX and note the device name. If it is installed in Slot 2, the default name will be "PXI1Slot2." When you start the gRPC server, it should display the following if it starts successfully

start grpc.png

Additionally, to verify that the port is in the Listening state, use netstat from the command prompt as shown below.

check port.png

This completes the server-side configuration. To use the measurement instrument on the server from LabVIEW on the client PC, you will need the following two pieces of information:
  • The device name in NI MAX. In this example, the PXIe-4137 is recognized as PXI1Slot2 in NI MAX.
  • The IP address and port being used, which in this case are IP = 10.128.1.34 and Port = 31763, as specified in server_config.txt.


 

Client side settings (PC)

In this example, we use a client PC (Windows 10, IP = 10.128.10.33). To control the PXI system's measurement module from the client PC via gRPC, you can use LabVIEW, Python, or C#. Here, we will introduce examples using LabVIEW and Python.

For LabVIEW, you will need to install LabVIEW and the appropriate driver. In this case, we are using LabVIEW 2024 and NI-DCPower 2024. Note that during the installation of the DCPower driver, you must manually select and install the NI-DCPower Runtime for LabVIEW Measurement Plug-In Support package, as it is not selected by default.

As shown in the attached VI in this article, the only modification needed in the sample VI is to replace the Initialize function. By changing it to a function that opens a gRPC session and entering the settings confirmed on the server side, you can perform measurements using the instruments on the server.

initialize.png

With the above changes, I was able to perform a voltage sweep on the LED from the client PC using the PXIe-4137 on the gRPC server PXIe-8840.

led.png

When using Python, you will need to install the Python environment, grpcio-tools, matplotlib, and other necessary packages. Follow the steps below:
  • Download ni-grpc-device-client.zip and create a proto file as demonstrated in this video ​​​​​​​.
  • Just like with LabVIEW, you will need the connection information confirmed on the server.
You can then perform measurements by setting up the connection as described below.

python.png