Google Firebase Home Automation with Fan Dimmer & Realtime Feedback | ESP32 Project

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we're gonna make our all in one home automation project using firebase real-time database using which we'll be able to control up to four ac appliances and also able to control the speed of the fan using our own custom made android application also with the help of the manual switches and manual friend regulator and that will work without internet as well so this is the one topic which i got a lot of demand of and as i got a lot of demand off i do want a lot of likes on this video so do click the like button and now let's start with this video so to make this project you'll need these all components whose list and links you can find in the article whose link you can find in the description of this video and the same article i also mentioned the connection diagram of all this component and trust me they have a lot of connection to be made in this project and that's why we designed our own custom made pcb and in the end we gave its order to jlcpc well you can try out the glc pcb for your pcb related order by just uploading the gerber file of the pcb project select the color masking if you wanted and just place your order now here they have multiple shipping options and if you select the fastest debris option you may get the pieces delivered at the doorstep within a week so try ordering your own custom design pcbs from the lcpcb to make your projects look neat and compact so after getting the pcbs and shouldering all the components on it our pcb project looks something like this and well we are also selling this complete shouldered projects just stick around this video as i'll be discussing about how to purchase this project at the end of the video so yeah that was all about the hardware part of the project now let's move on to the computer and have a look over the coding part so here's the code for our all-in-one home automation project using firebase so let's start understanding this code line by line so first of all uh here i have put one debug switch which is set to one so whenever it's set to one you'll get to see all the debug messages in the serial monitor and when you set it to zero you won't be able to see anything inside the serial monitor so let's keep it to one for debug purpose after that here to include these all libraries uh out of which you just need to install this firebase esp32 dot edge header file you can get it from the github repository i will leave the link of this uh in the description of this video you just need to download the zip file of it and after doing that just need to go to sketch into include library into adsense libraries here just go to your download folder select the library file and click on the choose button which will automatically install that library onto your arduino ide after doing that you need to install one more library which is arduino json.ed for that go to sketch into include libraries into manage libraries you just search for arduino json and install this library now make sure you have installed this specific version only because yeah i've tested this project in this version so yeah do that after doing that you're good to go with the libraries part and now let's move ahead with the firebase credentials so as you all know we are using the firebase real-time database here so we need to provide their credentials here to you know link this project with our account for that what we'll do is go to our web browser and open up a new tab here and search for firebase click on the first link which will take you to the firebase website after doing that just click on go to console and here click on add project i'll name this project as all and one that's good for me click on continue after then click on continue again select an account i'll select my tech sms account only click on create project i will take some time to create the project so let me just fast forward this okay so our new project is ready just click on continue so here is our all-in-one automation project onto the firebase database now i just need to go to real-time database and here click on create database click on next click on enable and we are done now we just need to copy this url which is one of our credentials so i'll copy this and go to my arduino account and here i'll paste that url into firebase host now make sure you remove this backslash and also this https kind of thing you just need to keep it as simple as this one after doing that you have to provide one more uh credential which is the firebase authentication token which you can get it by going into the setting icon into project settings into service accounts into database secrets and here is the secret authentication token just click here to copy and paste that token here so that was all you need to do for the firebase a part of the project now let's move ahead you need to provide the wi-fi credentials because hey come on this project do require internet connection for talking to the firebase database after that the necessary function declaration and necessary what you can say pin declaration now the pin declaration you don't need to change antenna unless you are using the same connection diagram which is shown in the article if you're using a different pins make sure you change that numbers here after doing that again some of the variables are declared and input output is declared there's nothing much here let me just directly take you to the loop part of the project and let me show you the logic i have used so in the loop part first i'm comparing is my wi-fi status connected to internet or not if it is not connected to internet just a call this function called as without internet it will run all the function that will work without internet and in case if it's connected to the internet uh do run the functions called as data from firebase and with internet okay so uh in without internet function what we are doing is let's just go to that particular section okay so here's the without internet part here we are just reading the status of the switches and the fan regulator and we are blindly sending the data to the relay pins for example if the switch one is on we will be turning on the relay one ever it is off we'll turning it off that's a simple thing we are doing in without internet mode and while uh when our esp board is connected to internet we are calling two different function first data from firebase which is responsible for all the data coming from the firebase database okay for example if we are getting any data from this particular path and if that data is zero we just need to call the speed zero function will turn the fan speed to zero okay so basically we are reading the data from the particular path and we are doing the actions according to the data receiver is it on is it off uh we are just reading the data and responding to that data and after that we have one more function called as with internet now let's me let me just go to that function as well so inside with internet what we are doing is we are following all the steps that we have followed without internet mode that means if the switch one is turned on turn on the appliance one along with that we are also sending its real-time feedback to the uh firebase database just to make everything in synchronization which is with each other okay so when we are you know changing the fan speed by the manual regulator we are also sending the data to the real-time database okay just to make it in sync okay so that we are doing in the with internet function okay so these all are the logic embedded inside this particular code and when you just go through this code line by line like when you go through all the functions you'll come to know each and everything because it is like in uh written in a very simple and in a very simple manner i've made a very simple logics okay so that is all about the code and the firebase account now one thing if you notice inside the firebase is uh inside the real-time database we haven't created any of the path or any of the variable any of the value nothing we have created nothing now why is it so it just because whenever we upload this code onto our esp32 board all the parts that are defined here just like appliances slash appliances one two three they all will automatically be declared inside a real-time database so we need not to create it manually it will automatically done by the esp32 and the database so we need not to do anything uh inside the database okay so that was all about the coding part of the project now we are just left with making our own android application inside the mit app inventor let me just go through that part as well so here we have used the mit app inventor to make the application for our project here it is helped me a lot while making this project so here are all the blocks for this project and here is the front part of it now don't worry we'll be providing the dot aia file of this application uh in case you want to use it on your site as well but you need to change one thing here which is the firebase credentials for that just click on this firebase database and here are the two credentials that you need to change as per your account that's it after doing the changes you can easily convert this file into the dot apk file and install it on your mobile phone so that was all about the mobile application part as well now i'll simply insert the esp32 board inside the pcb project now you can get the connection diagram of this pcb board with appliances in the same article so use that image for the reference purpose that's it now just turn on the switch and let's see this project in action so first let's try controlling the appliances with the help of the well application [Music] as you can see i'm easily able to control the tube light and also able to control the speed of the fan using the slider perfect now let's try with the manual switches and manual fan regulator okay so we are able to control it with the manual switches as well now let's just try to turn off the internet and let's see if it works without internet or not okay so it is working without internet as well as expected now if you look at the firebase real-time database section then as you can see all the variables are automatically declared and its values are being updated whenever we send the data from the mobile application or from the switchboard so yeah we are getting the real-time data into the database as well so yeah that was all about the all-in-one home automation project made using firebase this time and this was the most demanding topic from your side and let me tell you we are also selling this all-in-one homework project like the complete shoulder project just for you guys so you just need to go to techysmith.com website and on that website you'll get one option called as projects for sale and here you will find all the projects that are on sale by techie sms and here is the all in one home automation project select this project fill up the basic shipping details and just pay for the order you'll get that project completely shouldered at your doorstep so yeah that was it about this video i hope you enjoyed it i hope you got to learn something new from it and if you're so you already know it do like the video and also let me know in the comments like what more projects you want us to make and we'll try our best to make this product just for you guys and that being said i'm just ending this video here and now just wait for my next explode and share with me techy sms [Music] you
Info
Channel: techiesms
Views: 14,623
Rating: undefined out of 5
Keywords: techiesms, electronics, electronics projects, esp32 projects, google firebase automation, home automation using google firebase, homeautomation using google firebase, automation using firebase, firebase iot, Relay Control Using Google Firebase, Conrol Home Appliances with Google Firebase, firebase esp32, internet and manual home automation, iot projects, firebase home automation, google firebase home automation
Id: A4p2TRzE3qc
Channel Id: undefined
Length: 10min 51sec (651 seconds)
Published: Sat Aug 28 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.