View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Arduino meets MATLAB

3.0 | 4 ratings Rate this file 21 Downloads (last 30 days) File Size: 1.48 KB File ID: #24638 Version: 1.1
image thumbnail

Arduino meets MATLAB



04 Jul 2009 (Updated )

Matlab Linked to Arduino

| Watch this File

File Information

The current submission illustrates a way to use the popular open source arduino boards with MATLAB illustrating the capabilities of data acquisition and visualization in real time .

The Arduino Demilanove based on the ATMEGA 328 is used to send a series of time series through the serial interface and the matlab code acquires the data and performs a meaningful part of the same at a baud rate of 9600.

There are quite a few things that could be made more visually appealing by using Matlab with the microcontrollers !

I was happy to get my board at a low cost not bearing much custom duties and i have listed the vendor who markets them in India !


This file inspired Interacting With An Arduino Using The Matlab Serial Commands.

MATLAB release MATLAB 7.4 (R2007a)
Other requirements Arduino IDE for the controller ! Arduino Demilanove Hardware platform from TENET TECHNETRONICS INDIA
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (15)
22 May 2014 thilina senevirathne

20 Oct 2012 Joseph

Joseph (view profile)

Thanks for this one. However, I am using gizDuino MiniUSB with ATEM328. Unlike Arduino Uno, gizDuino is being read by the computer as "libusb" not as coneected in communication port. Therefore I have the problem of identifying what COM port to be use. Can you help me figure out how to solve my problem?

Comment only
28 Jul 2012 Muhammad Awais Memon

i tried to interface arduino uno with matlab using command
but facing errors like undefined function
can anyone help me out??

07 Mar 2012 Hossam

Hossam (view profile)

I would like to know how to send bytes from the arduino to matlab, and these bytes are packets for an image ? I would like to display the image on matlab. I would be grateful to who answers me :)

Comment only
15 Feb 2012 Suresh

Suresh (view profile)

I don't see anything on the graph.

I have a Microcontroller board(Arduino Uno) that sends data between 1 - 1024(digits)for every 1000 mili seconds to the COM port 5 of Windows XP PC.

I want to receive this data in to MatLab and display a graph of Time versus Data. I want to display both Static and Dynamic or whichever is possible easily.

14 Jul 2011 Sreeram Mohan

Hi Alex is ,

Looks like what u need to do is the reverse of what my file submission does !

Instead of the fscanf u could do a fprintf to the com port that is assigned to the arduino on the PC and pass in the sinewave values from matlab !

Hope this helps !


Comment only
14 Jul 2011 Sreeram Mohan

hi fremond khoo ,

Potentiometers are generally analog inputs which can be easily read through the pins on the arduino ! refer to the analogIn functions and a simple schematic on the arduino playground on how to do it !

Further the only interface through which the arduino can talk to any other software on a host (PC) is basically through the serial port.

so having said that
analogin --> Arduino --> serial.print --> matlab code

should be the psuedo path !

Hope this helps !


Comment only
28 May 2011 Alex is

is it technically possible I mean?

Comment only
28 May 2011 Alex is

Hi I am trying to generate sine waves from matlab and input into the arduino uno. can someone please help me in describing the procedure?

Comment only
18 Mar 2011 fremond khoo

hi and good day to all,

i want to ask about the interface with arduino and matlab..i am now trying to get the data from potentiometer which is attached at my stepper motor shaft..can anybody tell me how to get the data from potentiometer through arduino board to my computer(MATLAB) and try to plot the graph at the same time?..i have the code to plot the graph but i cant run both files at the same..

either i run my motor or get data from potentiometer by turning the potentiometer how do i solve this??..

anyone would be so kind to help out here??

thanks in advance^^

Comment only
25 Oct 2010 Gautam Vallabha

See here for another freely downloadable implementation of a MATLAB <-> Arduino interface over a USB serial cable:

Comment only
09 Nov 2009 Sreeram Mohan

Hi Daniel,

A simple fix to the problem faced is to make the arduino to get a start command from the matlab and then start the communication from the arduino end.I have had success doing this and may be post an other sketch to the file exchange.

Cheers !

Comment only
06 Nov 2009 Daniel McKenna

Thanks Ram. I was using code similar to the screen shot and it was not solving the timeout problems. It took me quite some time to figure this out but here's what was happening (In case anyone else cares):

The Arduino Starts sending serial messages on bootup. If Matlab is stated after the Arduino Matlab has a lot of trouble framing the Serial messages. What does work is to reset the arduino, and then while the bootloader is starting up, open the serial port. That way Matlab doesn't time out and it gets the first reading for the arduino. Another solution is to implement some sort of handshaking.

Comment only
03 Nov 2009 Sreeram Mohan

Hi Daniel,

You could look at the snap shot with the file-submission and the c-code is clearly visible.

hope this helps,


Comment only
30 Oct 2009 Daniel McKenna

Do you have the Arduino side of this code? I get a timeout when I try to read in the serial data using the serial.write() on the arduino. Is there a end of line that is required by Matlab?

25 Sep 2009 1.1

Just added some places to find these boards in INDIA .

Contact us