How to Connect Node RED with Mosquitto MQTT Broker as a MQTT Publisher and MQTT Subscriber | IoT |

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi everyone and welcome in the previous couple of videos I have covered so many things about mqtt node red and morbus and backnet protocol okay so I have covered that how we can convert mest tcpip protocol data to mqdt using the node R how to convert modb serial data to mqt data using node R and how to convert backnet data to mqd using node R okay but in this video we are going to cover the basic thing about mqtt and node TR and our mosquito mqtt broker okay so if you haven't installed mosquito mqtt broker in your system then I suggest you have to install mqt I mean mosquito mqt broker in your system and once you install mosquito mqt broker then you can open your task manager you can go to services and you can search for mosquito and here you will find the mosquito Mt broker services are up and running fine okay so now we can use our no trade with this mosquito mqdt broker and we can you know learn the basic thing about the node Rd and mqtt okay so if I navigate to my node Rd okay so you can see my node R is up and running so in the node section in the network node section you will find this two node mqtt in node and mqtt out node mqtt in node will read the data from your broker and mqtt out node will publish the data to your broker okay so here is my mqt out node okay I have dragged and drop the mqt out node this node will help me to publish my data to broker okay in this case I have mosquito broker installed in my system so it will publish the data to my mosquito broker and whatever client is connected to my mosquito broker they can read the data okay so if you double click on this then you have to add mqtt broker here okay so click on this pencil here and I want to add my MOS skito and mqtt broker okay and the IP address of my mosquito mqtt broker is my Local Host IP address so 127.0.0.1 and the port number is 1883 which is default port for mosquito mqt broker okay now we will leave uh all the setting as it is and we will just click on the add okay now on which topic you want to send the data you can specify it here as well as if you have this inject node then you can also specify the topic here here as well okay so I'm not going to specify the topic here and the qos I'm going to set zero and the retain is false okay so this is the mqtt Pu lii publisher node okay so I'm going to press on done and we will inject the Tim stamp to the mqtt publisher node okay so it will publish the Tim stamp to mqdt broker okay and we can read the time stamp in this m Explorer software so here also you can see uh name mosquito mity broker the IP address is 127.0.0.1 and the port number is 1883 so if I connect here it is connected but uh no publisher is publishing the data okay so it is empty right now now here you can set the payload so payload I'm going to send is a timestamp and the topic I want to publish the data is a test topic okay so I can specify the topic name here also I can specify the topic name here okay but you have specified the topic name in the previous node then you don't have to specify the topic name here so if I deploy it okay and if I open this thing parallell okay now if I inject this one then you can see the test topic has some data okay it's a time stamp data if I inject it again then you can see the data is changing and also you can see the history history okay if I press it again then you can see there are there is a third uh point which is showing the new data okay the fourth update the fifth update okay the sixth update so this is how you can use uh mqt out node okay mqt out node to publish the data to your mqtt broker and your mqtt broker can be anything it can be your Amazon web services broker it can be your sidal mq broker it's can be your high mq mq broker Cloud mqt broker mosquito mq broker anything okay for all those thing you have to I mean Define your broker settings here and then you can send your update or your data to mqt broker now what we want to do is we want to use our node r as a mqtt subscriber okay so we have to use uh mqt in node so if any topic has any update then we want to read that update and we want to display in the debug window okay so I can use this way okay and here I have to specify from which broker I want to read the update so I have to specify my broker here from which topic I want to read the update so if I create a test two topic here okay quality of service is zero and if I press on done okay and if I deploy it then I can publish some value on the test two topic like row value like 23 so if I publish it here okay and you can see the 23 here okay so this mqtt in node we'll read the data from test two topic and whatever data update we will provide or any other um client will provide or any other publisher will provide the update on the test to then our not rate will read the data and it will publish on our debug window instead of debug window you can uh use your function to do some analysis do some work based on the value okay but this is just for testing that we can read the data so if I uh put the data like 56 and if I publish from here then you can see the 56 data if I want to change the topic okay so I can change the topic from here that I want to read the data of test topic okay which is the Tim stamp data so I can and deploy it and whatever data I am injecting from here that I will get it here you can see last three digit is 326 okay if I again inject it from here then you can see this node will read the data from test topic okay this software mqt Explorer software is also reading the data on the test topic okay and you can see the data is matching here so you can use node r as a mqtt publisher mqtt subscriber okay so that is possible so I I hope this thing is clear that how to use mqtt in node and mqtt out node so mqtt in node will act as a subscriber to subscribe any topic and get the data and mqtt out node will act as a mqtt publisher to publish the data to the mqtt broker okay so basically mqtt out node will send the data to mqtt broker and mqt in node will read the data from your mqt broker okay so I hope this thing is clear to you and if you uh send instead of Tim stamp if you stand some number like 77 on the test topic okay and if you deploy it then it will send 77 number and this uh mqtt in node will read the data and it will display here okay if you write some function here instead of this inject node if you go for counter or if you go for any function then the function will publish the data on your um mqdt broker on some topic and this mqtt in node will read the data and you can use the data later on for your dashboard purpose for your you know logic purpose for any purpose okay so I hope this thing is clear to you and if you haven't installed I mean mosquito mqt broker in your system then you can install by just searching on the Google mosquito download okay sorry the spelling is uh wrong okay you can download from here okay mosquito. org download and you can download for Windows operating system Mac Linux Rasberry Pi or every other operating system okay so I hope this thing is clear to you and if you still have any question or any doubt then you can ping me on Whatsapp telegram Instagram anywhere also you can click on this links okay if you want to ping me on Whatsapp just click on this link and it will redirect you to my WhatsApp okay so I hope this thing is clear and we have covered that how to connect not trade with mosquito midity broker as a publisher or as a subscriber okay so I hope this thing is clear and if you still have any question or any doubt then you know where to ask okay so we will meet you in the next video till then take care goodbye and thank you
Info
Channel: Fusion Automate
Views: 5,284
Rating: undefined out of 5
Keywords: Node-RED, MQTT Broker, IoT Integration, Mosquitto MQTT, Node-RED Tutorial, MQTT Publisher, MQTT Subscriber, IoT Development, Home Automation, Data Exchange, Timestamp Management, Tech Tutorial, IoT Projects, Node-RED Integration, Mosquitto Integration, MQTT Communication, Programming Tips, Node-RED MQTT Setup, Internet Of Things, Automation Projects, Data Flow, MQTT Protocol, Coding Guide, IoT, IIoT, Industry4.0
Id: kIsVq9GOrrI
Channel Id: undefined
Length: 9min 18sec (558 seconds)
Published: Sat Nov 11 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.