Find Arduino Port on Windows, macOS, and Linux
R2026bYou can communicate with your Arduino® board over USB, Bluetooth®, or Wi-Fi®. When you connect over USB, you need the serial port to which the board is
connected. You specify the port when you create a connection by using the arduino function, or when you configure the board over USB in Arduino
Explorer because it does not appear as a device card. You must set up the
board over USB even if you plan to connect to it over Bluetooth or Wi-Fi.
Before you find the port, complete the setup for your environment. For MATLAB® Desktop, see Install Support for Arduino Hardware. For MATLAB Online™, see Get Started with MATLAB Online for Arduino.
Find Port Number Automatically
Use the arduinolist function to list the Arduino boards connected to your computer. If you use MATLAB
Online, make sure that MATLAB
Connector™ is connected to MATLAB
Online and that Hardware Connectivity is
enabled.
connectedHardware = arduinolist
connectedHardware =
3×4 table
Port Board Status Libraries
______ __________ __________________ _____________________________
"COM3" "Mega2560" "Upgrade required" {["I2C" "Servo" "SPI"]}
"COM5" "Uno" "Setup required" {["Not available" ]}
"COM8" "MKR1000" "Ready to connect" {["I2C" "SPI" "Servo"]}The output shows the port, board type, connection status, and loaded libraries
for each connected board. Use the port, such as COM3, to connect
to the board.
If your board does not appear in the arduinolist output,
manually identify the port.
Find Port Number Manually
Follow the steps for your operating system. If you cannot find the port after following these steps, check with the board vendor and install or update the device driver.
Find Port Number on Windows
Connect the Arduino board to one of the USB ports on your computer. If you are connecting the board for the first time, ensure that the driver installation is also complete.
Open Device Manager. On the Windows taskbar, in the search box, type
Device Manager.In the Device Manager window, expand the
Ports (COM & LPT)list.Note the port name (
COM#) that displays the Arduino board's name.
When you connect to the board by creating an
arduinoobject, use this name as the port input argument.
Find Port Number on macOS
Connect the Arduino board to one of the USB ports on your macOS computer.
If you are connecting the board for the first time, ensure that the driver installation is also complete.
Open Terminal in macOS.
Using Spotlight Search, search for Terminal.
Alternatively, in the Finder, select Go > Utilities and double-click Terminal.
At the command prompt in the Terminal, go to the root directory.
cd /List the contents of the dev folder.
ls /dev/*Note the port name
/dev/tty.usbmodem*or/dev/tty.usbserial*.When you connect to the board by creating an
arduinoobject, use this name as the port input argument.
Find Port Number on Linux
Connect the Arduino board to one of the USB ports on your computer.
Note
If you are connecting any Arduino board over USB, make sure that the corresponding COM port has read, write, and execute permissions.
If you are connecting the board for the first time, ensure that the driver installation is also complete.
Open a Terminal in Linux.
At the command prompt in the Terminal, go to the root directory.
cd /In the root directory, list the devices whose names start with
/dev/tty.ls /dev/tty*Note the port name
/dev/ttyUSB*or/dev/ttyACM*.When you connect to the board by creating an
arduinoobject, use this name as the port input argument.