As we know IOT plays a very important role in our upcoming style of living. We will control and monitor our garage door, garden watering, garden light system, feed our pet, etcโฆ from a remote location which miles away from the destination. In this case, the internet will be our connecting medium. So, using the internet and giving connectivity of internet to our things we can monitor or can control from anywhere in the world.
For complete source code and all the documents click.
In this project, we will control the home appliances which are connected to the relay system using an android app and NodeMCU. So, we will follow the below steps to build our own Internet-based Home Automation.
This tutorial will only focus on the circuit diagram and code part. How to create a Google Firebase account and how to make an android app using MIT App Inventor2 you can follow the youtube link and create your own. Whereas every document you need will be attached in this tutorial so that you can download and use it as per your requirement. But please follow the youtube video tutorial.
STEP 1: Setting Google Firebase Database in Google Firebase Console.
STEP 2: We will develop Android App using MIT App Inventor.
STEP 3: We will set up our hardware and program. And we will test it.
Letโs start with STEP1:
- Google Firebase Console (Click HERE)
- Login using your Google account.
- Please follow the youtube tutorial to know how to create a project, and get the Firebase HOST and Firebase AUTH keys, which we will set in our program.
STEP2: To develop an android app
- Go to MIT app inventor2 (ClickHERE)
- Login using your Google account.
- Please follow the youtube tutorial to know how to create an android project and design your android app.
- Download the aia file of the android app for 4 channel relay which we are going to use in this tutorial HERE.
- Download the aia file of the android app for 8 channel relay( click HERE)
STEP 3: In this step, we will set the hardware and program.
Hardware Requirements:
- NodeMCU v1.0
- Four-channel relay board
- 5v and 3v Power supply.
For a complete material, list click here.
External Power supply: Here we are using
- Center tap 9-0-9 transformer
- 1N4007 diodes - 4 nos.
- 1000uF and 220uF capacitor 35v - 1no each
For a complete material, list click here.
Software Requirements:
- Arduino IDE (You can download it from HERE).
- Arduino Firebase Library (Download it from HERE).
- ArduinoJson Library (Download it from the IDE steps given below)
- HOST and AUTH details from Google Firebase.
- Android app using MIT app inventor2 (Download aia file HERE).
In the new updates of the Firebase Arduino library, we need ArduinoJson Library too. To download the ArduinoJson library follow the steps.
- Open Arduino IDE
- Click Sketch --- Click Include Library โ-- Click Manage Libraries and search ArduinoJson on the top search bar. Select version 5.13.5 otherwise it will give an error.
For complete source code and all the documents click.
Block diagram:
Android app to Google Firebase: As you can see in the block diagram, the android app will make a request to Google Firebase and create a variable against the button which you have pressed and store its default value of 0. So, accordingly, if you pressed all four buttons for the first time you will create four variables FB1, FB2, FB3, and FB4 with initial values of 0.
NodeMCU to Google Firebase: Now NodeMCU will fetch the same variable data from the Google Firebase using the valid same HOST name and AUTH key. And accordingly, it will turn on the relay connected to the respective pins.
Circuit diagram: External Power Supply click here.
For complete source code and all the documents click.
A complete youtube video tutorial is below.
PART 1:
PART 2:
Comments