Arduino Target for Simulink
From Matt Bilsky
Contents
Installing the Arduino Package in Simulink 2011
To install the Arduino Target for Simulink:
- Download the package located here: http://www.mathworks.com/matlabcentral/fileexchange/30277
- Extract the zip file to an easy to find location (i.e. C:/arduinoTarget)
- Note that it is important to select a folder that has no spaces in the path
- Follow the installation instruction located at C:/arduinoTarget/README.txt
Note the following changes to the instructions from MathWorks:
- We are going to use the Arduino IDE version 23 which may be downloaded here: http://arduino.cc/en/Main/Software. Just extract the archive to an easy to located directory (i.e. your desktop)
- As stated in the README file, PIL (processor in the loop) mode is only supported in matlab 2011b or later. This guide was written using 2011a.
Configuring IDE Model
At the Matlab command prompt execute the following:
- Set the path of your Arduino IDE: arduino.Prefs.setArduinoPath('c:\Program Files\arduino\arduino-0023')
- To see a list of supported Arduino boards: arduino.Prefs.setBoard
- Choose your specific board: arduino.Prefs.setBoard('uno')
- Search for available COM ports: comPorts=arduino.Prefs.searchForComPort
- Set your COM port: arduino.Prefs.setComPort('COM9');
Available Demos from MathWorks
Type the name of the demonstration at the Matlab command prompt to launch the model
- demo_arduino_blink
- demo_arduino_blink_challenge
- demo_arduino_blink_challenge_stateflow
- demo_arduino_serial_communication
- demo_arduino_serial_communication_host
Below is a video showing the install process performed in Simulink 2011a
(Set playback to 720p for a clearer picture)