How To Install The Mosquitto Mqtt Broker On Your Raspberry Pi

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everybody and welcome hope you're all well um previous sessions we are have been preparing to um for our project that we're going to going to be doing our mqtt project right message Qin Telemetry transport and as I said we've prepared Theo IDE we've installed node red onto our Raspberry Pi and node red dashboard well in this session we're going to install and test the mosquito broker the mosquito broker now the mosquito broker um it's it's a simple messaging protocol if you like um it's designed because of the constraints of different devices such as the ESP 32 the Arduino Uno okay and it's the perfect solution because of the load bandwidth to exchange data between Internet of Things devices okay we've discussed before it's a publish And subscribe system all right devices publish messages on a specific topic and all the devices subscribed okay to that uh topic get the messages right so let's have a quick look at this uh drawing here we got different devices right say from one device the top leftand device we're in our it's early morning we've just got up and the first thing we want to do is turn on the office light in our home office so the device in our bedroom it could be phone it could be um home automated device we send the message turn on the lamp in the kitchen the device sends a message to the broker this picks up the message and decides oh where's this got to go I know the home office lamp is subscribed to that topic I'll send the message to the home office lamp all right so we could be in our office and our office we want to we've got an automated Kettle for instance and it says door here from our device we can say uh send the message home uh Kitchen Kettle we could say turn on the kettle so the device it goes to the broker the broker looks oh the kettle is subscribed the home Kitchen Kettle is subscribed I'll send the message there and turn the cattle on all right so that's how um it works now what we're going to do we are going to install right the Raspberry Pi sorry mosquito onto the Raspberry Pi right so let's go to here okay let's go to here we need to open two terminals one two right but now we only need the one now the first thing you want to do really I haven't done mine for a while is update our Rasberry Pi so it's p sudo at space updates SP and and I haven't done Linux for a little while so uh you know the last few um sessions we've been practicing uh our Linux so it's always good to practice pseudo at upgrade all right previously we've done one command at a time but you can do them both together press enter I've just recently upgraded mine so uh let's go through uh just to remind you if you haven't got your boards your Rasberry pies your um esp32 your adino Unos I've got some links below where you can get those all right and all your modules of course um I've just recently pre-ordered the Ros Pi 5 hopefully going to be doing uh a session on that when it arrives right so there we are we've up upgraded our Raspberry Pi now next thing we need to do is install the broker zudo zudo is for super user all right app install that's why mosquito they spell mosquito a it yep mosquito space mosquito Das clients remember to put the S on the end of clients enter as you can see I've already installed mine so uh next thing we need to do we need to enable mosquito let me just clear this we come back to the top all right so it's pseudo and it's system GTL enable right enable mosquito service mosquito sorry dot service all right enter and there we go we've enabled the mosquito service next thing we need to do is check what uh version of mosquito we are running so it's mosquito Bas dasb enter and here you can see I have got um version 2.0.11 right it was already running so address already in use now um what we need to do is allow remote access because if we don't allow remote access to other devices the only devices that we'll be able to connect or the only uh would be the Raspberry Pi that' be the only device that could use mosquito so we need to enable remote access here this all right so it's pseudo Nano for SL space SLC for SL mosquito SL mosquito do comp so what we're going to do here we're going to edit uh the configuration file all right for uh the mosquito broker now two lines of code we need to add are these two lines of code here listener space 1883 and then under that allow underscore Anonymous face through right so there the two lines of code we need to add right now to get out of this it's control X when you first do this because I haven't done any changes it will ask you do you want to action the changes you press y enter all right and then what we need to do is we need to restart uh mosquito that's PSE sudo SP system CTL Place restart mosquito all right so you're restarting the broker Okay so we've restarted mosquito all right so now if you got a password obviously you where you've updated the uh password in your comp file you need to put in um need to put in followed by your username and password all right um to use um mosquito in later projects you should know your IP address of your your uh raspber P oh just a remind you had to do that poost name Das capital I right and it gives you your IP address now what we're going to do we're going to go and we're going to test we're going to test our um installation all right now um clear what we need to do is run mosquito in the background so it's mosquito mosquito FY ey out okay yep mosquito space minus D enter so mosquito is now running in the background now we need to create a topic we need to create a test top uh a test topic all right so it's mosito underscore sub for subscribe all right and minus D base minus t and it's test capital T on the topic all right so we've created a a test topic all right we've created a test topic so what we now need to do is um to publish a uh sample message we need to open a second terminal window that one there and here we need to put mosquito underscore publish space minus D base minus T Test topic capital T on the topic base minus M base quotes and we just put hello world and quotes right and press enter now I come over to the other window we have Hello World all right we have hello world so our mosquito uh client or our mosquito broker is working right let's put in now or you enter and let's come over to here how are you great great stuff so that's our um our uh mosquito client working right that's our mosquito client working now um now we can move on we can move on to our project everything all the P Pim preliminaries are done and in the next video we'll be carrying on with our project and we'll be doing the sketch all right thanks very much indeed um thanks for watching thanks for watching and please give us a thumbs up And subscribe and I'll see you in the next video bye-bye bye-bye
Info
Channel: LETS CODE FOR THE OLDER FOLKS
Views: 2,064
Rating: undefined out of 5
Keywords: mosquitto mqtt esp32, mosquitto broker home assistant, mosquitto mqtt home assistant, mosquitto setup, raspberry pi, node red, mqtt broker, mosquitto broker, raspberry pi projects, mqtt broker home assistant, mqtt broker on esp32, mqtt broker and client, mqtt broker connection, mosquitto broker esp32, mqtt setup
Id: GQr9HENJ3dY
Channel Id: undefined
Length: 14min 36sec (876 seconds)
Published: Mon Oct 16 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.