MATLAB Answers

0

Cannot connect MATLAB to Arduino board due to connection timeout error -> [??? Error using ==> arduino>arduino.arduino at 102]

Asked by Euan Millar on 12 Mar 2012
Latest activity Answered by Brais Gonzalez on 21 Nov 2017
Hi, I am trying to connect MATLAB to an Arduino Duemilanove using the MATLAB IO Support Package. It did work in the past (couple of weeks ago) using this board but now for some reason it does not want to connect to the board. When I use the "a=arduino('COM4')" it appears with the error:
??? Error using ==> arduino>arduino.arduino at 102
Connection unsuccessful, please make sure that the Arduino is powered on, running either srv.pde,
adiosrv.pde or mororsrv.pde, and that the board is connected to the indicated serial port. You might also
try to unplug and re-plug the USB cable before attempting a reconnection.
The argument at line 102 of the arduino.m file is as follows:
% exit if there was no answer
if isempty(chk)
delete(a);
error('*Connection unsuccessful, please make sure that the Arduino is powered on, running either srv.pde, adiosrv.pde or mororsrv.pde, and that the board is connected to the indicated serial port. You might also try to unplug and re-plug the USB cable before attempting a reconnection.*');
end
I have uploaded adiosvr.pde to the target board and closed down the Arduino IDE (as recommended by the readme.txt file). I have hunted on the web high and low through forums and so on but cannot find a viable solution to my problem. I am fairly new to MATLAB and the IDE language but I am an engineering student working on my dissertation and this is kind of imperative to the whole success of it. It's so frustrating that it was working and now it isn't. I haven't changed or removed anything.
ANY help would be greatly, greatly appreciated.
Regards,
Euan Millar

  1 Comment

What changed in the last couple of weeks? Are you using a different board?
(make sure that COM4 is the correct port for the Arduino. If you have other serial USB devices connected to your system, a new COM port may have gotten assigned to the Duemilanove).

Sign in to comment.

3 Answers

Answer by Aminat
on 9 Apr 2012

I have the same problem. I got it to work okay in the IDE environment but for some reason it's not working in the Matlab environment. Please reply when you find any answers.

  0 Comments

Sign in to comment.


Answer by Aminat
on 9 Apr 2012

Hi! I figured out the answer...you have to establish a connection between the IDE and Matlab to control the serial port. The details are at this link/in the readme for matlab support package.

  0 Comments

Sign in to comment.


Answer by Brais Gonzalez on 21 Nov 2017

Answer for Error using arduino (line 104) Warning: Unsuccessful read: A timeout occurred before the Terminator was reached.
The answer is: 1 In the Arduino software(IDE). You need write the code, which you find in file "adioes.pde" There are three files adio, adioe, adioes. A for analog D for digital I for input O for Output E for encoder S for Servo. If you need a Servo o a encoder, you need put the code more complete adioes. 2 Compile this code and send to arduino. Close the IDE 3 To open matlab and to write a=arduino("COMxx") 4 You has finalized the Arduino instalation

  0 Comments

Sign in to comment.