🔴 MQTT in 7 Minuten einfach erklärt,….…JEDER KANN DAS! | #EdisTechlab

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello and welcome to Edis Techlab. Today we are talking about MQTT. This is a message protocol for communication between machine to machine. How the whole thing works and is structured, let's take a look today. It is very simple and EVERYONE CAN DO IT!!!. The Message Queuing Telemetry Transport, short MQTT, is an open message protocol for machine-to-machine communication. Since 2013 the protocol for the Internet of Things, IoT, has been standardized and the current version is 5.0. A very big advantage of MQTT is that it is a very simple and lightweight protocol that requires very little bandwidth and can be excellent for our small microprocessor microprocessor. But what is an MQTT network like? structured? First of all, we need a broker. The broker is the post office, so to speak, to which to which all messages are sent. As a broker we use our Raspberry Pi with the software Mosquitto. You can find out how to set this up in another video. I'll introduce you to the link at the bottom of the video description. Let's take temperature sensor as an example, the we have installed on our balcony. This sensor now sends the temperature data periodically to our blocker. To do this, it uses the topic balcony/temperature/. As message content, i.e. payload, the 21 degrees C are sent. The topics are organized hierarchically, i.e. in like your file system on the computer. You must be careful, the whole thing is case-sensitive, so note that it is case sensitive. Now the broker cannot only accept data, but also send it on again. If you now for example on your phone the current temperature from the balcony on your phone, you have to select the subscribe to the topic balcony/temperature/. Every time, when the temperature sensor sends new data, you will automatically receive it on your phone because you have subscribed to the topic Temperature from the balcony. Would I now like for example, start a fan automatically when a automatically when a certain temperature is reached, I must first subscribe the temperature data to the broker first. If I subscribe the temperature data have been transmitted by the broker, I can evaluate it and now, if necessary, I can use the switch the fan on or off. Now again briefly summarized. Messages always exist consist of a topic and the message content. Data can only be read if the associated topic. But how is is the data transmitted? We can find out in the QoS. This means Quality of Service and there are three security levels. QoS level 0 only guarantees that a message arrives at most once. That a message arrives at all is not guaranteed by QoS 0. Therefore, this message exchange pattern is also called Fire & Forget. QoS 1 guarantees that a message is received at least once at the recipient at least once. However, a message can arrive at the recipient several times. At of an order, duplicates of a message can can lead to multiple deliveries. Different the situation is different for measured values. Here duplicates usually do no harm. The highest level, QoS 2, guarantees that no message is lost and that no is lost and that no duplicates are created. One message reaches the recipient exactly once. A two-stage confirmation process ensures this, that the guarantees are honored. Due to the additional messages delays delivery and valuable bandwidth is is used. Directly at the first connection of a client to the broker, you can send three data packets can be sent. This birth message is sent as soon as the client has connected to the broker has connected to the broker. The death message is transmitted, when the client is switched off or disconnected from the from the network. The last status we have is the load Will & Testament. This is a predefined message that is transmitted as soon as the client goes off the network, e.g. because the battery is empty or because the network is interrupted is interrupted. But enough theory now. Now let's go to our computer and take a look at the the whole thing in practice. For testing we need the free MQTT-FX software. The download link can be found below in the video description. When the program is installed, we go to first to the settings. Under Broker address we enter our name from the Raspberry Pi or also the IP address. The broker port is 1883. We confirm the whole thing with OK. Then we try to connect to our broker at Connect. As an example, I will use the topic Home/ Garden/ Temperature/. That's it for now with the MQTT-FX and we switch to Node-RED. We pull out the Node MQTT from the input and with a double click we get to the settings. We start with the server settings. Here we enter again our Raspberry Pi name under Server and make sure that the port is set to 1883. Then we enter the topic. home/garden/temperature. And we set the quality of service to 0, because we do not have a critical application. As output we use a string, i.e. a character string and then we assign a name, z. For example, temperature or temp. the node debug, which we find under Output and connect the two nodes together. We can start the whole thing with Deploy. Using the MQTT-FX, we will now try to publish a publish a temperature and in Node-RED we want to then read it. We write 20C and then go to Publish. We immediately see that we can also read Node-RED has received the 20C as a message. So you see, MQTT is not rocket science and with a few basics quite easy to use. If you liked the video, give me a thumbs up up. Subscribe to the channel. Thanks for watching, see you next time, Edis Techlab.
Info
Channel: Edi's Techlab
Views: 141,720
Rating: undefined out of 5
Keywords: Mqtt, Mosquitto, Raspberry, Pi, Broker, IOT, Homeautomation, Arduino, Elektronik, Last Will, Topic, Payload, Edi, Techlab, edis techlab, node mcu, Tutorial, erklärung, training, Protokoll, Message Queuing Telemetry Transport, deutsch, Projekte, Grundlagen, NodeMCU, MQTT, DIY, node-red, node, red, Edis, Edistechlab, Sensoren, Basteln, motion, bewegungsmelder, bewegung, sensore, bewegungssensor, mc-sr501
Id: ItcGWCvYa8o
Channel Id: undefined
Length: 7min 22sec (442 seconds)
Published: Sun Aug 11 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.