(Voice Command): Light ON (Voice Command): Lamp ON (Voice Command): Socket ON (Voice Command): Fan ON (Voice Command): Light OFF In the name of ALLAH, the Most Merciful and Most Gracious. Peace be upon you and ALLAH's mercy and blessings. Viewers! Our todays project is: "Android Application Controlled Home Appliances" So, let's download circuit diagram, code, apk file and aia file for it. Those who have not subscribed our channel yet, first SUBSCRIBE to our channel And also press the bell icon. So that, you can get the updates of latest videos. Now, let's download the files. You can get their download link from the description below. You can download them from there. So, our files have been downloaded. From here, click on Show in folder. After this, open this zip file. After tis, you have to extract it without confirmation from here. It has generated a folder. Open it. In it, first of all we have the 'aia file'. After this, there is the 'apk file'. After this, there is the 'code file'. After this, there is the 'circuit diagram'. So, lets begin with the circuit diagram. This is the circuit diagram. In it, first of all we have used an 'Arduino Nano'. After this, a 'Bluetooth Module HC-05' is used. After this, a 'Relay of 4 Modules' is used. After this, the 'Power Source of 220 Volt' is used. The 'neutral' of 220 volt source is directly connected with the load. The 'line' of 220 volt source is connected with the 'common' of relay. Normally, 'output from open' is attached with the load. After this, here, we have used a 'Power Adapter of 5 Volt and 2 Ampere'. That is providing us with 5 volts for the relay module, arduino nano and bluetooth module. After this, an 'Android App' is developed from 'MIT App Inventor Website'. So, this was our circuit diagram'. Now, let's join the hardware according to the circuit diagram. Welcome Back! Now, I will give you the overview of the code. So, there is our code. Open it on 'Arduino IDE'. The link to code, circuit diagram, aia file and apk file is given in description below. You can download them from there. So, this is our code. In this, first of all we have called the library of 'EEPROM'. We have used the library of EEPROM to keep the status of the load saved. After this, the library of 'SoftwareSerial' is called. In Arduino Nano, built in serial is at pins 0 and 1. If we attach the bluetooth module to the same serial, then while uploading the code, we have to remove the bluetooth module. And we have to attach it again after uploading the code. To avoid this, by using SoftwareSerial we have initialized a serial of our own desire of name 'BT_Serial'. For which, pins 2 and 3 are initialized. Pin 2 is 'Rx' and pin 3 is 'Tx'. After this, pins for 4 relays are initialized. Pin 4, Pin 5, Pin 6, Pin 7 After this, a variable of 'bt_data' is initialized. The data which is read from bluetooth will become equal to the bt_data variable. After this, the variables of 'load1, load2, load3, load4, power' are initialized. In void setup(), simply the baud rate of serial is initialized as 9600. Baud rate is data per speed. After this, baud rate of BT_Serial is initialized as 9600. After this, the pins of 4 relays are initialized in OUTPUT mode. Along this, here we have written 1 on the pin of relay. The relay turns ON from LOW. And turns OFF from HIGH. Here, as we initialize the relay pin in OUTPUT mode, it becomes LOW. Simultaneously, we have turned it to HIGH. In start, the loads will be OFF. After this, here we have updated the variable of load1 by getting the value by EEPROM from address 1. We have updated the variable of load2 from address 2. And from address 3, we have updated the variable of load3. And from address 4, we have updated the variable of load4. After this, power variable is updated from address 5. After this, there is the delay of 500 milli seconds. After the delay of 500 milli seconds, it goes to the 'void loop()'. In void loop(), first of all the data from bluetooth serial (BT_Serial) is read. The data which is read from here will become equal to the variable of bt_data. After this, a check is placed on the variable of bt_data. When the value of bt_data variable is equal to 'A', at this condition, load1 variable becomes equal to 0. And in EEPROM, this value will be written at address 1. On the android application, when we press the button for light on, we receive A at the variable of bt_data. As 'A' is received, it will make load1 variable equal to 0. Along this, in EEPROM, this value will be written at address 1. Then if we press the OFF button, bt_data value becomes equal to 'a'. At this condition, it will make load1 variable equal to 1. And will write this value on address 1 Similarly, if button for lamp on is pressed, bt_data will receive 'B'. And load2 variable will become equal to 0. And this variable will write on address 2. After this, if we press the OFF button, bt_data value becomes equal to 'b'. And load2 variable will become equal to 1. And in EEPROM, this value will be written at address 2. Similarly, if button for socket on is pressed, bt_data will receive 'C'. The load3 variable will become equal to 0. And in EEPROM, this value will be written at address 3. After this, if button for socket off is pressed, bt_data will receive 'c'. The load3 variable will become equal to 1. And in EEPROM, this value will be written at address 3. If we press the button for fan on, bt_data will be equal to 'D'. At this condition, load4 variable will become equal to 0. And in EEPROM, this value will be written at address 4. After this, if button for fan off is pressed, bt_data will be equal to 'd'. At this, load4 variable will become equal to 1. And in EEPROM, this value will be written at address 4. From the application, when we press the button for power on, we receive E at the variable of bt_data. At this condition, power variable is 0. And in EEPROM, this value will be written at address 5. If button for fan power is pressed, bt_data will be equal to 'e'. At this condition, power variable is 1. And in EEPROM, this value will be written at address 5. From here, value of variable of bt_data becomes 0. Here, we have put a check on power variable. If power variable is equal to 1, at this condition it will write 1 at the pins of 4 relays. Means that all four loads are turned off. After this, if power variable is equal to 0. At this condition, it will go to else. Here, we write load1 variable on pin of relay1. load2 variable is written on pin of relay2. load3 variable is written on pin of relay3. Variable of load4 is written on the pin of relay4. Here, we have used power variable to turn off all the loads. Means that we are going out of the room. We will turn the power off. All loads will turn off. And when we will enter in the room, we will turn the power on. Loads will turn to the status in which the were before turning the power off. And here, we have printed the power variable, load1 variable, load2 variable, load3 variable and load4 variable to update the status of load on android app. After this, there is a delay of 500 milli seconds. For the delay of 500 milli seconds, this loop will keep running and printing these variables on bt_data serial (BT_Serial). When we will open android application, load status will be updated. Means the loads which are on, it will show them on and the loads which are off it will show them off. So, this was our code. Now, lets upload it to Arduino. From here, go to tools. After going to tools, select the board as Arduino Nano. After selecting the board, go to the tools again. From here, select the port. After selecting the port, upload the code from here. Done uploading. Our code has been uploaded. Now, I will give you the overview of the app developed from MIT app inventor. From here, search mit app inventor. Go to their website. From here, go to Create Apps. From here, login yourself by Gmail account. If you have to develop a new app, you will have to go to start new project. After this, you have to write the name of your project and make your new application. From here, we have to go to the projects. After going to projects, click on Import project (.aia) from my computer. There is an aia file and an apk file in the files which we have downloaded. You have to upload the aia file for changing. From here, select the aia file and open it. Click on OK. The aia file is uploading. So, this the graphic of our app. In it, first of all we have used a button. We open bluetooth pair list by it. After this, two buttons are used for power on and off. After this, two buttons are used for light on and off. After this, two buttons are used for lamp on and off. After this, two buttons are used for socket on and off. After this, two buttons are used for fan on and off. After this, a button is used for voice. Here, we have used labels to update the status of the load. So, this is the graphic of our application. If you want to change any thing in the graphics, you have to select it. After selecting, make the changes. As by selecting the background, we can upload any image to change the background. In this application, we have made auto connection with the bluetooth. When we will open the application, mobile will be automatically connected with the bluetooth module. We have to select bluetooth module first time. When we select it, it is stored in the database. When we will open the application next time, it automatically connects with the bluetooth module. And updates the status of loads. The loads which are on are shown as on and the loads which are off are shown as off. So, this was our graphic. Now, I will explain the blocks. So, these are our blocks. In it, first of all we press the bluetooth button (BT_Button). As we press it, pair list of bluetooth opens. We select the bluetooth module from there. When we select the bluetooth module, it stores in the database. Here, we have used 10 buttons. When we press Load1_On button, it sends 'A' to bluetooth module. When we press Load1_Off button, it sends 'a' to bluetooth module. When we press Load2_On button, it sends 'B' to bluetooth module. When we press Load2_Off button, it sends 'b' to bluetooth module. And when we press Load3_On button, it sends 'C' to bluetooth module and when we press Load3_Off button, it sends 'c' to bluetooth module. And when we press Load4_On button, it sends 'D' to bluetooth module and when we press Load4_Off button, it sends 'd' to bluetooth module. When we press Power_On button, it sends 'E' to bluetooth and when we press Power_Off button, it sends 'e' to bluetooth. These buttons are used for manual control. Along this, we have called some commands to control it by voice. First, when we press the voice button, speech recognition is called. It converts the speech to text. After this, it calls the speech recognition function. If we say light on, it will send 'A' to bluetooth. Along this, it will call speech recognition again. Similarly, it will send 'a' for the command of light off. On lamp on command, it will send 'B'. On lamp off, it will send 'b'. On socket on, it will send 'C'. On socket off, it will send 'c'. On fan on it will send 'D'. On fan off, it will send 'd'. On power on it will send 'E'. On power off, it will send 'e'. Along this, we have put a check on the data read from bluetooth. Here, it is reading 5 variables. load1, load2, load3, load4 and variable of power. Here, the first one is the power variable which was written on serial in the Arduino code. We have put a check on power variable. If power variable is equal to 1, it will show OFF in the text of power in red colour. After this, here we used else. If power variable is equal to 0, it will show ON in the text of power in green colour. After this, data 2 variable which is for load1 is equal to 1, it will show OFF in the text of load1 in red colour. After this, if data 2 variable is equal to 0 it will go in else. Here, it will show ON in the text of load1 in green colour. Data 3 variable is used for load 2. Data 4 variable is used for load 3. Data 5 variable is used for load 4. So, these were the blocks. Now, let's build the apk file. From here, go to Build. After this, click on App (save .apk to my computer). As we press it, apk file starts downloading. The apk file has been downloaded. From here, click on show in folder. You have to cipy the apk file in android mobile and then install it. After installing, pair the bluetooth. After this, open the app and click on connect button. It will open pair list. Select HC-05 from there. (Voice Command): fan on. (Voice Command): fan off. (Voice Command): light off.