MATLAB–Arduino Connection Issues

Initial Setup and Installation

Port Detection Problems

Issue: No available COM port appears during the Hardware Setup, even after installing the Hardware Support Package (HSP).

Likely Cause: The board may already be configured and "claimed" by another tool (e.g., Arduino IDE or MATLAB Arduino Explorer App).

Solution:

  1. Close the Hardware Setup dialog box.
  2. Ensure all Arduino interfacing applications are closed (Arduino IDE, MATLAB Arduino Explorer App).
  3. In the MATLAB Command Window, run: clear; clc; close all; 
  4. Run:  arduinolist
  5. This will display connected boards and their COM ports.
  6. Run: arduinosetup
  7. Select USB → Next
  8. Select UnoR4Wifi and the correct port → Next

If no boards appear:

  • Disconnect and reconnect the USB cable
  • Run arduinolist again
  • Restart your computer if needed

Arduino is "Busy"

Issue: MATLAB code fails because the Arduino is busy.

Solution: Close the MATLAB Arduino Explorer App before running any .m scripts.

Hardware Support Package (Mac Specific)

Issue: App Manager will not launch (Java-related issue).

Solution:

  • Attempt manual installation via MathWorks File Exchange
  • If the issue persists, contact MathWorks Technical Support

MATLAB and Software Environment

MATLAB Service Host Processes

Issue: Unable to sign in or connect to online services.

Solution:

  • Windows: Open Task Manager (Ctrl+Shift+Esc), locate "MATLAB Service Host," and select End Task
  • Mac: Open Activity Monitor, locate "MATLAB Service Host," and select Force Quit
  • Restart MATLAB afterward

Alternatively, restart your computer.

Shadowed Functions and Script Naming

Issue: Scripts named after built-in MATLAB functions (e.g., what.m, clock.m, arduino.m) cause errors.

Solution:

  • Use unique, descriptive script names
  • Check using: which filename -all

Prevention: Use doc functionname before naming files to avoid conflicts.


General Tips and FAQs

General Troubleshooting

  • Restart your computer to reset USB connections
  • Reinstall MATLAB if issues persist (no repair option available)

FAQs

What hardware is used?

The course uses the Arduino Uno R4 WiFi and Grove sensors. Verify your specific hardware before use.

Component Identification:

Sensor and component names are typically printed directly on the hardware. Refer to labels and documentation for pin usage.

Verification of Connection

Run the following script to confirm connectivity:

clear a;
a = arduino(); % Initialize board
disp('Success! Arduino is connected and functioning. ');
disp(a);