File Exchange

image thumbnail

Simulink Support Package for Arduino Mega 2560 Hardware (R2012a)

version 1.2 (414 KB) by

Simulink block library for creating standalone applications for the Arduino® Mega 2560 platform

7 Ratings



View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

Arduino ( is a low-cost open-source electronics prototyping platform based on flexible, easy-to-use hardware and software.
With R2012a, Simulink provides built-in support for prototyping, testing, and running models on Arduino Mega 2560. You can design algorithms in Simulink for control systems and robotics applications, and see them perform with hardware.
To install support for Arduino Mega 2560, type "targetinstaller" in the MATLAB Command Window.
In the Target Installer that opens, do one of the following:
• If you have not downloaded the support package, choose "Internet". Target Installer automatically downloads a support package and installs it.
• If you have already downloaded the support package, choose "Folder". Then specify the location of this support package. Target Installer installs this support package.

Simulink support for Arduino® Mega 2560 includes the following driver blocks:
• Digital Input and Output
• Analog Input and Output
• Serial Receive and Transmit
• Servo Read and Write

This FileExchange entry is for R2012a support.

For more details about the Simulink Arduino® support, see:

For additional Simulink built-in support for hardware, see

Comments and Ratings (20)

Amar Ismail

I'm trying to install this support package for Matlab R2012a but I keep getting the following error:

"Cannot download Error downloading URL. Your network connection may be down or your proxy settings improperly configured.."

I tried to check the download link "" but it appears to be down.

Please help me with this issue as it is very important for my FYP.

Thank you! :)

Dan Lluch

Dan Lluch (view profile)

@Marta - this particular entry is for 12a. but is for 13a and beyond. you can read more information here:


Marta (view profile)

Does this support package compatible for R2013b?

Dan Lluch

Dan Lluch (view profile)

@Phillip - Mac support for this arduino support from simulink was added in R2013b... you can use this entry to initiate installation, but you will need 13b for Mac support.

Phillip Glau

I'm using 2012a for Mac OS x on 10.8 and when I type
targetinstaller, it pulls up the Target Installer window, but then when I select Internet as the option, I get:

"Select a Target

does not contain a valid support package. Please specify a folder that contains a valid support package and try again."

If I download the submission into my downloads folder and use the 'Folder' option and point it to the folder 'rtt_arduinomega2560_r2012a_v1_0' it also complains and says it is not a valid package.


addie irawan

Hi guys;

Did anyone knows how big Arduino Mega could support the downloaded simulink program? I hv a quite big simulink program with stateflows and s-function builder blocks. I'm currently want to switch and implementing my model to the hardware. What I understand, the Arduino Simulink block for Arduino Mega is a Target block type NOT like Arduino IO package previously created and suited for Arduino UNO. I also would to know if you guys have experiences on editing Arduino IO package for Arduino Mega used. The Arduino IO package seems saving a lot of memory since the concept is creating virtual port pins of Arduino in SIMULINK blocks NOT downloading the SIMULINK program blocks into the Arduino such as Target block for Arduino Mega version. Please correct me if I mistaken.

Thank you in advance.

Raja Rout


pedro (view profile)

excelente aporte


Twols (view profile)

I'm trying to run the model in external mode on an Arduino Mega 2560 R3. After downloading the compiled model the connection to the target fails (the external mode check box is set): After pressing the Connect to Target Button Simulink crashes. I'm running the 2012b Matlab on a Win7-64bit machine.


Jedediah Frey

Jedediah Frey (view profile)

What is the difference between this package and "Embedded Coder Support Package for Arduino" (

This just appears to have the 'streamlined' installation of targetinstaller.

Dan Lluch

Dan Lluch (view profile)

@Heilko and @Ravikanth - please note previous post about where to ask technical questions on this. That is the best option for getting answers quickly...

@Heilko - difficult to tell from only this info.. I suggest to post again on Ansers or contact Technical Support. My guess is you picked the 'folder' option, but that wasn't where you downloaded the File Exchange entry... or you unzipped it already... no need to download it from here first... just run targetinstaller and follow the 'internet' option.

@Ravikanth - We expect that all revs of the 2560 are supported. If you have any issues, please contact Technical Support.

Thanks for the interest and have fun using the new capability!

Can anyone please help me whether matlab and simulink supports Arduino Mega 2560 R3.....because this is R3 board... so just to make sure whether it supports or not?



Heiko (view profile)

.../arduinouno does not contain a valid support package.
Please specify a folder that contains a valid support package and try again.

What is wrong? Can you help me ?



General guidelines:
* Please use this FileExchange page to post general comments and ratings on the support package

* If you have questions about using this support package, post your question at (with tag "arduino", and product "simulink")

* If you have an enhancement request or wish to report a possible bug, contact MathWorks Technical Support at


Nils (view profile)

Also, does this release have support for access to more (or all) input/output capabilities of the mega board?


Nils (view profile)

And what is released separately in this case? What can be downloaded here isn't entirely compatible with r2011b, I take it...?



New Version: 1.2


Update to fix broken link


Update to v1.1 to enable autodownload on non-R3 Arduino Mega 2560 boards


updated thumbnail and description


Updated title and description to emphasize that this entry is for R2012a support


* Updated title and description to clarify that support is for Arduino Mega 2560 board


Updated zip file


Updated zip file and title

MATLAB Release
MATLAB 7.14 (R2012a)

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

» Watch video