Repository navigation
tutorial usb serial visa
This tutorial shows how to connect a USB serial device (for example, Arduino) to a Raspberry Pi and communicate with it from LabVIEW using VISA.
- How to identify the correct serial device on Raspberry Pi (
/dev/tty*) - How to map Linux serial devices to VISA resource names
- How to open, read, and write to the port in LabVIEW
- How to make port selection reliable across reboots and re-plugs
- Raspberry Pi running LINX-supported Linux image
- LabVIEW with NI-VISA installed
- USB serial device (Arduino, USB-UART adapter, etc.)
- USB cable and basic serial test firmware on the device
Plug in the USB serial device, then run:
dmesg | tail -n 50
ls -l /dev/ttyACM* /dev/ttyUSB* 2>/dev/nullTypical results:
- Arduino CDC device:
/dev/ttyACM0 - USB-UART adapter:
/dev/ttyUSB0
To get stable identity info (vendor/product/serial):
udevadm info -a -n /dev/ttyACM0 | lessUseful command for quick USB listing:
lsusbOn Linux, NI-VISA serial resources commonly map like this:
-
/dev/ttyACM0->ASRL/dev/ttyACM0::INSTR -
/dev/ttyUSB0->ASRL/dev/ttyUSB0::INSTR
In LabVIEW, you can also use VISA Find Resource with:
-
?*INSTR(broad search), then filter toASRL... -
ASRL?*INSTR(serial-focused search)
Create a VI with this basic flow:
-
VISA Find Resource (
ASRL?*INSTR) - Loop through returned resources
- For each resource:
- VISA Open
-
VISA Property Node
- Interface Description
- Interface Number
- Interface Type
Recommended serial settings to expose on front panel:
- VISA Resource Name
- Interface Name
- Interface Number
- Interface Type

Also note that there is a premade VI that can scan and map serial ports available in this forum post.
Before debugging LabVIEW, test the device in terminal:
stty -F /dev/ttyACM0 115200 -echo -icanon
echo "ping" > /dev/ttyACM0
cat /dev/ttyACM0Or use screen:
screen /dev/ttyACM0 115200If terminal communication fails, fix that first (cable, firmware, baud, permissions).
Add your user to serial-related groups and re-login:
sudo usermod -aG dialout $USER
sudo usermod -aG tty $USERUse a persistent udev symlink.
Example rule:
sudo nano /etc/udev/rules.d/99-linx-serial.rulesAdd (update IDs for your device):
SUBSYSTEM=="tty", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="0043", SYMLINK+="linx_arduino"
Reload rules and replug device:
sudo udevadm control --reload-rules
sudo udevadm triggerThen use VISA resource:
ASRL/dev/linx_arduino::INSTR
- Increase VISA timeout (for example 2000-5000 ms)
- Confirm termination character behavior
- Ensure device is actually transmitting line endings expected by your VI
For systems with multiple serial devices:
- Enumerate
ASRL?*INSTR - For each resource, open and send lightweight probe command
- Match expected response pattern
- Cache selected resource in config file
- Re-scan only if open/read fails
This is typically more reliable than hard-coding ttyACM0.
Using USB serial on Raspberry Pi with LabVIEW is straightforward once you:
- Identify the Linux device node
- Map to the VISA resource string
- Configure matching serial settings
- Add a robust discovery strategy for multi-device or changing-port systems
For LINX projects, this is a practical way to communicate with Arduino-class devices and USB-UART peripherals when network transport is not required.