Welcome back guys to video number 7.6 and this
is the last video of that section. And in this
video. We're going to send the data from esp82664 to
the cloud mqtt broker. So
guys, let's get started with that. So firstly we need to
before moving on. Actually. I'm
just
Going to show you a demo how to use
mqtt library and Arduino ID
to send the data to the mqtt broker and
I will display that I in web-based mqtt
client, which is mqtt.ron, obviously. Okay.
I'm not going to attach any sensor because my
totally focus is on to guide you about the library not
to about the sensor. So before moving
on we need to install the library regarding
the mqtt. Okay, so sketch
in libraries and
include library and here we will search about the different
mqtt libraries and only install the Arduino official
Library.
type mqtt here
and it will show you a lot of mqtt libraries. So
we need to install Arduino mqtt client version
0.1.6, which is
developed by the Arduino. I already installed it.
So just you need to click on that and install for
your machine, okay, and click on
the file examples and
Here we have Arduino mqtt client. So click on
the Wi-Fi simple.
sender
So here we need to.
Verify the chord. Okay. These are the
header files that are dino will
use according to the port development board. If there is a Arduino
mkr WiFi 1010, then
it will use a specific library or Nano 33 or Arduino
on a Wi-Fi F2. Then this Library
will work. If it is already know. I'm
care 1000 then this Library will work if it is esp8264. And
this Library will be included if we
sp32 then this letter will be included and
Arduino secrets are where we
need to mention our username and the password
of the SSID in my case. I have a
maker and
It is the password.
Please make it blur.
Okay, and now we are good to go with the configuration.
Okay. Now here is the test mosquito
broker. We have a different brokers
available.
like
Test art mosquito. It is free public
broker and emqx public
broker.
You guys can use any of
Broker there is another Hive mq public.
broker
So without spending any when you get
these free mqtt broker to test
your application in the live environment. Okay. So
here are the information here are the different port numbers
Okay, so
Here we need to mention the broker detail you
can I simply use the Local Host? But I'm
using the test our mosquito.org the port
number one. 883. Okay, let's make it different
broker dot emqx.io. Okay.
and the port is 1883, which is also same here
18883 and
but for the web sockets
We need to use a 0 8 3 Port
okay.
Here zero eight three and to topic
/ homes /
You can say that.
Cities / homes / Room
1 / temperature. Okay, we're going
to use that.
topic
instead of that. Okay next.
It is trying to connect with the Wi-Fi. I'm
not going in the details and in the loop it
is doing is mqtt decline.poll. And
yes, it is the main method where the
mqtt is starting.
Yes, and
here it will tap the begin message topic print.
Hello count and it's sending the message to the
Broker, okay, so just I'm
going to send that.
What you need to verify the board? Yes board is connected and we
are good to go with that.
And here I need to click on the connect.
And we're good to go with that.
Now we just need to wait.
For the core to be uploaded to the device it took some time.
Core has been successfully uploaded to the device. Just click
on the serial Monitor and here we will see
the
all the message detail from the device.
That puts going on.
That's nowhere connected to the mqtt broker.
Sending the message and here. Yeah.
We are seeing the message instantly. So now
all the communication is happening while the broker
dot emqx.io, which is live on
the internet and
When you're saying that how the device is sending
instantly message while the mqtt broker.
So guys, I hope you understand that stuff. If you have any question,
please feel free to send a message. We in the message box,
and I will try my best to accommodate your queries and
see you in the next section where we're
going to talk about the cope and other application layer
protocols the next section of a good
day, bye-bye.