This video is about how to setup secure MQTT broker in NodeMCU ESP8266 board using sMQTTBroker Library with username and password authentication.
Get the Code: https://fusionautomate.in/esp8266-as-mqtt-broker/
------------------------------------------------------------
Website: https://fusionautomate.in
Telegram: https://t.me/fusion_automate_admin
Telegram Group: https://t.me/fusionautomate
WhatsApp: https://wa.me/message/B7RXUT4OUXWUF1
WhatsApp Group: https://chat.whatsapp.com/DW7K2yo3ee52mtG4ODTvtc
Instagram: https://instagram.com/fusion_automate
LinkedIn: https://www.linkedin.com/company/fusion-automate
GitHub: https://github.com/papercodeIN
Join this channel to get access to perks: https://www.youtube.com/channel/UCKKhdFV0q8CV5vWUDfiDfTw/join
------------------------------------------------------------
Get the Code: https://fusionautomate.in/esp8266-as-mqtt-broker/
------------------------------------------------------------
Website: https://fusionautomate.in
Telegram: https://t.me/fusion_automate_admin
Telegram Group: https://t.me/fusionautomate
WhatsApp: https://wa.me/message/B7RXUT4OUXWUF1
WhatsApp Group: https://chat.whatsapp.com/DW7K2yo3ee52mtG4ODTvtc
Instagram: https://instagram.com/fusion_automate
LinkedIn: https://www.linkedin.com/company/fusion-automate
GitHub: https://github.com/papercodeIN
Join this channel to get access to perks: https://www.youtube.com/channel/UCKKhdFV0q8CV5vWUDfiDfTw/join
------------------------------------------------------------
Category
🤖
TechTranscript
00:00Hi everyone and welcome. In the previous video we have covered that how to set up
00:06basic MQTT broker in NodeMCU using SMQTT broker library. So that was very basic
00:13MQTT broker implementation in the NodeMCU without any security or you can
00:17say without any username and password. Okay so any client okay any MQTT client
00:22can directly connect with that MQTT broker without any security but we want
00:27a security in our broker without any username and password no client should
00:32able to connect with our MQTT broker then how we can implement it. Okay so
00:36that thing we are going to cover in this video. So this is the topic for this
00:40video that how to set up secure MQTT broker in the NodeMCU using SMQTT
00:46broker library with username and password authentication. So until and
00:50unless you are not providing correct username and password you won't be able
00:54to connect with NodeMCU MQTT broker. So let's see how you can implement it. So
01:00here I have my entire code okay so here is our secure ESP8266 MQTT broker
01:07code I'm going to provide it okay after this video so you can directly use it.
01:11Now here is our entire code so you have to change few things as per your
01:18requirement in this code. So first thing is your MQTT connection username and
01:23password so whenever you try to connect with your NodeMCU MQTT broker what
01:28username and password you want to set that you have to specify here. So I have
01:32set my MQTT client username admin and MQTT client password password okay just
01:37for the demonstration purpose and then after you have to change another thing
01:41which is your Wi-Fi SSID and password so on which Wi-Fi connection you are going
01:47to connect your ESP8266 or NodeMCU board that you have to specify here and
01:53the one more thing you have to specify as per your requirement is the MQTT
01:57port so on which TCP port you want to start your MQTT broker so that you have
02:02to specify here. So totally you have to modify five things as per your
02:06requirement first two things are MQTT connection username and password okay
02:12third and fourth is your Wi-Fi SSID and password and the fifth is MQTT broker
02:17port number. So once you modify everything as per your requirement then
02:22you can directly upload this code into your NodeMCU board. So here is my NodeMCU
02:27board connected with my system I am going to upload this sketch into my
02:31NodeMCU board okay
02:35you
02:39okay we have successfully uploaded the code and here we have the IP address of
02:44our NodeMCU board. Now we can use this IP address to connect with our NodeMCU
02:48MQTT broker. So again I am going to open MQTT Explorer which is MQTT client
02:55software and I'm going to select the ESP8266 connection and I'll try to
03:00connect okay here you can see connection refused because of bad username or
03:05password now we have already specified the username and password here to
03:09connect with our MQTT broker so without any username and password you won't be
03:13able to connect with our MQTT broker so that is what we want right so I'm going
03:17to copy the username from here and I'm going to paste it here and we will copy
03:21the password and we will paste it here and then after we will try to connect
03:26and we are successfully connected okay so if you do not provide any username or
03:31password then you won't be able to connect with our NodeMCU MQTT broker
03:35and if you provide wrong username and password okay in this scenario username
03:40is correct but password is wrong so still you are not able to connect you
03:44can see bad username and password okay and if you provide correct username and
03:50password then only you will be able to connect with NodeMCU MQTT broker now
03:54again I am going to open another MQTT client which is again MQTT Explorer I
03:59will select the NodeMCU connection okay the password is password and the
04:04username is admin and then we will try to connect okay here you can see
04:09connection refused identify rejected because let me show you so if you go to
04:16the advanced here also if you go to the advanced then the client ID for this two
04:21client is same okay so you have to change the client ID then only the
04:25second client will be able to connect with your ESP8266 MQTT broker so I'm
04:31going to add some random number here okay and then we will go back and then
04:35we will try to connect and we are connected so if your client IDs are same
04:40then you won't be able to connect with your NodeMCU MQTT broker okay so that
04:45thing also you have to take care of now we can use some test topic and we can
04:49publish some test data okay and in the second client we have received that
04:54also we can publish some test data from the second client and here we have okay
05:00so it is working absolutely fine with security so I hope this thing is clear
05:06that how you can set up your secure MQTT broker in the NodeMCU so here is the
05:11code I will provide the code okay maybe you will get that into our GitHub
05:16repository or I'll provide the code into our website so you can directly
05:20copy from our website so I hope everything is clear that how you can set
05:25up your secure MQTT broker in the NodeMCU and if you still have any
05:29questions or any doubt then you can always ping me on telegram Instagram
05:32whatsapp anywhere okay all the social media link is available on our website
05:36also you can send me a mail also you can comment on this video now let's meet in
05:42the next video till then take care goodbye and thank you