Home Automation System With Your Own Application (android App)
Introduction: Home Automation System With Your Own Application (android App)
I was minded to make a home automation system since few months. So I made a system in last month.
It works with Internet. So I can control my system anywhere in the world with internet access.
To control this system I made my own mobile application ( Android application ) instead of using normal app like Blink.
In this tutorial I will explain how I made my home automation system.
Home automation System
If we take hardware parts
* I used ESP32 dev module (This microcontroller will receive commands from our phone and operate the system)
* relay system (This receive the signals from the microcontroller and working as a switch to operate the AC units)
These are the main parts and I used some I.E.Ds for testing and to get status.
Software,
I used MIT app inventor to make mobile application
For coding part on ESP32 I used Arduino application
In my project I want to send data from anywhere in the world to my system.
For that part I used data base called google firebase
Let's check what we need to make this project.
Supplies
We need Some electronics and some softwares to this project.
* ESP32 devkit v1 module (You can use any ESP32 module)
* Relay module
* Some LEDs (For testing)
* 10K resistors
* M to F jumping wires
Softwares,
Arduino application (To program ESP32 module.)
Mobile app (To control our system)
Step 1: How It Works?..
Check the image. As image describes, First from the phone we sent data to the data base. Via internet. Then data base store data in cloud. It updates Realtime.
Then our esp32 takes the data from the database.
So simply we send commands from the phone and esp32 takes them then work according to it.!
Step 2: Data Base
With this Realtime cloud-base database we can send data anywhere from the world if we have a internet connection.
So what this Data base do is It takes data that we send from the phone and store it on a cloud.
For that we use database called Google firebase
( Firebase is a platform developed by Google for creating mobile and web applications. It was originally an independent company founded in 2011. In 2014, Google acquired the platform and it is now their flagship offering for app development.)
Step 3: Build a Data Base
We need to create firebase project and need to create Realtime data base.
Here are the steps to create the database.
First, Log in to your google Account.
Open your browser, Search google firebase.
Click on their website.
Then go to console.
Make new project.
After create you a new project go to Realtime data base.
Then create a Realtime data base.
Copy your URL in database project and save it somewhere. We need that URL later.
Now go to project settings.
Then service accounts -> database secrets .
Copy your and save your Secret key. 382
It also need us later.
Check the images. They explain how to do these all steps step by step.
Step 4: Android Application
So, Let's make our own App. I'll put a video that explains how to create mobile app to automation system.
Download it from here : App
Note : If you use this sample , Application is a saved file and you have to open Mit app invertor and open that file from it. Then you can change it as you want. After you add Url and Token build your app and use it.
After you installed the application Open the database and check if database is update live when you click the buttons.
If it is updating, we are good to go!.
Step 5: Make the Circuit
Now we have database and App, all we need is the circuit. To build the circuit, find those circuit parts and bring them to on your table.
Check the diagram. Build it according to the diagram.
Note: You can connect relay power pins to whatever you want power supply. But note signal pins coming from the ESP32. So you need to make Common Ground. Connect the GND pin of relay to one of GND pin on sp32.
Few ELDs in the diagram are for testing.
Step 6: Coding Part
So now we need to make a code to work our circuit according to our commands.
For that we should make a code that should be able to get data from the data base live and run the circuit according to that data.
First of all open the Arduino software.
Then select the board as ESP32 dev module.
And select the correct port. 977