What is MQTT Protocol and how it works in IoT Projects

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
if you ever wonder what is an mqtt protocol in iot is all about and how mqtt protocol works then this video will help you understand mqttd is a message queen telemetry transport protocol widely used in iot for device to server and server to client communication because mqtt works in publish and subscribe mechanism it is one of the most popular lightweight protocol which suits variable for iot this video is sponsored by altium software rtm is the piece of a design tool i used in my very first job when i was working for a company in germany using rtm give it two advantages in my opinion one is that you can really build a professional skills and the second one is you can not only build a simple small circuit but you can build a really complex high-speed electronic circuit using altium principle design so claim your free trial today with the link in the video description or somewhere in the comment section and i'm sure you will enjoy working with rgm before we get into advantages of an mqtt protocol let's explore how mqtt works let's take an example to understand the working of an ambiguity protocol let's say we have a three web client namely client one client two and client three here client one is in india and client two is in united states and client three is in germany now when the client 1 wants to send messages to client 2 and client 3 then client 1 will publish message to an mqtt server here publish mechanism is used to send messages and because client 2 and client 3 is subscribed to an mqtt server they will receive that messages here subscribe mechanism is used for client 2 and client 3 to receive messages published by client 1. this communication is possible because all clients are connected to a same central server which is an public mqtt server this mqtt server can be accessible from anywhere in the world in this communication any client can send messages to any other client let's say if client 3 publish message and client 1 and client 2 is subscribed then they will receive that messages published by client 3. this is a typical client and server communication which uses mqtt protocol to publish and subscribe messages back and forth now let's design iot architecture using mqtt protocol here we have lm35 temperature sensor which is connected to nodemcu as a hardware client one and we have given a topic named device slash temp to lm35 a kind of address to represent a sensor now when node mcu which is a client one will publish temperature value 28 degrees celsius the client 2 and client 3 will receive that 28 degree celsius because they both have subscribed to device slash temp topic so in this case we can monitor temperature data in a real time using mqtt protocol now when it comes to controlling devices say for example we have an led which is connected to nodemcu esp8266 and we can assign a topic name device led for an led now when any client either client 2 or client 3 publish message on on topic device led then led will turn on and when any client from client 2 or client 3 publish message off on topic device led then led will turn off this is how mqtt uses publish and subscribe mechanism in iot to control and monitor devices remotely from anywhere in the world let me revisit some key concept learned in this lesson before we use them in our future projects to control and monitor devices remotely from anywhere in the world using mqtt protocol now publish publish is a mechanism used in mqtt to send the messages okay so publish we used to send message to control some device right so that's why we used to publish message on on device led when we want to control the led subscribe subscribe is the mechanism used to receive the data so usually we subscribe to a topic which is basically say for example in our case we subscribe to topic device slash temp because we want to receive the data coming from the client right so basically subscribe we usually use subscribe to the sensor topic so that we can monitor the data so publish is to send means to control and subscribe is to receive the data means to monitor the sensor data you can understand something like this and topic is basically an address is basically a kind of name that is given to a particular device so in our case we have given device slash temp to a temperature sensor and that's become a topic that is assigned that is a name address assigned to that lm35 temperature sensor in our case so topic is a kind of name or the address given to that particular device payload is a message that actually flows through that is basically transferred from the client to one to client two right so payload is a message that actual data which we want to transfer so in our case 28 degree celsius was a temperature value which was a payload that's been transferred that been sent by device temp topic if somebody subscribed so i hope you get this point publish subscribe topic and payload these are very commonly used terminologies in mqtt protocol i hope by now you understood this mqtt related terms check the link in the video description for some other mqtt and iot related project videos thanks for watching and we'll see us into the next video lesson and bye bye for now
Info
Channel: BINARYUPDATES
Views: 25,615
Rating: undefined out of 5
Keywords: mqtt, protocol, iot, mqttprotocol
Id: irq66O8NdvA
Channel Id: undefined
Length: 5min 42sec (342 seconds)
Published: Sat May 21 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.