File Exchange

image thumbnail

Arduino-Engineering-Kit-Rev-1-Hardware-Support-19a+

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

114 Downloads

Updated 11 Apr 2020

View License

Note: This version is for MATLAB release R2019a and later.

If you are using MATLAB R2018b, use this version: https://www.mathworks.com/matlabcentral/fileexchange/68620-arduino_engineering_kit_hardware_support_18b
If you are using MATLAB R2018a, use this version here:
https://www.mathworks.com/matlabcentral/fileexchange/66568-arduino_engineering_kit_hardware_support

This package includes MATLAB and Simulink files that allow users to communicate with and control the sensors and actuators used in the Arduino Engineering Kit, most of which are connected through the MKR Motor Carrier. This includes:
• 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
• Tachometer – read rotational speed from the hall sensor on the motorcycle’s inertia wheel
• BNO055 IMU sensor – read from the accelerometer, magnetometer, and gyroscope
• Ultrasonic sensor – measure the distance to an object
• LiPo Battery – read the battery voltage

Examples are included to demonstrate how to use the MATLAB functions and Simulink blocks included in this package.

Learn more about the Arduino Engineering Kit at www.mathworks.com/arduino-kit

Important Notes:

1) You can either download the toolbox or the zip file.
a) If you choose to download the toolbox, complete its installation in MATLAB.
b) If you choose to download the zip file, add the unzipped folder to the MATLAB path.

The MKRMotorCarrier library from Arduino is essential for the hardware support to work. If you are on MATLAB R2020a or above, then this library is already a part of the MATLAB Support Package for Arduino Hardware, and hence you can skip to step 8.

If you are on MATLAB R2019a or R2019b, follow steps 2 and 3.

2) Download the zip file from https://github.com/arduino-libraries/MKRMotorCarrier/archive/1.0.1.zip
3) Unpackage the zip into local directory and rename the folder to 'MKRMotorCarrier'

If you are on MATLAB R2019b, skip steps 4 and 5

4) Move the MKRMotorCarrier folder into the "libraries" folder inside your Arduino sketchbook folder
On Windows, the default path is "Documents\Arduino\libraries\"
On Mac, the default path is "~/Documents/Arduino/libraries/"
On Linux, the default path is "/home/<username>/Arduino/libraries"
5) Once the libraries are installed, the folder structure should be similar to:
On Windows "\Documents\Arduino\libraries\MKRMotorCarrier\src"
On Mac, "~/Documents/Arduino/libraries/MKRMotorCarrier/src"
On Linux, "/home/<username>/Arduino/libraries/MKRMotorCarrier/src"

If you are on MATLAB R2019b, follow steps 6 & 7 instead of 4 & 5, else skip to step 8

6) Move the MKRMotorCarrier folder into the "libraries" folder inside your Arduino sketchbook folder
On Windows, the default path is "arduinoio.IDERoot\portable\sketchbook\libraries\"
On Mac, the default path is "~/Documents/Arduino/libraries/"
On Linux, the default path is "arduinoio.IDERoot/portable/sketchbook/libraries/"
Note: arduinoio.IDERoot is a MATLAB command.
7) Once the libraries are installed, the folder structure should be similar to:
On Windows, "arduinoio.IDERoot\portable\sketchbook\libraries\MKRMotorCarrier\src"
On Mac, "~/Documents/Arduino/libraries/MKRMotorCarrier/src"
On Linux, "arduinoio.IDERoot/portable/sketchbook/libraries/MKRMotorCarrier/src"

For all releases of MATLAB

8) Type listArduinoLibraries in MATLAB Command Window and you should see
{'Arduino/MKRMotorCarrier'} among others in the cell array.
If the MKRMotorCarrier library does not appear in the cell array, ensure
step 4 and step 5 (or step 6 and step 7) are executed correctly.

Cite As

MathWorks Maker Team (2020). Arduino-Engineering-Kit-Rev-1-Hardware-Support-19a+ (https://www.mathworks.com/matlabcentral/fileexchange/70554-arduino-engineering-kit-rev-1-hardware-support-19a), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (19)

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 support@mathworks.com

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 support@mathworks.com

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.

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.

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.

ans =

8×1 cell array

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

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

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.

nice

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.

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 https://github.com/arduino-libraries/MKRMotorCarrier/archive/1.0.1.zip <<---------------- Do not install this!!!
*******------------------------

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

What you want to download and install is:

https://github.com/arduino-libraries/MKRMotorCarrier

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

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.

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

The mkr motorshield library is properly installed and detected.

Alex Lan

Great!

bullox

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...

Updates

1.3.6

Updated the title of the submission

1.3.5

Fixed path issues with the toolbox file (Installer)

1.3.4

Removed link to a broken toolbox.

1.3.3

Fixed path issues with the toolbox.

1.3.2

Updated the title of the File Exchange Submission.

1.3.1

Repackaged the new toolbox

1.3

Updated the description.

1.2

Fixed a bug related to simultaneous I2C object creations in MATLAB.

1.1

Updates:

1) Updating the title to include reference to R2019b
2) Updating the readme.txt to include instructions for R2019b, as they are slightly different

1.0.2

Updating the documentation file to include note about ultrasonic sensor

1.0.1

Updating MATLAB Release Compatibility

MATLAB Release Compatibility
Created with R2019a
Compatible with R2019a to any release
Platform Compatibility
Windows macOS Linux
Communities

matlab/MATLABAddon/+arduinoioaddons/+arduino