Today I will show you how to load the data from any sensor, any potentiometer, using any USB 6001
in Matlab.
For that purpose I just use a potentiometer.
As you see over here.
This is my potentiometer.
I just connect it.
It's one edge, one port to the VCC.
That is five volt.
Another one to the ground and middle one.
This one is your white pin or middle wiper position.
It is connected to the pin number two, analog pin number two.
As you see over here, right now I'm using I two.
So this is ground six.
One is ground and middle one two.
It is differentially connected.
That's why I just ground six number pin also.
And this one white one is connected to pin number 2I2.
So now we just first grab the data.
So we need to go to the Simulink.
As you see over here I have the code.
So let's I just.
Do it from the start.
Analog input I just require over here you just need to select the analog pin.
As you see, I just need to select only a two because I'm using this pin over here.
You can set the value also, but initially it is default as -10 to 10.
Apply it.
You can also set this value.
Okay, now I just need a display to check the value.
So just connect this display.
I need a scope.
It was late on a graph and to load these value I just need to add these all values to my workspace.
I'm just using two workspace and from workspace I just take these values and plot these values.
So I just hit on run button.
You can check these values on scope also.
As you see right now, value is 0.8 something.
So now I just increase the value as you see.
Now I just decrease the value.
It is happening at different instants of time, as you see right now, increasing again, decreasing.
Right now it is zero again I just.
Move it.
Now it is maximum 4.95.
Again Decrease.
Increase.
Decrease.
Increase.
Decrease.
Increase.
So now I just stop it.
Let's check.
On workspace.
So I just minimize this window.
Close this window.
And over here I have our data.
Just select this.
And total I have 5041 values.
If you want to check different values, as you see we will just start from 0.8043.
And over here you can find out different values.
Right now again it is 0.84.
For an instant now it is increasing when we just move.
Let's see.
Right now it is 91.2, 1.5, 2.9.
So let's check the data pattern on the Excel.
So I just select all data copy it control C.
Now I just go to Excel.
Create a new Excel.
You can plot it on Matlab also.
But right now I'm just showing you the data on Excel.
So control V.
Now total data is available over here.
Let's check this data on a graph.
Let's say I'm just using this graph.
So over here you can find out different data data patterns related to different values.
So over here this is if you want to just go with only this value, you can let's say if you want to
select a particular part.
Select over here.
From here our values changing.
Let's say I want to plot only this part.
Insert.
Data.
As you see both the values, you can find out over here.
This is the pattern how value changes.
Okay, so this is all about how to load the data.
Let's say I want to just.
Select only this one row.
Select this insert.
Now you can find out how the value changes.
Okay.
And if you want to go with different pattern let's say this one.
This is the main part over here.
The how the potentiometer values changes.
As you see it is nearly 0.8.
Then it goes high then low high low high low.
This is the pattern how we change the potentiometer value.
And this is all about today's lecture how we load the data in the Matlab.
Thank you.