1
00:00:05,000 --> 00:00:06,000
Hello, friends.

2
00:00:06,000 --> 00:00:12,000
Today I will tell you how to read analog data using Visa.

3
00:00:13,000 --> 00:00:22,000
In this case I just use Arduino board and one potentiometer as you see in the hardware portion over

4
00:00:22,000 --> 00:00:22,000
here.

5
00:00:22,000 --> 00:00:24,000
This is my potentiometer.

6
00:00:24,000 --> 00:00:32,000
I just connect its one end with the five volt or you can say VCC, another end is with, it is connected

7
00:00:32,000 --> 00:00:34,000
to the ground and middle one.

8
00:00:34,000 --> 00:00:37,000
Or you can say wiper is connected to the A zero pin.

9
00:00:38,000 --> 00:00:44,000
So over here I just open Arduino code

10
00:00:47,000 --> 00:00:49,000
for this

11
00:00:51,000 --> 00:00:53,000
particular case.

12
00:00:53,000 --> 00:00:58,000
In this case, one minute it will take some time

13
00:01:04,000 --> 00:01:10,000
over here, this is my Arduino IDE and this Arduino IDE.

14
00:01:11,000 --> 00:01:15,000
I just set a variable,

15
00:01:19,000 --> 00:01:21,000
as you see over here.

16
00:01:21,000 --> 00:01:24,000
This is the code I already write.

17
00:01:24,000 --> 00:01:32,000
I just use this variable name initially, then void setup.

18
00:01:32,000 --> 00:01:35,000
In this case, you have to pinmode.

19
00:01:35,000 --> 00:01:42,000
I'm using a zero and it is my input pin in the Arduino board.

20
00:01:42,000 --> 00:01:52,000
Every value analog value, it is converted into digital value because ADC is present over every pin.

21
00:01:53,000 --> 00:01:53,000
Okay.

22
00:01:53,000 --> 00:02:03,000
So in the Arduino we have total A0 to a5 total six analog pins are there right now I'm using A0 and

23
00:02:03,000 --> 00:02:04,000
over here this is my variable.

24
00:02:04,000 --> 00:02:06,000
I just read analog read.

25
00:02:06,000 --> 00:02:10,000
The pin number is zero serial print line.

26
00:02:11,000 --> 00:02:13,000
And over here this is my variable.

27
00:02:13,000 --> 00:02:16,000
I just put a delay of 50.

28
00:02:16,000 --> 00:02:19,000
You can also check in the serial monitor.

29
00:02:19,000 --> 00:02:21,000
I just run it.

30
00:02:23,000 --> 00:02:26,000
Let's check what value is there over here?

31
00:02:26,000 --> 00:02:27,000
This is the value.

32
00:02:27,000 --> 00:02:28,000
Seven, seven, five.

33
00:02:28,000 --> 00:02:36,000
In the case of when five volt is there, it will print 1024 and when zero volt is there, it will print

34
00:02:36,000 --> 00:02:37,000
zero.

35
00:02:37,000 --> 00:02:43,000
Okay, so this is the code I just upload inside the Arduino board

36
00:02:46,000 --> 00:02:47,000
right now.

37
00:02:47,000 --> 00:02:51,000
As you see, uploading is completed.

38
00:02:52,000 --> 00:02:53,000
I just close this Pi.

39
00:02:54,000 --> 00:02:58,000
Now just go to the lab view over here.

40
00:02:58,000 --> 00:03:08,000
Just go to the instrument input output or here in the serial, I just configure portfast, create control

41
00:03:08,000 --> 00:03:09,000
over here.

42
00:03:11,000 --> 00:03:16,000
Then in this also you need to set the baud rate.

43
00:03:18,000 --> 00:03:22,000
Then you just go to the input output.

44
00:03:23,000 --> 00:03:34,000
Over here you just select bytes at serial port Connect resource to resource error into error out.

45
00:03:34,000 --> 00:03:40,000
After this I just need to still not read.

46
00:03:40,000 --> 00:03:42,000
I just read VSA read.

47
00:03:43,000 --> 00:03:43,000
Okay.

48
00:03:43,000 --> 00:03:48,000
So over here I just I have read visa

49
00:03:50,000 --> 00:03:57,000
connect error into error out bytes at port to this bytes count.

50
00:03:57,000 --> 00:03:58,000
Okay.

