Blog Home

Arduino and MatLab

Davide GombaSeptember 20th, 2010


Arduino has always been linked to some programming enviroments (like Processing, Pure Data, VVVV, Max/Msp to name some of them) but since it has fast become a quick & easy way to make your project get in touch with the physical world, many different solutions are there for people who is working with other, not-only-performative programs.

[Matlab] (high-level programming tool for technical and mathematial computation) has *probably* different ways to receive data from the Arduino. I found a well and detailed step-by-step guide with codes and pictures on this presentation from Giampiero Campa who lead the webinar “Learning Basic Mechatronics Concepts Using the Arduino Board and MATLAB“:

The webinar introduces the ArduinoIO package, which allows the user to perform Analog and Digital Input and Output, as well as to control DC, Servo and Stepper Motors interactively from the MATLAB command window, without having to write, debug, compile, upload and run C programs.

you can downlaod the Arduino package from here.

Any tester?

via []


14 Responses to “Arduino and MatLab”

  1. Jesus Says:

    That’s an excellent option, I’ve used it and it works great:

  2. @mazimi Says:

    arduinoteam do you mean MATLAB?

  3. @ale914 Says:

    arduinoteam MATLAB not MathLab 😉

  4. Says:

    thanks. 😉

  5. @osu Says:

    I would be glad to test the program. I work with the lab that supports first year engineering at the Ohio State University (, where we also teach Matlab fundamentals. I have downloaded all the files, and am working on getting a motor controller. Let me know what you expect in terms of documentation.

  6. Hans Says:

    Does it also work with Octave?
    (My matlab license has expired)

  7. Says:

    hi @osu.

    Since I’m not a MatLab user I just wanted to know whether somebody could check this examples’ efficiency.
    All I could find interfacing Arduino to MatLab was this.
    If you really get to control the motor you should sum it on the Playground.
    That would be very nice.

    Thanks for comment.


  8. @osu Says:


    It’s all about the serial interface, and I believe if you search for Octave Serial you’ll find a link to some add on code that works in windows, but there is nothing native in the octave.

  9. Arduino und MATLAB - Webmeister Blog Says:

    […] (via Arduino Blog) […]

  10. Jose Says:

    Dear makers of the Matlab interface,

    the interface is definitely very interesting, but I do not recognize the “Arduino Motor shield” shown in your photographs. Seams that the shield shown handles not only DC motors, but also stepper motors and servos.

    — Could you give a more precise indication on the motor shield shown in this page and also on the Mathworks’ page?

    Thanking in advance,

  11. Says:

    Hi Jose.
    I think the motor shown is the one ladyAda sells:

    For the reference at MathWorks I advice you to follow & contact Mathworks’ guys, since I didn’t had the chance to test myself the whole process.

    Can you report if you find any solution?

    Thanks for commenting,

  12. Jose Says:

    Hello Davide,

    many thanks for the reference. I will try to see if the mshield is sold somewhere in Europe, or even in Portugal. It is definitely interesting to me as an experimental device involving various kinds of motors, not just DC motors.

    About the Matlab interface, in the past we had to write C code for the serial port of other devices, but in the last years Matlab has been equipped with a nice serial port interface. Hence I am expecting not to find any problem. The only thing I will try to investigate a little is a way to find automatically the serial port number (i.e. finding a shortcut to the Arduino development env.)

    Thanking once more the ref sent, best regards,

  13. Kem Says:

    Hello Davide,
    Thanks for your reference, i have tried to connect Arduino and Matlab successfully with your help!
    However, i also want to connect Arduino with Simulink, but there’s so many errors when i do that. Have u tried to connect Arduino with Simulink?
    I use the Arduino Mega 2560 & Matlab r2010b

    best regards,

  14. Says:

    Hi Kem.
    Unfortunately I have no idea how can I help you.
    You’d better open a thread on the Arduino Forum or maybe on the MathLab one.

    Sorry 🙁


Leave a Reply

You must be logged in with your Arduino account to post a comment.