File Exchange

image thumbnail


version 1.3.12 (3.62 MB) by MathWorks Maker Team
MATLAB and Simulink support for hardware components used in the Arduino Engineering Kit Rev 1


Updated 15 Oct 2020

View Version History

View License

NOTE: This version of the file exchange is applicable to MATLAB release starting from R2019a.

• For MATLAB 2018b, use the file here -

• For MATLAB 2018a, use the file here -

This package includes MATLAB and files that allow you to control and communicate with the sensors and actuators used in the Arduino Engineering Kit. The sensors and actuators are connected through the MKR Motor Carrier. The supported peripherals include:

• DC motor – control up to 4 DC motors simultaneously
• Servo motor – control up to 8 servo motors simultaneously
• Encoder – read up to 2 encoders simultaneously
• LiPo Battery – read the battery voltage

The project files for the Arduino Engineering Kit are included here –
• For AEK Rev 1:
• For AEK Rev 2:

Learn more about the Arduino Engineering Kit at

Important Notes:

1. The File Exchange submission can either be downloaded as a toolbox or a zip file.

a. If you choose to download the toolbox, complete its installation in MATLAB.

b. If you choose to download the file, extract the contents of this package to a local folder, and add it to the MATLAB path. To add the folder to the path in MATLAB, right-click the folder and select "Add to Path" > "Selected Folders and Subfolders" option.

For the hardware support package to work, an additional 3rd-party library “MKRMotorCarrier” (version 1.0.1) from Arduino is required along with the file exchange file.

If you are using MATLAB R2020a and above, the “MKRMotorCarrier” library is included in the MATLAB Support Package for Arduino Hardware. See step 6 for further instructions. If you are using MATLAB R2019a or R2019b, continue with steps 2 and 3.

2. Download the Arduino 3rd-party library zip file, for MKRMotorCarrier, from this link:

3. Extract this zip file into a local directory and rename the folder to "MKRMotorCarrier".

If you are using MATLAB R2019b, skip to step 5. If you are using MATLAB R2019a, then follow step 4.

4. Move the "MKRMotorCarrier" folder into the "libraries" folder inside your Arduino sketchbook folder.

a. On Windows, the default path is "Documents\Arduino\libraries\"
b. On Mac, the default path is "~/Documents/Arduino/libraries/"
c. On Linux, the default path is "/home/<username>/Arduino/libraries"

Once you move the libraries, the folder structure should be similar to:

d. On Windows "\Documents\Arduino\libraries\MKRMotorCarrier\src"
e. On Mac, "~/Documents/Arduino/libraries/MKRMotorCarrier/src"
f. On Linux, "/home/<username>/Arduino/libraries/MKRMotorCarrier/src"

If you are using MATLAB R2019a, skip to step 6.

5. Move the "MKRMotorCarrier" folder into the "libraries" folder inside your Arduino sketchbook folder:

a. On Windows, the default path is "<arduinoio.IDERoot>\portable\sketchbook\libraries\"
b. On Mac, the default path is "~/Documents/Arduino/libraries/"
c. On Linux, the default path is "<arduinoio.IDERoot>/portable/sketchbook/libraries/"

NOTE: "arduinoio.IDERoot" is a MATLAB command. Executing this command in the MATLAB Command Window returns the location of the Arduino IDE directory on your system.

Once you move the libraries, the folder structure should be similar to:

d. On Windows, "<arduinoio.IDERoot>\portable\sketchbook\libraries\MKRMotorCarrier\src"
e. On Mac, "~/Documents/Arduino/libraries/MKRMotorCarrier/src"
f. On Linux, "<arduinoio.IDERoot>/portable/sketchbook/libraries/MKRMotorCarrier/src"

For all releases of MATLAB.

6. Type "listArduinoLibraries" in the MATLAB Command Window. The resulting cell array should display {'Arduino/MKRMotorCarrier'} among others. If the MKRMotorCarrier library does not appear in the cell array, ensure the steps 4 and 5 are executed correctly.

NOTE: You can find these instructions in the "ArduinoKitHardwareSupportReadMe.txt" file. After installing the toolbox or extracting the contents of the file, type the following command in MATLAB to open the readme file:

>> edit ArduinoKitHardwareSupportReadMe.txt

Cite As

