1.3 Print Analog input from a potentiometer on Matlab Command Window using Arduino

In this project, we are going to print analog value from a potentiometer connected to Arduino on Matlab Command Window .

ALL MATLAB GUI TUTORIALS:

1.5.1: Creating GUI :”Interfacing L298N with Arduino using MATLAB GUI” (PART 2)

1.5.0 PROJECT OVERVIEW: Interfacing L298N motor driver with Arduino using Matlab GUI

1.4 Potentiometer’s analog input to control brightness of LED using Arduino and Matlab GUI

1.3 Print Analog input from a potentiometer on Matlab Command Window using Arduino

1.2 Controlling brightness of LED using Matlab GUI and Arduino in 2017

1.1 Controlling status of LED from MATLAB GUI and Arduino in 2017

1.0 Installing Arduino support package & Matlab GUI basics in 2017

We will create a Matlab GUI with one Pushbutton object. And when pressed, we will get corresponding voltage value printed on the command window of Matlab.

 

 

Welcome to the fourth tutorial or tutorial no. 1.3 of the course “using MATLAB GUI with Arduino support package”.Click here TUTORIAL 1.2  to read previous tutorial.

 

Watch the video version of this project for better understanding:

1. First of all create this GUI in Blank GUI and then run it.(How to create GUI on Matlab)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2. Double click on Static Text to change its properties:

 

FontSize= “16”;

ForegroundColor= “Blue”;

String= “readVoltageValue”

Tag= “readVoltageValue”

 

 

 

 

 

 

 

 

 

 

 

 

 

3. Double click on PushButton to change its properties:

 

 

FontSize = “12”;

ForegroundColor = “RED”;

String = “FIRE”

Tag = “FIRE”

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4. Click on Run,  GUI looks like this:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

5.Now under Opening function type these commands:

 

 

clear all;

global a;

a= arduino(‘COM3’);

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

6.Under function FIRE type:

global a;

x=readVoltage(a,0);

disp(x);

 

 

 

 

 

NOTE: Codes are explained in detail in the above video ^.

 

 

 

7.SETUP:

 

 

Potentiometer’s end terminals to 5V and Gnd pin of Arduino respectively.

whereas wiper terminal to analog pin A0.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

8. Click on Run:

 

 

 

 

 

 

 

 

 

 

9. Rotate potentiometer and hit fire:

 Values printed on Command Window for

different positions of wiper terminal:

 

 

1 Comment

One Reply to “1.3 Print Analog input from a potentiometer on Matlab Command Window using Arduino”

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: