WEBVTT - This file was automatically generated by VIMEO

0
00:00:08.200 --> 00:00:11.100
Welcome back guys to video number 4.5. And in this

1
00:00:11.100 --> 00:00:14.600
 year video, we're going to set up the mesh Network. Actually. We

2
00:00:14.600 --> 00:00:17.100
 have a lot of use cases regarding the

3
00:00:17.100 --> 00:00:20.700
 mesh Network where we cannot depend upon

4
00:00:20.700 --> 00:00:23.300
 the routers. For example, we are

5
00:00:23.300 --> 00:00:26.900
 going to deploy our sensors in a smart agriculture field

6
00:00:26.900 --> 00:00:29.500
 where we have a hundreds of

7
00:00:29.500 --> 00:00:32.400
 sensors, which are Wi-Fi enabled so

8
00:00:32.400 --> 00:00:35.600
 we can't apply the Wi-Fi routers across all

9
00:00:35.600 --> 00:00:38.400
 the fields and there are some other

10
00:00:38.400 --> 00:00:41.100
 use cases like in smart cities, for example, if you want

11
00:00:41.100 --> 00:00:44.600
 to monitor the garbage pins, so we

12
00:00:44.600 --> 00:00:48.500
 cannot deploy the router on every State Street and

13
00:00:47.500 --> 00:00:50.300
 same like if we

14
00:00:50.300 --> 00:00:53.000
 want to get the reading for the electric meters or

15
00:00:53.400 --> 00:00:56.400
 water meters. So the mash Network have a wide

16
00:00:56.400 --> 00:00:59.800
 variety of use cases to send the data from one

17
00:00:59.800 --> 00:01:02.600
 to another node. And the other node will be responsible to

18
00:01:02.600 --> 00:01:05.100
 send the its own data and

19
00:01:05.100 --> 00:01:08.000
 the previous note data to the next node and this

20
00:01:08.100 --> 00:01:11.200
Will make a chain and specially it is a good

21
00:01:11.200 --> 00:01:15.500
 option in case of natural disasters where

22
00:01:14.500 --> 00:01:18.300
 we cannot use the

23
00:01:18.300 --> 00:01:22.400
 heavy equipment for the communication. Then Wi-Fi. Mesh

24
00:01:21.400 --> 00:01:24.700
 networks are good to go with that. Okay before

25
00:01:24.700 --> 00:01:27.600
 moving on we need to set up some

26
00:01:27.600 --> 00:01:30.800
 libraries. So just click on the sketch and click

27
00:01:30.800 --> 00:01:32.400
 on the manage libraries.

28
00:01:40.900 --> 00:01:43.700
Firstly we need to install a library called

29
00:01:43.700 --> 00:01:46.900
 painless mesh Library

30
00:01:46.900 --> 00:01:49.200
 just type the painless and you will get the

31
00:01:49.200 --> 00:01:52.500
 library. I already have installed. And by

32
00:01:52.500 --> 00:01:56.300
 the way, this Library will depend on three other

33
00:01:55.300 --> 00:01:58.500
 libraries one is Arduino Jason

34
00:01:58.500 --> 00:02:02.400
 and others are async TCP

35
00:02:01.400 --> 00:02:04.600
 and the espa sync TCP.

36
00:02:04.600 --> 00:02:07.300
 Async TCP is for esp32 development

37
00:02:07.300 --> 00:02:12.100
 boards and espe async TCP

38
00:02:11.100 --> 00:02:14.500
 libraries for esp826 series

39
00:02:14.500 --> 00:02:17.000
 4, so just type A sync TCP.

40
00:02:20.100 --> 00:02:21.900
And here we need to find the library.

41
00:02:22.700 --> 00:02:25.400
I will show you which other Library

42
00:02:25.400 --> 00:02:30.700
 we need to use. Yes, the actually that devrel this

43
00:02:29.700 --> 00:02:33.000
 is the author and the

44
00:02:32.600 --> 00:02:35.800
 fork from the github.com me no

45
00:02:35.800 --> 00:02:38.000
 Dev. Async TCP. You need to

46
00:02:38.200 --> 00:02:40.700
 install that library and the other is

47
00:02:43.400 --> 00:02:46.100
ESP async TCP if

48
00:02:46.100 --> 00:02:49.500
 you are going to use only esp32 development boards,

49
00:02:49.500 --> 00:02:52.100
 then you didn't have required to

50
00:02:52.100 --> 00:02:56.000
 install that but if you are going to use esp8266 series

51
00:02:55.400 --> 00:02:58.600
 development board, then this library is mandatory

52
00:02:58.600 --> 00:03:01.500
 either you have all the esp826 series

53
00:03:01.500 --> 00:03:04.700
 board or you have a mixture of esp32 and

54
00:03:04.700 --> 00:03:08.300
 esp826. Then we're good to go with that. Okay after installing

55
00:03:07.300 --> 00:03:10.600
 that Library click on the file and

56
00:03:10.600 --> 00:03:13.400
 in the example come here

57
00:03:13.400 --> 00:03:16.300
 and here we have a painless mesh and

58
00:03:16.300 --> 00:03:19.700
 just click on the basic. Okay. So if

59
00:03:19.700 --> 00:03:22.700
 I go to the tools and see the

60
00:03:22.700 --> 00:03:25.200
 com ports, okay on the Comm 15,

61
00:03:25.200 --> 00:03:28.400
 we have a esp32 oncom 14. We have

62
00:03:28.400 --> 00:03:31.400
 the most D1 mini ESP 32 and on

63
00:03:31.400 --> 00:03:35.000
 Chrome 7. We have esp826 series

64
00:03:34.300 --> 00:03:38.100
 4, by the way, these are the development

65
00:03:37.100 --> 00:03:40.400
 boards that I connected and

66
00:03:40.400 --> 00:03:42.800
 these are the power down. I didn't use

67
00:03:43.400 --> 00:03:46.600
Camera for that because there's a no requirement to use.

68
00:03:46.600 --> 00:03:47.200
 Okay.

69
00:03:48.200 --> 00:03:51.400
Right. Now we only have option to monitor the

70
00:03:51.400 --> 00:03:54.600
 one calm and which is come 14 and the

71
00:03:54.600 --> 00:03:57.300
 vmos D1 mini sp32 is connected on that

72
00:03:57.300 --> 00:04:00.400
 click on the serial Monitor and here we're

73
00:04:00.400 --> 00:04:03.700
 getting the data what how we can see the data from

74
00:04:03.700 --> 00:04:06.300
 the other nodes. So that's why

75
00:04:06.300 --> 00:04:09.200
 I use the putty. So click on

76
00:04:09.200 --> 00:04:11.500
 that and here select the com.

77
00:04:12.500 --> 00:04:13.000
15

78
00:04:14.100 --> 00:04:16.700
for the esp32 and the speed

79
00:04:17.600 --> 00:04:18.500
Is here?

80
00:04:19.400 --> 00:04:22.300
Sorry, we need to copy that speed from here the serial

81
00:04:22.300 --> 00:04:23.400
 Port speed. Okay?

82
00:04:27.800 --> 00:04:30.400
No worries. Okay open up

83
00:04:30.400 --> 00:04:33.200
 and here we will see all the stuff. Okay.

84
00:04:33.200 --> 00:04:37.100
 And again, we need another pretty

85
00:04:36.100 --> 00:04:38.500
 terminal for the

86
00:04:40.300 --> 00:04:43.300
vmos D1 Mini esp82 double 6

87
00:04:44.100 --> 00:04:47.500
And open up and we are good to go with that.

88
00:04:47.500 --> 00:04:50.500
 And if you see here, they are showing all the stuff

89
00:04:50.500 --> 00:04:53.400
 the data is coming from the node. You will

90
00:04:53.400 --> 00:04:56.200
 see here. The data is coming from the 49 and the

91
00:04:56.200 --> 00:04:59.400
 91 node, but it's not showing the third note because

92
00:04:59.400 --> 00:05:02.500
 this node is not showing its

93
00:05:02.500 --> 00:05:05.300
 own messages. But if you see here, you will

94
00:05:05.300 --> 00:05:08.600
 get the different IDs here like seven seven

95
00:05:08.600 --> 00:05:11.500
 nine one and seven eight

96
00:05:11.500 --> 00:05:14.500
 six nine. Okay. So if we

97
00:05:14.500 --> 00:05:17.200
 talk here then the 949 is that

98
00:05:17.200 --> 00:05:20.200
 esp32 node number? Okay,

99
00:05:20.200 --> 00:05:23.400
 and if we come here then it's showing

100
00:05:23.400 --> 00:05:24.600
 the 949.

101
00:05:25.500 --> 00:05:28.700
And 869 and

102
00:05:28.700 --> 00:05:30.400
 other is not coming here. Okay.

103
00:05:31.200 --> 00:05:31.300
so

104
00:05:33.100 --> 00:05:34.700
I will do some experiment with that.

105
00:05:36.100 --> 00:05:40.100
Just resetting the esp8266 and

106
00:05:39.100 --> 00:05:42.500
 here you will see that we have a reset everything,

107
00:05:42.500 --> 00:05:42.900
 okay?

108
00:05:43.800 --> 00:05:46.600
but certainly you will see here adjusted

109
00:05:46.600 --> 00:05:48.400
 time is there and

110
00:05:49.900 --> 00:05:52.300
The new node is coming here and the data is

111
00:05:52.300 --> 00:05:55.200
 coming from there. So this is the experiment by which

112
00:05:55.200 --> 00:05:58.100
 I show you how that thing is

113
00:05:58.100 --> 00:06:01.100
 a working on now. It's time to come to the

114
00:06:01.100 --> 00:06:05.300
 code. So here is the painless mesh.h library

115
00:06:05.300 --> 00:06:06.800
 and

116
00:06:07.900 --> 00:06:10.600
This is the perfect for the my smart agriculture

117
00:06:10.600 --> 00:06:13.500
 match. Okay. The one thing is that if you click here, then you

118
00:06:13.500 --> 00:06:17.500
 will see that mesh Network in the Wi-Fi. My

119
00:06:16.500 --> 00:06:19.000
 smart agree mesh. Okay. This is

120
00:06:19.200 --> 00:06:22.200
 the password and this is the mesh port number. You can

121
00:06:22.200 --> 00:06:25.800
 change it according to your requirement on that

122
00:06:25.800 --> 00:06:28.200
 board. The tcp/ip server will

123
00:06:28.200 --> 00:06:30.400
 be started for the communication.

124
00:06:31.300 --> 00:06:34.200
By the way, this library is using the

125
00:06:34.200 --> 00:06:37.500
 user scheduler library to schedule the task instead of

126
00:06:37.500 --> 00:06:40.300
 a timer. This is more enhanced as compared

127
00:06:40.300 --> 00:06:42.200
 to the diamond Library. Okay, here we are.

128
00:06:44.600 --> 00:06:47.500
Creating a painless mesh object by

129
00:06:47.500 --> 00:06:50.800
 the name of mesh and here is the message send message

130
00:06:50.800 --> 00:06:53.100
 and in the tasks and message. What it will

131
00:06:53.100 --> 00:06:56.700
 do is after one second. It will call that

132
00:06:56.700 --> 00:06:59.400
 message. Send message and here is the implementation of

133
00:06:59.400 --> 00:07:02.400
 send message. What it is doing is the messages.

134
00:07:02.400 --> 00:07:05.700
 Hello from the node. And here is the mesh.get node

135
00:07:05.700 --> 00:07:08.300
 it and this message dots and

136
00:07:08.300 --> 00:07:11.400
 broadcast. By the way, you guys can send the messages

137
00:07:11.400 --> 00:07:14.700
 to the specific node by mentioning to

138
00:07:14.700 --> 00:07:17.100
 the node Name. By the way, there are

139
00:07:17.100 --> 00:07:19.900
 examples come to the file example.

140
00:07:20.800 --> 00:07:23.600
And in the painless mesh here is

141
00:07:23.600 --> 00:07:26.700
 the named mesh and here you

142
00:07:26.700 --> 00:07:26.800
 need to.

143
00:07:28.800 --> 00:07:31.500
Mention the node name and then

144
00:07:31.500 --> 00:07:34.300
 you also need to mention or to which

145
00:07:34.300 --> 00:07:37.100
 node you want to send the message. And by the way, this is

146
00:07:37.100 --> 00:07:40.400
 a good to send the message to the specific nodes to control

147
00:07:40.400 --> 00:07:42.600
 the traffic load.

148
00:07:44.300 --> 00:07:47.500
Okay. Now let's come back to the point and send the broadcast

149
00:07:47.500 --> 00:07:51.000
 and after that again call that method after

150
00:07:50.200 --> 00:07:53.800
 the random interval to send

151
00:07:53.800 --> 00:07:56.700
 the message actually why this is random interval to

152
00:07:56.700 --> 00:07:59.600
 avoid the flooding of messages. For

153
00:07:59.600 --> 00:08:02.300
 example, if you put the delay of one second two second

154
00:08:02.300 --> 00:08:05.900
 or five seconds, then it will start making flooding in

155
00:08:05.900 --> 00:08:08.300
 the mash Network which will make it

156
00:08:08.300 --> 00:08:11.600
 down right now. We have a three nodes, but if you have 100 nodes,

157
00:08:11.600 --> 00:08:14.400
 it will make a complex. So it is a good option to

158
00:08:14.400 --> 00:08:17.200
 use random. By the

159
00:08:17.200 --> 00:08:20.600
 way, if we talk about the applied mesh

160
00:08:20.600 --> 00:08:23.800
 Network in the field, then we have a specific

161
00:08:23.800 --> 00:08:27.500
 time. We cannot send the message randomly

162
00:08:26.500 --> 00:08:29.600
 because there we

163
00:08:29.600 --> 00:08:32.500
 will Define the rules when we need to send the data to

164
00:08:32.500 --> 00:08:36.200
 other node. Okay, and here are the received callbacks

165
00:08:35.200 --> 00:08:38.200
 new connection call back if you want to.

166
00:08:40.100 --> 00:08:44.200
Add new functionality the on the receiving callback. Then

167
00:08:44.200 --> 00:08:48.100
 this method is there and if you want to set up some

168
00:08:47.100 --> 00:08:51.400
 functionality regarding a when new connection come then

169
00:08:50.400 --> 00:08:53.700
 you can use that method and

170
00:08:53.700 --> 00:08:56.600
 here is the change connection callback. For

171
00:08:56.600 --> 00:08:59.500
 example connection type has been changed another type. You

172
00:08:59.500 --> 00:09:02.700
 can use that method and no time adjusted call

173
00:09:02.700 --> 00:09:05.600
 back to adjust the node time. Okay, and here

174
00:09:05.600 --> 00:09:09.900
 is a setup where we are beginning serial dot

175
00:09:09.900 --> 00:09:12.300
 begin and setting up the mesh Network on

176
00:09:12.300 --> 00:09:15.900
 receive at task and enable and

177
00:09:15.900 --> 00:09:18.600
 in the loop. We have a mesh Dart update. It's

178
00:09:18.600 --> 00:09:21.900
 running in the loop to get updated

179
00:09:21.900 --> 00:09:24.400
 if there's any node coming

180
00:09:24.400 --> 00:09:27.000
 if there is any more leaving by the way,

181
00:09:27.300 --> 00:09:30.700
 it is a mandatory task to maintain the routing table of a

182
00:09:30.700 --> 00:09:33.700
 mesh Network. So this is the complete code

183
00:09:33.700 --> 00:09:36.600
 and I hope you guys like that now,

184
00:09:37.600 --> 00:09:40.300
Implement with the DHT 11 or

185
00:09:40.300 --> 00:09:43.500
 dht22 sensor to send the temperature and humidity

186
00:09:43.500 --> 00:09:46.300
 from one node to the any other node, or you

187
00:09:46.300 --> 00:09:46.700
 can make it.

188
00:09:48.200 --> 00:09:48.500
for example

189
00:09:49.500 --> 00:09:52.000
you can put a sensor on the street and in the

190
00:09:52.300 --> 00:09:55.900
 middle just Place different esp826 series

191
00:09:55.900 --> 00:09:58.400
 board and in the end of

192
00:09:58.400 --> 00:10:01.200
 street, especially your street should be

193
00:10:02.200 --> 00:10:04.600
300 to 500 meter long

194
00:10:05.500 --> 00:10:07.100
Where you will test how?

195
00:10:08.200 --> 00:10:10.300
We can take the benefit of mesh Network.

196
00:10:10.700 --> 00:10:13.000
So guys in the next video. We're going to

197
00:10:13.200 --> 00:10:16.200
 talk about pros and cons of Wi-Fi and see you in the next video. Have a good

198
00:10:16.200 --> 00:10:16.600
 day. Bye.
