Installation of Arduino Support Package in MATLAB

Arduino with MATLAB:

One can connect Arduino very easily with MATLAB and Simulink. MATLAB provides platform to design your project in Simulink and upload it in Arduino for working independently from MATLAB and stand alone as well; working in real time with MATLAB.

Following few steps will give a bird’s eye view to work with Arduino and Simulink together.

(You can buy Arduino board by given link at the end of this article)

Required Components:

  1. Arduino (Mega2560 or UNO)
  2. MATLAB 2013 (or above)
  3. Installed Arduino package in Simulink
  4. Arduino USB cable (for communication)

Installing Arduino Package:

MATLAB Simulink don’t come with pre-installed packages for Arduino. You simply have to download it from the official site of Mathworks. For MATLAB 2013 and above versions,

1.  Run the MATLAB program,

2.  In menu bar go to the HOME menu. (‘1’ in figure 1)

3.  There is block for RESOURCES having an option of ad-Ons. (‘2’ in figure 1)

Figure 1: Arduino-MATLAB_1

4. Click on get hardware support packages (Figure 2)

Arduino-MATLAB figure 2
Figure 2: Arduino-MATLAB

5.    Support Package Installer window will open (Figure 3)

6.    This window will have option of (Figure 3_1)

        i. Install from internet: to install the hardware package directly from internet to your                                computer
ii.   Download from internet: to download the package from internet but not installing in                            MATLAB program
iii.   Install from folder: to install the downloaded support package from your computer.
iv.  Uninstall: to uninstall some installed support package

Arduino MATLAB Package installer figure 3 (install Arduino support package MATLAB)
Figure 3: Arduino MATLAB Package installer

7.    You can also open support package installer by writing targetinstaller in command         window.

(We will chose install from internet. You can also download the package then installing it.)

8.    Click Next on that Support Package installer window in bottom right. (Figure 3_2)

MATLAB-Arduino hardware package installation figure 4 (install Arduino support package MATLAB)
Figure 4: MATLAB-Arduino hardware package installation

9.   Next window will open showing all the available hardware support packages.(Figure 4)

10. Click on Arduino and click Next(Figure 4-1 and 4-3)11. You will have to sign in in your Mathworks account. If you don’t have one, create one with any of your working email address. (see Figure 5 to Figure 8)

12.  After sign in by your email address and password, click login and click next and next and it will take a little time (depending upon internet connection) to download and install. Then click finish.

Arduino-MATLAB hardware support package installation


Arduino-MATLAB hardware support package intallation
Figure 6: Arduino-MATLAB hardware support package intallation


Arduino-MATLAB hardware support package install
Figure 7: Accepting the terms and conditions


Arduino-MATLAB hardware support package installation (install Arduino support package MATLAB)
Figure 8: Download and Installation in progress

        When installation is complete, Connect your Arduino board with the computer using its data cable and write a=arduino it will show the COM port with it is connected through computer and board and other details about it. as shown in figure below the board is Mega2560 and it is connected to the COM1 also showing analog and digital pins of it.

Checking connection of Arduino withMATLAB
Figure 9: Connected Arduino Board with MATLAB

Now the MATLAB is ready to work with Arduino Borad. You can directly burn the Arduino through the MATLAB Simulink and make your life very easy.

Arduino-Simulink Library:

After Successful installation of Support Package, the Arduino Libraries in MATLAB Simulink will be added.

Open the Simulink Library by clicking on the option in SIMULINK menu in HOME tab (figure 9). Simulink Library will open and in the left side, along with all the available libraries, there will two libraries Arduino IO library and Simulink Support Package for Arduino library. They have further blocks in them to use. (figure 10)

Arduino Package in Simulink MATLAB
Figure 9: Arduino Support Package in Simulink MATLAB


Arduino Support Package in Simulink MATLAB
Figure 10: Arduino Support Package in Simulink MATLAB

Arduino I/O Library:

Once you have installed Arduino Support Package, in MATLAB Simulink Libraries, one of the libraries will be Arduino IO Library. This library contains 12 further blocks/operations you can do with Simulink and Arduino connected. This library allows to send the information from the MATLAB to the connected Arduino Board as well as receive from the board. These are shown in following figure 11:

Arduino I/O Library
Figure 11: Arduino I/O Library


Read Blocks:

When these blocks are executed, they takes the input voltage at the provided pin defined in the parameter box i.e. they takes/senses the voltage at that specific pin at that specific time at print to the MATLAB. This could be used as real time feed to the MATALB. (See Example).

Write Blocks:

When these blocks are executed in Simulink, they give the output high to the Arduino i.e. gives the signal to the specified pin.

Common Blocks of Arduino MATLAB library
Figure 12: Common Blocks of Arduino MATLAB library

Simulink Support Package for Arduino tool in MATLAB Simulink Library has four section naming: Common, Ethernet Shield, Wifi Shield and Examples. In Common Blocks Analog Read/Write, Digital Read/write, Motor Control, Servo Control, PWM (on output/PWM pin of Arduino) and Serial Transmit/Receive. (Figure 12)

Stay tuned with us for more about MATLAB and Arduino.

Build Arduino-Simulink Model & Run on Hardware

In Case of any Query and problem regarding this, feel free to contact us and follow us on Facebook for updates. 🙂


Asad Ullah

I am MSc Electrical Scholar under a fellowship program. Working with Modeling and Simulation software related to my field are my activities in leisure.

2 thoughts to “Installation of Arduino Support Package in MATLAB”

What do you think?