Welcome to the course “Using Arduino support package with Matlab GUI”
This is the very first tutorial of the series. So we will be covering some basics first. First, we will install the Arduino support package on Matlab. Then we will learn some Arduino commands for Matlab GUI which we need for upcoming Arduino-GUI projects. And at last, we will learn some basics of Matlab Graphical User Interface.
For visual detailed step by step process, watch this video:
A) INSTALLING ARDUINO SUPPORT PACKAGE
1. Open Matlab and click on “Add-Ons” on the top right corner and then click on “Get Hardware Support Packages”
2. A window will appear with four options, click “Install from Internet” and then “Next”
3. Select Arduino from ‘Support for :’ Menu, select install and click “Next”
4. A new window will appear asking you to log in to Mathworks. After login, you can download and install the Arduino support package.
B) ARDUINO COMMANDS FOR MATLAB GUIDE
1. After successful installation of Arduino Support Package, connect your Arduino Board to Laptop/pc
2. Then go to command window and type “a=arduino”
2. A list of data regarding connected your Arduino will appear
Port: to which COM port your Arduino is connected
Board: which Arduino board is connected.
3. Now type ” methods(a)” on command window
4. List of Arduino commands will appear:
Commands we will be using in this course:
1) configureAnalogpin : initialise analog pin as INPUT or OUTPUT
2) configureDigitalpin : initialise digital pin as INPUT or OUTPUT
3) display : for displaying any variable value on Command Window
4) readDigitalPin : read input from digital pins ( voltage)
5) WriteDigitalPin : write voltage value on digital pin ( max 5v)
6) writePWMVoltage : write PWM value or voltage on PWM pins of Arduino
7) I2C, SPI and servo : these are the libraries for Arduino.
C) MATLAB GUIDE BASICS
1. Go to “NEW” and select “Graphical User Interface”
2. Select “Blank GUI(default)” and click “Next”
3. This is the interface of the Matlab GUI. Now select pushbutton from the toolbox on left and place it on the panel:
4. Double click on pushbutton to open its properties.
NOTE- Properties of all functions are explained in above video.
5. Click on “Run button”, a window of GUI we made and its program will open.
NOTE: We will give input or instructions to Arduino directly from GUI( like from a pushbutton) and proper Arduino commands are added in the program for execution of those instructions.