SERIAL COMMUNICATIONS
Connecting the Arduino UNO to Matlab via the USB port for serial communication
|
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. |
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.
|
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 |