Install NI-DAQmx Python API on NI Linux Real-Time devices

Updated Sep 18, 2023

Environment

Hardware

  • cRIO-9040
  • cRIO-9041
  • cRIO-9042
  • cRIO-9043
  • cRIO-9045
  • cRIO-9046
  • cRIO-9047
  • cRIO-9048
  • cRIO-9049
  • cRIO-9053
  • cRIO-9054
  • cRIO-9055
  • cRIO-9056
  • cRIO-9057
  • cRIO-9058

Software

  • NI Linux RT System Image

Driver

  • NI-DAQmx

This article outlines the steps to install NI-DAQmx Python API in NI Linux Real-Time.

NI-DAQmx Python API supports NI Linux Real-Time OS. Before programming with Python on NI Linux Real-Time OS, you should be aware that programming with Python will lack the determinism of the real-time OS.

The following steps will demonstrate how to install NI-DAQmx Python API on NI Linux Real-Time controllers. The controller needs an internet connection to download the packages.
  1. Access the Shell on NI Linux Real-Time Devices.
  2. Make sure that NI-DAQmx is installed on the NI Linux Real-Time controller.
    • Use the lsni -v | grep NI-DAQmx command to list the DAQmx version installedlsni command results
  3. Run opkg install python3-pip command to install the tool for installing Python packages.
  4. Run pip3 install nidaqmx command to install NI-DAQmx Python API.
 

After executing the commands above, the NI DAQ devices can be controlled with Python now.
CleanShot 2022-04-11 at 14.40.07.png
 

The following is a basic example of using an nidaqmx.task.Task object. This example illustrates how the single, dynamic nidaqmx.task.Task.read method returns the appropriate data type.
  1. Run python command to open the Python environment.
  2. Run the following Python instructions to test the NI-DAQmx functionality.
  3. Modified the device aliases accordingly.
daqmx_example.png