MathWorks Maker Team (2021). AEK-Rev-1-Hardware-Support-19a+ (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (28)

Taylor Bork

Utterly broken and documentation out of date.

MathWorks Maker Team

@Juan osvaldo Lopez casildo: Please contact for help with the technical query.

In using matlab 2019b update 7, i download the file and when i enter listarduinolibraries the mkrmotorcarrier and motorsheildv2 show up, but when i enter a=arduino only i2c, spi, and servo show up as available. When i try to upload the rev kit i continuously get errors.

MathWorks Maker Team

The corrupt toolbox issue has now been fixed. Re-download and install the toolbox file from the File Exchange page or from the Add-Ons menu in MATLAB to work with Arduino Engineering Kit Rev 1.

Raul Miguel

"Unable to install toolbox 'Arduino-Engineering-Kit-Rev-1-Hardware-Support-19a+' because the toolbox file is corrupt."
Problem persists using R2020b.

Sergio Mora

I cannot download it because it says that the file is corrupt...


Similar to a few comments below, I am also getting a toolbox file corruption error message when trying to add to R2020a (update 5).

Dominic Newman

I get an error when i use the addon saying the toolbox file is corrupt using R2020a

Andreas Jakobsson

I get an error message when I try to add the addon, saying the toolbox file is corrupt. I'm using Matlab R2020a.

MathWorks Maker Team

The path issues with the MATLAB Toolbox Installer (.mltbx file) has now been fixed. Feel free to download and work with either the Toolbox or the ZIP file. If you continue to run into problems, please contact us at

Apologies to everyone facing problems with this Hardware Support Package. We have uncovered a bug with our MATLAB Installer (.mltbx file) and have taken it down from the page while we are fixing it.

To resolve the issue you are facing currently, please download and install the latest ZIP file after manually deleting older copies of the toolbox folder, which can be found here: <username>\Documents\MATLAB\Add-Ons\Toolboxes

If you are still running into problems, please contact us at

Alberto Iob

Thank you for the support Michael! I followed your instructions and it worked. Many thanks and sorry to the Mathworks Maker Team: at the point #1 of the installation guide I just followed the instructions for the automatic installer and I didn't try the manual one that would have solved the problem.

Michael Peterson

This issue I reported is a result of the corrupt Matlab path added to Matlab when you choose to use the Add button for this support package (I replicated this on both a Windows 10 and a Mac 10.5.3 installation), if you choose to download the ZIP file into your default Matlab Add-ons folder (you can see what this is by clicking the Preferences button on the Matlab Home tab), then navigate to this folder using the Matlab folders window and right click the zip file and choose to extract the contents, then right click the folder that is generated and select the Add to Path option.
Everything will then work fine.

Michael Peterson

I have R2019b and have installed the MKRMotorCarrier library (v 1.0.5) in the correct place as described in the hardware kit readme, ie. "arduinoio.IDERoot\portable\sketchbook\libraries\" (where arduino.IDERoot is a Matlab command and typing it gives you the full path to that location).
However, I too get a compilation terminated when trying to program my MKR1000 board using arduinosetup, due to
MKRMotorCarrierBase.h: No such file or directory - when I look in the MKRMotorCarrier library src folder there is no MKRMotorCarrierBase.h file, only a MKRMotorCarrier.h file, so I think this is a bug in the hardware support package.
I have checked older versions of the MKRMotorCarrier library too and there never has been a MKRMotorCarrierBase.h file in this library.

The full text from the log file is below - note the non text carriers being written into the log too...
In file included from C:\Users\teres\AppData\Local\Temp\ArduinoServer\MW\sketch\IO_addOn.cpp:12:0:
addOnLibraries.h:4:204: error: C:\Users\teres\AppData\Roaming\MathWorks\MATLAB Add-Ons\Collections\Arduino_Engineering∩�╜_Kit_Rev_1_Hardware_Suppo∩�╜rt_19a+\matlab\MATLABAddon\+arduinoioaddons\+arduino\src\MKRMotorCarrierBase.h: No such file or directory
#include "C:\Users\teres\AppData\Roaming\MathWorks\MATLAB Add-Ons\Collections\Arduino_Engineering∩�╜_Kit_Rev_1_Hardware_Suppo∩�╜rt_19a+\matlab\MATLABAddon\+arduinoioaddons\+arduino\src\MKRMotorCarrierBase.h"
compilation terminated.

Austin Jacobi

ans =

8×1 cell array

{'Adafruit/MotorShieldV2' }
{'I2C' }
{'RotaryEncoder' }
{'SPI' }
{'Servo' }
{'ShiftRegister' }
{'Ultrasonic' }

you mean listed like that ^. Well I shall still have this problem.

Austin Jacobi

Same as Alberto. please update this.

In file included from C:\Users\Austin\AppData\Local\Temp\ArduinoServer\MW\sketch\IO_addOn.cpp:12:0:
C:\Users\Austin\AppData\Local\Temp\ArduinoServer\MW\sketch\addOnLibraries.h:4:205: fatal error: C:\Users\Austin\AppData\Roaming\MathWorks\MATLAB Add-Ons\Collections\Arduino_Engineering _Kit_Rev_1_Hardware_Suppo rt_19a+\matlab\MATLABAddon\+arduinoioaddons\+arduino\src\MKRMotorCarrierBase.h: No such file or directory
#include "C:\Users\Austin\AppData\Roaming\MathWorks\MATLAB Add-Ons\Collections\Arduino_Engineering _Kit_Rev_1_Hardware_Suppo rt_19a+\matlab\MATLABAddon\+arduinoioaddons\+arduino\src\MKRMotorCarrierBase.h"
compilation terminated.
exit status 1

path looks weird with crazy characters, might be a language pack thing or could be nothing. But I hope theres an answer to this.

@Albert lob

Please download the zip file and then add the unzipped folder to the MATLAB Path. You can do this by navigating to the location of the unzipped folder in MATLAB and then right-click on the unzipped folder and select "Add to Path " and then "Selected Folders and Subfolders". After this, execute the following command in MATLAB:

>> listArduinoLibraries

If you see {'Arduino/MKRMotorCarrier'} listed as one the entries in the cell array then the Hardware Support package is properly installed. You shall not encounter the error message anymore.

Note: These instructions are clearly mentioned in the readMe file and also in the description of the File Exchange.

Alberto Iob

For sure I'm not a pro with matlab and with arduino either, but in any case I spent too many hours trying to make it work with no luck...I followed the procedure for Matlab 2019a (the version that I have) and I the MKRMotorCarrier wasn't showing up in the "Upload Arduino Server". So I red all the threads of people having mine or similar issues and after all now I'm able to select the MKRMotorCarrier library, however, if I include it, when I try to program the board it fails (without that library it succeds)...

C:\Users\amilk\AppData\Local\Temp\ArduinoServer\MW\sketch\addOnLibraries.h:4:204: fatal error: C:\Users\amilk\AppData\Roaming\MathWorks\MATLAB Add-Ons\Collections\Arduino_Engineering _Kit_Rev_1_Hardware_Suppo rt_19a+\matlab\MATLABAddon\+arduinoioaddons\+arduino\src\MKRMotorCarrierBase.h: No such file or directory
#include "C:\Users\amilk\AppData\Roaming\MathWorks\MATLAB Add-Ons\Collections\Arduino_Engineering _Kit_Rev_1_Hardware_Suppo rt_19a+\matlab\MATLABAddon\+arduinoioaddons\+arduino\src\MKRMotorCarrierBase.h"
compilation terminated.
exit status 1

It's very frustrating to see so many people unable to make it work and still no solution available.

Matlab Expert


Timothy McIntyre

This toolbox does not install correctly, leaving my MATLAB stuck in limbo between 18a and 19a/19b. It also does not correctly install the required Arduino libraries or hardware drivers. Once I have manually installed them, I then find run time errors on some machines (not all) where the MATLAB installed fails to program the MKR1000, producing error stating that it cannot find some C++ specified files. These files, strangely, do not appear on the machine that does allow programming to occur...
Can we please have some further testing of the toolbox.

Michael Peterson

How do you install a Matlib zip file?

Mr Deshons

I am unable to install MKRMotorCarrier under 2019b as it is recommended below because i don't understand what means ideroot. It would be easy to find the liabrary on 2019a . Please help me , beacuase i've bought the arduinio Engiennering kit and i can't use it because may laibrtary mkrMotorcarrioer isn't recognised. :

5) Move the MKRMotorCarrier folder into the "libraries" folder inside your Arduino sketchbook folder
On Windows, the default path is "arduinoio.IDERoot\portable\sketchbook\libraries\"
Note: arduinoio.IDERoot is a MATLAB command.

James Hill

This is Wrong! This is the wrong version of MKRMotorCarrier and has been wrong forever!

To install the library - 1) Download the zip file from <<---------------- Do not install this!!!


What you want to download and install is:

Update library to 1.0.5 -----> this is the latest version

elevepsi lamartin

Now a new problem appear when i create a diagram with BNO055 at deployment it crash with the message "File "MATLAB" with symbols of the applicatio running on target hardware not found. If the required name is different from the transport layer protocol defaut use the ExtModeMexArgs parameeter to specify the file.

elevepsi lamartin

Hello, i have a problem with the imu. It works fine with "MKRIMU" examples in ide library but only send zero-zero-zero in simulink. The motorcarrier library is correctly detected but there is no mention of the MKRIMU library in listArduinoLIbraries. Please Help

elevepsi lamartin

The mkr motorshield library is properly installed and detected.

Alex Lan



I received an error when running arduinosetup in MATLAB "fatal error: MKRMotorCarrier.h: No such file or directory". Turned out I needed to install the MKRMotorCarrier library in my Arduino IDE, in Tools...Manage Libraries...

MATLAB Release Compatibility
Created with R2020a
Compatible with R2019a and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!