Matlab Arduino
  • Home
  • Serial Communication
  • Accelerometers
  • Gyroscopes
  • Signal Processing
  • Wireless
  • GPS
  • Internet of Things
  • Distance
  • Force
  • Environmental Sensors
  • Visualizations
  • About

SERIAL COMMUNICATIONS

Connecting the Arduino UNO to Matlab via the USB port for serial communication

Picture
The first step is to use establish a serial connection between the Arduino board and Matlab via the USB port. Follow the steps in this video to setup the Arduino UNO board with MATLAB via the USB port.

Software Used
In the video, MATLAB R2012a was used, available at mathworks.com. The Arduino IDE version 1.0.1 was used to program the Uno board, available at arduino.cc. In addition to programming environment, it contains the drivers necessary for your computer to connect to the micro controller.

Identifying the COM Port for Serial Communication

For any OS the serial port can be identied in the Arduino IDE under the Tools menu, Serial Port, as selected option when a board is connected.

Windows

Open the Device Manager from the Control Panel. Expanding the grouping Ports, a device should be listed with COM# in parenthesis. This is shown in the figure below.
Picture

Mac

On a Mac OS, type ls /dev/tty* into a terminal or the MATLAB command window. A device will be listed as usbmodem, such as /dev/tty.usbmodemfa131

Linux

The default mount for the Uno should be /dev/ttyACM0. It may be necessary to set permissions on the serial port the Arduino is mounted. Enter into terminal: 
sudo chmod 777 /dev/ttyACM0

Additionally, the ports used need to be specified for MATLAB libraries as pointed out on the Newsgroups. Create a text le named java.opts in the $MATLABROOT/bin/$ARCH directory. 

$MATLABROOT is the MATLAB root directory and $ARCH is your system architecture, found by typing matlabroot and computer('arch') in the MATLAB
Command Window. Add to java.opts: 
-Dgnu.io.rxtx.SerialPorts=/dev/ttyS0:/dev/ttyUSB0:/dev/ttyACM0
© 2020 Pramod Abichandani
  • Home
  • Serial Communication
  • Accelerometers
  • Gyroscopes
  • Signal Processing
  • Wireless
  • GPS
  • Internet of Things
  • Distance
  • Force
  • Environmental Sensors
  • Visualizations
  • About