matlab-connect-arduino

Discover, configure, and connect to Arduino boards from MATLAB via USB serial ports.

995|122|Updated Apr 3, 2026
One-click install
npx skills add https://github.com/matlab/matlab-agentic-toolkit --skill matlab-connect-arduino
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: matlab-connect-arduino
Source: https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/test-and-measurement/matlab-connect-arduino
Command: npx skills add https://github.com/matlab/matlab-agentic-toolkit --skill matlab-connect-arduino

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Connecting MATLAB to Arduino hardware involves discovering boards, identifying the correct serial port, choosing the right board type, and loading the correct libraries. This Skill guides an AI agent through that process step by step, preventing common mistakes like guessing COM ports, missing boards, or loading incomplete library sets.

Core Features & Use Cases

  • Board Discovery: Runs both arduinolist and serialportlist("available") to reliably detect all connected Arduino boards across Windows, macOS, and Linux.
  • Guided Connection Workflow: Walks through port identification, user board selection, library inference (e.g., Ultrasonic, RotaryEncoder, MotorShield), and connection via the arduino() function.
  • Troubleshooting Support: Provides OS-specific guidance when no board is detected, including driver issues, charge-only USB cables, and port conflicts.
  • Use Case: A user asks their AI agent to read an ultrasonic sensor from an Arduino Uno. The agent discovers the board on COM8, confirms the port with the user, connects with the Ultrasonic library loaded, and proceeds to the sensor-reading task.

Quick Start

Ask your AI agent to connect to your Arduino board from MATLAB, for example: "Connect to my Arduino Uno and read the ultrasonic sensor."

Frequently Asked Questions about matlab-connect-arduino

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I connect to an Arduino board from MATLAB?

Use the arduino() function with a serial port, such as arduino('COM8', 'Uno'). First discover boards with arduinolist and serialportlist("available"), then connect with the port, board type, and any required libraries.

How do I find which COM port my Arduino is connected to?

Run serialportlist("available") in MATLAB to list all available serial ports. On Windows, check Device Manager under Ports (COM & LPT); on macOS look for /dev/cu.usbmodem* entries; on Linux check dmesg for /dev/ttyACM* or /dev/ttyUSB* devices.

Why does MATLAB not detect my Arduino board?

Common causes include charge-only USB cables, missing USB drivers (CH340 or FTDI), or another application holding the port open. Try a different cable or port, install the board's driver, and close tools like the Arduino IDE Serial Monitor.

Which Arduino libraries should I load when connecting from MATLAB?

MATLAB loads {'I2C', 'SPI', 'Servo'} by default. Add libraries based on your hardware, such as 'Ultrasonic' for HC-SR04 distance sensors or 'RotaryEncoder' for quadrature encoders, since reconnecting later to add libraries takes significant time.

Can I connect to multiple Arduino boards from MATLAB at once?

Yes, create a separate arduino object per board with its own port and libraries, such as a1 = arduino('COM8', 'Uno') and a2 = arduino('COM52', 'Nano33BLE'). However, only one MATLAB session can hold a connection to a given board at a time.

What Arduino connection types are not supported by this workflow?

This workflow covers USB serial connections only. Bluetooth and WiFi Arduino connections, custom addon library creation, and Simulink hardware-in-the-loop workflows are outside its scope.