Connecting to arduino - timeout

29 views (last 30 days)
ulrich on 8 Mar 2012
Commented: Brais Gonzalez on 22 Nov 2017
I tried to connect matlab to my arduino uno getting the following reply:
>> a= arduino('COM6')
Attempting connection ........
Warning: A timeout occurred before the Terminator was reached.
??? 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
What I did before is:
downloaded the matlab arduino softwar in the folder ...toolbox\matlab
opened matlab as administrator
set a path to the folder ...toolbox\matlab\arduino
pluged in the arduino
and typed the command (see above).
And than there comes the error message. :-(
With the arduino 1.0 software the arduino works fine. I uploaded several files to blink the diode and it worked fine.
What I did not understand is that in the error message of matlab it saies "...running either srv.pde...". How can I start the srv.pde software?
Thanks for your help!

Accepted Answer

Grufff on 8 Mar 2012
The srv.pde "software" is actually a server script which you need to upload and run on the Arduino. It is this script which enables Matlab to communicate with and control the Arduino.
The srv.pde sketch is supplied in the Matlab Arduino support package here:
You upload it to the board just like you would any other standard sketch. Full instructions are contained in the readme file that comes with the support package... quoted snippet here:
The srv.pde (or adiosrv.pde) is the "server" program that will continuously run on the microcontroller. It listens for MATLAB commands arriving from the serial port, executes the commands, and, if needed, returns a result.
The following instructions are needed to upload the srv.pde file into the controller's flash memory. Note that if you don't have the motor shield and don't plan to use it, then you can UPLOAD THE ADIOSRV.PDE file instead the instructions are the same, except for the folder location).
As long as no other file is uploaded later, this step does not need to be repeated anymore, and the package can be used as soon as the board is connected to the computer..... "
Follow the instructions in the readme, these will walk you through uploading srv.pde to your Arduino and should solve your problem.
Brais Gonzalez
Brais Gonzalez on 22 Nov 2017
The PWM outputs provide 50,000 values per second. You could make a program that sends the data obtained, to pins 2-13 and obtain the information in the form of PWM.

Sign in to comment.

More Answers (1)

kartik p
kartik p on 28 Jun 2014
i tried using the motor pde..but while shows me an error dat AFMOTOR.h file is missing...u mean to say for matlab to control the servos via arduino i need to have adafruit motorshield??nd if no..den wich pde must be loaded into arduino for controlling servos?coz i tried with adiosrv.pde but matlab says no pde related to servos found so no action taken....

Community Treasure Hunt

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

Start Hunting!