Arduino on Matlab within Ubuntu 14.04

1 view (last 30 days)
Andreas Schmid
Andreas Schmid on 21 Jan 2016
Commented: wei shulin on 18 Apr 2018
Hi, I installed Matlab 2015b on Ubuntu 14.04 => Works fine. Then also installed the Arduino support package => No warnings or errors...
Yesterday, I wanted to connect the Arduino UNO:
a = arduino('/dev/ttyUSB0')
what resulted in an error. I tried this answer and made the java file. That did not work. I find the arduino when I list the USB ports. It says Bus 007 Device 002 ... Arduino UNO R3. And in the device list I find the corresponding file which properties gave me the "/dev/ttyUSB0" address.
Has anybody a hint I could try?
  5 Comments
Andreas Schmid
Andreas Schmid on 11 Feb 2016
Edited: Andreas Schmid on 11 Feb 2016
Thank you Juan, I tried all this, but in the end it did not work out. I was in contact with Mathworks support and they found out that in my Ubuntu distribution one package was missing.
So in the end this worked out:
Install the Matlab Arduino-Kit Install the missing Arduino dependencies: sudo apt-get install openjdk-6-jre avr-libc gcc-avr Create the symbolic link: sudo ln -s /dev/ttyACM0 /dev/ttyS100 Create a file called java.opts in the folder where Matlab starts (To find out where this is, start Matlab and type
pwd
in the command line)
The file tells Matlab where to find the connection, so this line must be contained: -Dgnu.io.rxtx.SerialPorts=/dev/ttyS100:/dev/ttyACM0
That's about it :-)
wei shulin
wei shulin on 18 Apr 2018
Hi,Juan Reyes thank you for your help , it really helps me out.

Sign in to comment.

Answers (1)

marwa diwiny
marwa diwiny on 12 Nov 2016
Edited: Walter Roberson on 13 Nov 2016
Please I need the help, I tried many times, but in vain, I don't know where is the problem and it can't recognize the arduino functions
>> a= arduino('/dev/ttyACM0')
The port /dev/ttyACM0 is already used by MATLAB
If you are sure that the board is connected to /dev/ttyACM0
then delete the object, execute:
delete(instrfind({'Port'},{'/dev/ttyACM0'}))
to delete the port, disconnect the cable, reconnect it,
and then create a new arduino object
Error using arduino (line 54)
Port /dev/ttyACM0 already used by MATLAB

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!