How to control Electrical appliances from android mobile

Hi , do you want to control all your electrical devices at your home controlled from your android mobile, do you want to create your own app to achieve this task, This post explains step by step procedure to create android app for controlling electrical appliances using MIT app inventor. you don't need to rely on 3rd party to control your home devices. This simply act as a Home automation where you can control everything from your phone. all you need is an android phone , an arduino , bluetooth module ( I've used HC-05) and a Relay.

You don't need to use particularly arduino to make this project, you can use any micrcontroller to make this project. I've controlled only 3 devices for this project, it can be extended to many devices. all you need to do is create extra buttons in the app and have more I/O's in the microcontroller side. I used Arduino because there are many shields available for this particular controller in the market and more tutorial and community to help you out. 







check the link for transfer of android apps to your phone here



Arduino Program
____________________________________________________________________________________

#include <SoftwareSerial.h>

SoftwareSerial BT(10, 11); //TX, RX respetively
String device;

void setup() {
 BT.begin(9600);
 Serial.begin(9600);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);


}
//-----------------------------------------------------------------------//
void loop() {
  while (BT.available()){  //Check if there is an available byte to read
  delay(10); //Delay added to make thing stable
  char c = BT.read(); //Conduct a serial read
  device += c; //build the string.
  }
  if (device.length() > 0) {
    Serial.println(device);

  if(device == "doneon")
  {
    digitalWrite(3, HIGH);
  }

  else if(device == "doneoff")
  {
    digitalWrite(3, LOW);
  }

  else if (device == "dtwoon")
  {
    digitalWrite (4,HIGH);
  }

 else if ( device == "dtwooff")
 {
   digitalWrite (4, LOW);
 }

 else if (device == "dthreeon")
 {
   digitalWrite (5, HIGH);

 }

 else if (device == "dthreeoff")
 {digitalWrite (5, LOW);}

device="";}} //Reset the variable

_____________________________________________________________________________________

35 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Hi,
    Could you pls help on this..When trying to connect to HC-06 getting this error "Error 507:Unable to connect.Is the device turned on?" is this an issue with arduino and HC-06??

    ReplyDelete
    Replies
    1. 1) turn on your Bluetooth
      2) pair your hc06 and android
      3) open the app and connect to the Bluetooth device

      Delete
    2. thanks for your reply..when i trying to connect the app and Bluetooth device i am getting this error mess..

      Delete
    3. im also getting 503 error what should i do now? its shows not a valid bluetooth MAC address

      Delete
    4. HC-06 datasheet
      http://www.tec.reutlingen-university.de/uploads/media/DatenblattHC-05_BT-Modul.pdf

      For HC-06 (slave device)
      Pin11 = RESET (pull low to reset. Leave float for normal operation)
      Pin24 = LED (output squarewave period of 102ms = unpaired, output high = paired)

      HC-06 works fine with AppInventorBluetooth application. However there will be occassion where user encounters Error 507 whenever trying to connect.This error stays unless user power cycle/reset the HC-06 module. From my observation, this usually occurs
      when improper bluetooth disconnect,connection lost or trying to connect more than once without disconnect. I have not found any software solution for this but there is however a hardware workaround to avoid/recover from the Error 507.

      Typically HC-06 module comes with 4 pins. TX,RX,GND and VCC only. Will need to solder additional two wires on HC-06 which are Pin11 for Reset and Pin24 for LED.
      Microcontroller(example: Arduino) which is connected to HC-06 needs to be programmed with additional task which is to detect the LED pin to determine paired or unpaired state.
      If a paired state followed by unpaired state is detected, then only trigger the reset line (pull low for about 1s then leave it float)

      That way everytime there is a bluetooth disconnect, the HC-06 module will reset. Therefore error 507 will be avoided.

      Hope this helps.

      Delete
  3. im also getting 503 error what should i do now? its shows not a valid bluetooth MAC address

    ReplyDelete
    Replies
    1. https://www.dropbox.com/s/px04onromnnw138/homeautomation.aia?dl=0, This is my aia file use it and check with your program

      Delete
  4. i'm having another problem when i press off button my relay is on and when i was press on my relay is on. what is the solution?

    ReplyDelete
    Replies
    1. Your relay is out of bussines. This happens when the current load overflow your element. Buying another one is not the solution. It Will be the sale fate. Hoy hace to change for another relay with other nominal values.

      Delete
    2. It Will be the same fate. You have to change for another relay with better nominal values for your line. It is very common with light control in wide rooms.

      Delete
  5. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. 1) if you are connecting bluetooth to 0,1 pin of arduino , no need to include serialsoftware.
      2) if you used 0,1 for bluetooth, you cannot connect to serial monitor in the arduino to check the incoming string.
      3) string from android app should match with your string.
      4) I think you are controlling using voice control, where matching to your string is difficult, try some easy string.

      Delete
  6. This comment has been removed by the author.

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. hi
    i study your project and it so easy and awesome but how if i add one input pin as a push button to read it status on mobile app as HIGH or LOW in a text LABEL.
    thanks

    ReplyDelete
  9. your blogs is awesome.
    videocon sms pack Rs.12
    175 Loc/STD SMS 14 Days.

    ReplyDelete
  10. we are expert in manufacturing the electric appliances. we make many parts which related the electric world. we are serving in solar panels manufacturing, DP panles and DP, motor control panels, manual power factor , PFI, LT switchgear, feeder pillars, power distribution board and its type, generator cubical body, cable laders, cables trays and UPS , UPS panels and cabinets. Email us to get our services "zulifiqarali6662@gmail.com" and call us to +923004546662 or +923134546662. thank you for interest.

    ReplyDelete
  11. "Program for arduino" can I have that video please?

    ReplyDelete
    Replies
    1. you simply copy and paste into arduino ide and upload to your arduino board it works well.

      Delete
    2. Can i have the mail? I need assistance in my project

      Delete
  12. Hye..how about when i use ethernet shield and not the bluetooth,how it will work?can u explain?

    can u make tutorial to create app using ethernet with mit app inventor?im new to this.Thank you

    ReplyDelete
  13. Hi thanks for your useful tutorial i need project with mq5 sensor alarm if variable goes up in smart phone with aia can you help me

    ReplyDelete
  14. hi..only supply from arduino to relay is enough to power the 12v relay or external power is required for the relay

    ReplyDelete
  15. i am using relay RDL/4RB/13/001/V1.0 how to power up using arduino

    ReplyDelete
  16. Thanks a lot for the share. Useful info written well and clear. Tolexo Coupons

    ReplyDelete
  17. Hi
    Control motor dc.arduino uno+blutooth+monster Moto Shield VNH2SP30
    Help me.

    ReplyDelete
  18. I enjoyed reading your work. I'll come back for more

    Keep up the good work :) from Home Buys Plus, a Home Buys Plus

    ReplyDelete
  19. Dude...i have made an app..which is a chat bot.. i want to attach this app in that one so i can control all my home with this only...any suggestions how.. i made the app in android sdk..is there any way i can attach both apps...pls tell me...i need help... and is there any way by which i can control the speed of ac and all with it...

    ReplyDelete