Smart Door Unlock System using ESP32 and MQTT | IoT Project Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
I was working on one of my mqd project and during working I felt like having a coffee so I checked my glass but it was empty so I thought of making a coffee so I went to the kitchen and checked the refrigerator for milk but I found that the milk is not there so I decided to go out and get the milk I pick up my keys and wallet and I just locked the door and I started moving towards the shop and in between I found that the door is locked so I thought of opening it and for that right now I have the option that I can simply press the button because it's a electric lock you just press that and it will be unlocked so now I started the bike and I just picked it and we can March towards now so I reached the shop and on the shop I just asked them to give the milk I take it I make the payments I again take my bike and I just come back now when I come back I see that the door is locked and uh nobody's there to open so I don't have to wait for anyone I simply open up the app on my device and I simply unlocked it so now you can see how I'm simply opening it just click on the button and it's unlocked hey everyone as s this slide from innovate yourself welcome back to another exciting video in the series of ESP IDF like you have seen in the beginning of this video how we are easily controlling our home door which I can control from anywhere across the world so basically what exactly I'm doing or let's say what exactly I'm going to explain you today is that how you're going to create two iot devices which you will be communicating through the broker which is your mg broker and accordingly how easily you will be able to control your door so basically one device I will be setting up at my home and second device is a handy device which you can carry with you so that wherever you are or let's say in case I'm stuck outside and nobody is there to open the door for me then I don't have to wait for anyone I can simply press the button and my door is going to be unlocked so this is what exactly we're going to learn in this today's video so I'm going to demonstrate everything from zero to the at last stage right so this is all that we're going to cover up now let's do one thing let's move to the hardware stuff first so that we can make all let say so that we can get our devices ready and accordingly we can Flash the program so that we can see this functionality in light so I think you are really excited and you also want to make this device for your place right so let's move to the hardware stuff and let's understand all the circuitry part and the coding stuff so let's move ahead all right everyone so now you can see on my screen I have my visual studio open but firstly we have to talk about and in fact we have to see the uh like a circuitry part in which we have two circuits right and the first circuit uh let's see and check so that we can start making it and we can accordingly see like what all things you have to include in that and how all connections are going to be made so let's go to the uh circuit part uh like basically for the first circuit and then we'll move to the second one all right so you can see uh over here I have the PCB uh like uh created which you can directly use and you can basically start creating uh like from this right and let me tell you what exactly I have done in here so basically uh this is my esp32 vom which I will be using right and uh this is my transistor and this transistor will be uh 2 N uh dou to or you can say Tetra 2 or uh in place of this if you don't have this Tetra 2 then you can also go for s8050 and both are your npn transistor which will be used for switching it basically right and this is a 5vt relay which I will be using in here and secondly this is your Xena di for Value 4.7 volt and this is the one which I'm using in here and here this is the like a terminal connector where you will directly connect your main Supply right so you will directly connect it here so that you can switch the data accordingly right and currently you can see this connection I have made to the normally open one so this is normally open this is normally closed right so Ive connected this to normally open one right so this is how I have made it and uh similarly over here we have a resistor and the resistor value will be like uh 1 kilm so I'm going to use that right so yeah this is uh the total connection and this is how I'm going to make it so now let's convert it to the PCB right so let's first see the 3D view of this so this is your circuit and here we have the circuit right now that we have the circuit with us and we have that completely ready so let me do one thing let me connect it to my system so that I can also uh start uploading the code and just because I already have the code ready with me right so let me connect it just allowed okay so basically this is the code that I'm going to use in here right and uh basically you can say if you have already watched my previous video that must have got an idea that how do you work with mqtt so basically this is the main concept that we are going to use in here right and this first device which I'm going to use this is your uh device which is going to subscribe to the topic and the topic you can see in here which I'm uh writing over here is like topic SL door/ unlock so this is the one which I'm using right now and uh over here I will be simply uh like sending up the request from the MD server and accordingly that request will be subscribed on this device using this topic and on the basis of that what exactly I'm doing is I'm simply printing a message so that I can also see it on the serial Monitor and also I can simply control it and what exactly I'm doing is I'm just doing it uh this way that it will simply uh open my uh door and uh that will be active for one second right and accordingly after that it will automatically gets off so this is how exactly I'm doing it so that I don't have to take care of the values of your relay thing right so here I'm turning it on and here I'm turning it off or in simple terms you can say I'm just switching it right so this is the way like how I'm doing it and this device is going to subscribe to the topic when you will get a request from the other device because it's like this device is going to subscribe and second device is going to publish the value on the mq broker and both are connected to the same mqt server and that's the reason they are going to get the value and accordingly they're going to perform this action right so this is all about this and rest of the things is just the same right we don't have to make any modification or we don't have to do anything uh other than this right and just uh you can do one thing uh this time that just make sure the device that you are going to set up at your home just make sure that you are using the wifi or the credentials of your router so that it will not be like uh uh your mqtt or your esp32 is not going to connect to the mity and it is not going to uh communicate with that right so just make sure that you are connecting it to the home router right so this is how we are going to do it I have done all the uh modifications and everything right I hope you have already seen my previous video because there I've explained everything in detail right so this is about that now that we are done with this I think I don't have to explain everything right now let's go to the terminal and let me simply upload this program so that uh we can further check for this right simply build it and it it all right everyone so now you can see everything is uh like set up successfully and in fact now uh the code is successfully like uploaded and also you can see it's uh connected to the Wi-Fi as well as it is connected to the MTD server and in fact you can see the publish And subscribe topic so you can see the events called for that now uh just because our first device is ready and the code is also uploaded now it's time for us to further uh set up our second device and in short what I'm about to say is that let's get our application ready from which we are actually going to control our door unlock system right so basically this is what exactly we have to do so this is it now let's uh move to the application part and then let's uh see like how we are going to control this so let's move ahead so everyone I hope you can see my screen and uh now firstly what we'll do is we'll simply go to play store from where I am actually going to download the application uh in fact you can see iot mqtt panel by Rahul kundu I'm going to use this application because I found it really helpful and really useful as per my application and the device that I have created and in fact the dashboard is also very good you can also see the images uh like over here right so that's the reason I'm also going to use this so just search for iot mqtt panel and just simply click on install so it will start installing it and once uh the installation is done we can proceed further and we can simply set up our dashboard so let's wait for it to install so it's uh installed successfully now click on open so over here you can see when you will install it for the first time you're going to see something like this that you're going to get this option set up a connection just click on this and now here you have to provide few details as per the broker that you are actually going to use uh with your device so right now I'm going to give it a name and that's like uh iot hub for example I'm giving it this name right and client ID it's not mandatory you can leave it it will automatically take it and in the broker you have to mention the broker that you are using in my case Ive already copied that let me paste it oh I think it's changed now okay let me type it now mqtt do Eclipse projects. so this is the one which we are using right now and in fact um I hope we have already seen this right so port number is 1883 only so leave it like that and this network protocol is also TCP if you have something else you can change it but uh in my case I don't have to change it I'll simply go with TCP and if in case you're using this mqts thing then you can go for this TCP SSL right so this is how we're going to do it and and uh next is ADD dashboard so just simply click on this plus button and over here just write a name for your dashboard and one more think this add dashboard is mandatory so you have to create it so just give it a name now let me type it door unlock system I'm giving it like this right now just save it so you can see some dashboard thing is created over here you can edit it if in case you want to edit it but yeah I'm okay with this so I'll simply uh leave it like that now you can see the additional options in case you have any security thing added into your mqd broker then you can do it like this so you can add the username and password so this is a way to do it so I don't have it right now so I can leave it like that so simply click on create now so can you see iot Hub is the name of the connection that I gave for my broker basically so this is the one now simply click on this just open it up now this is that dashboard which we actually created in the beginning right so this is the name you can see door unlock system right so this is the one now over here we have to add up the buttons so currently I'll be having a single button so I'll simply add that but you can see here we have so many wigets in case you want to choose uh something else you can choose that but uh right now we only want a single button which I'll be simply clicking and once I'll click on that it will simply send a request to my topic and that is to Simply open the uh door basically right so I'll simply select the first one this one button just click on this and over here you will have to enter the details so here you can write the panel name like what name you want to uh like give to your button so I'll simply say door unlock right so this is the name that I'm giving so that when I'll click on this it will simply unlock my door right and over here I'll have to specify the topic so the topic we know like what it is okay slash is also left just type this also okay so in this way you can see we have it and over here you can select what will be the payload so payload is basically like what data you are sending that data can be a simple text that data can be a Json format that data can be something else right so in my case it's just a simple string that is open so I'll simply send that and that is my payload and over here you can see few options we have to the panel width use icon for uh button and uh like payload is Json data in case your data is a Json data you can select this but uh right now I don't have that thing so I'll leave it like that also you can change the size of your button I'll change it to large you can select the color for your button let's say I want to select black color right and also let's say I want to use a icon for that so over here we have the icons so you can select any of the icon and uh you can simply uh choose that as per your choice right okay so you can see in this way you can select it but right now I don't want to select it I just want the name and that's door unlock and that's it so in this way I have done it and the last thing is retain if in case you want to retain the message then just select this option if in case you don't want then don't put it and I'll simply suggest that don't put this rain otherwise you will have problems whenever you will send the request right so it's better not to select this so leave it like that for now and here you can select the quality of service that you're going to use So currently we're using quality of service as zero so I'll put that only and at last just click on Create and you can see the dashboard is created and here you can see on the top orange color uh like this cloud is here right so if you will click on this you can disconnect and connect it so I'll simply connect it again you can see it is connecting and at last it is connected right so in this way I have uh done this right and now I hope you guys are like familiar and I hope you guys have done this successfully over here right and one last thing if in case you want to make any changes to your button so you can click on this and here you have the options whether to delete it whether to edit it whether to adjust all these parameters right so you can select accordingly right so in this way we can do it so this is the way how you can do it so this was all about the setup of your uh second device in short we can say setting up of your application so that you can control the door lock system right so this is what we have done now let's proceed and let's deploy our device so that we can control the device so that uh you can unlock the door just like you have seen in the beginning of this video right so let's proceed all right everyone so you can see I have deployed the esp32 setup over here and basically this is a switch which is set up uh like uh in my room basically so when I'll click on this uh this will simply open up the gate so what I've done is I've just simply linked it to that and basically I have just connected this to the relay over here so whenever I'll send a request it will automatically uh like switch the relay and basically it's going to open it up so this is how it happens and you can see currently I'm using the adapter so that's the reason from here I'm giving it the power supply so this is how it is done [Music] so this was it for the today video I hope you have liked the content and I hope you have liked the project that we have demonstrated today so if you have liked this project do click on the like button and also if you have any queries feel free to leave a comment below in the comment section I'll definitely help you out and also if you are new to this Channel and if you haven't subscribed to our Channel yet please click on the Subscribe button so that you won't miss any videos which we will be uploading in future so this was it so see you in the next video you till then bye-bye and happy learning
Info
Channel: Innovate Yourself
Views: 1,067
Rating: undefined out of 5
Keywords: internet of things, smart door, smart door unlock system with Internet of things, unlock the door with IoT, IoT tutorial with ESP32, Internet of things with ESP-idf, how to publish and subscribe to the topics with MQTT, MQTT with ESP32 with ESP-IDF, home automation with IoT, Smart Home, make your home smart with IoT, how to build your own PCB at home, factory like PCB at home, IoT with MQTT, ESP32 TO MAKE YOUR HOME SMART, FUTURE TECHNOLOGY OF 2024, SMART TECHNOLOGY OF 2024
Id: R715xlOr7ws
Channel Id: undefined
Length: 20min 2sec (1202 seconds)
Published: Fri Jan 05 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.