51
00:03:58,000 --> 00:04:03,000
So over here I got the data create indicator for this.

52
00:04:04,000 --> 00:04:06,000
It will show me the data.

53
00:04:06,000 --> 00:04:10,000
Now I just close this also.

54
00:04:13,000 --> 00:04:15,000
So close this.

55
00:04:21,000 --> 00:04:26,000
I just connect simple error handler.

56
00:04:27,000 --> 00:04:31,000
Now I just go for continuous reading.

57
00:04:31,000 --> 00:04:33,000
Create control over here.

58
00:04:34,000 --> 00:04:35,000
Over here.

59
00:04:35,000 --> 00:04:36,000
I got the data.

60
00:04:36,000 --> 00:04:39,000
Okay, so this will show me the data.

61
00:04:39,000 --> 00:04:45,000
And over here I have to set the visa resource and this is my stop button.

62
00:04:48,000 --> 00:04:51,000
So now I just hit on run button.

63
00:04:51,000 --> 00:04:55,000
Let's check what happened before this.

64
00:04:55,000 --> 00:04:58,000
You need to set the visa resource also.

65
00:05:00,000 --> 00:05:06,000
As you see over here, it is asking me the com port eight is my source.

66
00:05:06,000 --> 00:05:07,000
When I hit on run button,

67
00:05:12,000 --> 00:05:14,000
I just need to stop it again.

68
00:05:14,000 --> 00:05:15,000
Hit on run button.

69
00:05:24,000 --> 00:05:31,000
So in this case I just reset it, run it again.

70
00:05:35,000 --> 00:05:38,000
My com port is shared right now as you see.

71
00:05:39,000 --> 00:05:40,000
Stop this one.

72
00:05:40,000 --> 00:05:45,000
In this case I just remove my USB again.

73
00:05:45,000 --> 00:05:46,000
Connect it.

74
00:05:50,000 --> 00:05:52,000
Let's check it is shared or not.

75
00:05:53,000 --> 00:06:04,000
Again hit on run button.

76
00:06:04,000 --> 00:06:05,000
Let's check data.

77
00:06:05,000 --> 00:06:06,000
Is there or not?

78
00:06:07,000 --> 00:06:11,000
The data is not visible to us because delay.

79
00:06:13,000 --> 00:06:16,000
I should put some delay also inside this.

80
00:06:18,000 --> 00:06:20,000
So I just put 50.

81
00:06:22,000 --> 00:06:25,000
50 milliseconds delay right now, as you see.

82
00:06:25,000 --> 00:06:29,000
808 is present over here.

83
00:06:29,000 --> 00:06:32,000
And when I move it right now, it is changing.

84
00:06:32,000 --> 00:06:35,000
Right now it is 3 to 6.

85
00:06:36,000 --> 00:06:39,000
So if you want to just maximize it.

86
00:06:40,000 --> 00:06:46,000
Just go over here size, as you see over here, you just got the size.

87
00:06:46,000 --> 00:06:56,000
And if you want some interactive display over here, in this case, I just use the gauge.

88
00:06:58,000 --> 00:07:01,000
And the range of this gauge is 1024.

89
00:07:03,000 --> 00:07:10,000
I just connect this gauge to over here before this because over here data is in string form.

90
00:07:10,000 --> 00:07:12,000
I need to convert this.

91
00:07:12,000 --> 00:07:16,000
I just go to string conversion fractional.

92
00:07:17,000 --> 00:07:19,000
But exponential strain to number.

93
00:07:22,000 --> 00:07:23,000
This is fractional string.

94
00:07:23,000 --> 00:07:26,000
I just connect this number over here.

95
00:07:26,000 --> 00:07:32,000
Right now, when I just hit on the button, as you see over here, I just got the data.

96
00:07:32,000 --> 00:07:37,000
And when I move this, it is changing.

97
00:07:37,000 --> 00:07:41,000
And right now it is maximum.

98
00:07:42,000 --> 00:07:42,000
Okay.

99
00:07:43,000 --> 00:07:46,000
And right now I just change it.

100
00:07:46,000 --> 00:07:52,000
So this is how you can read analog data using visa resource.

101
00:07:52,000 --> 00:07:53,000
This is the code.

102
00:07:53,000 --> 00:07:55,000
This is all about today's lecture.

103
00:07:56,000 --> 00:07:57,000
Thank you.

