Home Automation Using Google Firebase
Introduction :
This is a home automation project which uses firebase and nodeMCU. First why I have chosen Firebase is because it can be maintained easily it has progress report, Crash Analytics etc and exactly it is free of cost so we can use this project to control the lights, fans, TV, etc. So let's get started
Supplies:
- NodeMcu - 1 Nos
- Relay Module - 1 Nos
- Breadboard - 1 Nos
- Male to female jumpers – 3 Nos
- An internet connection
- An android phone
Step 1: Creating Database
First you need to go to this website and log in to your Google account. And click on create a new project
And give your project name and click continue.
After a few minutes, it says, “your project is ready “and a continue button appears to click it, the dashboard appears.
And slowly scroll down you will see create real-time database button click on it.
It opens a dialog box telling you to choose either a locked mode or a test mode. Select test mode and click enable. You will be directed to the Data tab on top you will see four tabs click on the rules tab and check whether both read and write rules are true. If not change both to true.
Now go to project settings and copy your project id and web API key which we will use later. And also go to service accounts tab, on the left database secrets tab will be there click on the tab and scroll down you will see database name and a secret click on the show option on the right side of the secret and copy the secret and paste it in a notepad window. And now this part is over. Now we'll go to the app inventor part.
Step 2: Configuration of the App
The app part is not a tough job I have provided the link to download the .aia file. You can just download it and import it to your account.
First, sign in to the MIT app inventor and on the top, my project will be there click on it a list of options will be displayed click on import project (.aia) from my computer and select the downloaded aia file and click import the project will be imported and will be opened.
now click on the firebaseDB1 widget the settings tab will open on the right side in that change the firebase token with the web API key and change the firebase URL with your firebase project id in the format (https://{your-project-id}.firebaseio.com/). And click the build option to download the apk file of your app. Now install the app on your mobile phone. And we'll move to the next step.
Step 3: Code
So I have provided the code too. So download the code and open it change the firebase_HOST with your project id in the format ({Your-project-id}.firebaseio.com). Also change firebase_Auth with your firebase secret you copied earlier. And especially don't forget to change the wifi name and password.
Link: Code&App
If you have any doubts please put up a comment
Comments
Post a Comment