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.
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
_____________________________________________________________________________________
Program is showing errors.
ReplyDeleteWhat error you are getting??
DeleteThis comment has been removed by the author.
ReplyDeleteIs the Bluetooth turned on? And connected
DeleteHi,
ReplyDeleteCould 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??
1) turn on your Bluetooth
Delete2) pair your hc06 and android
3) open the app and connect to the Bluetooth device
thanks for your reply..when i trying to connect the app and Bluetooth device i am getting this error mess..
Deleteim also getting 503 error what should i do now? its shows not a valid bluetooth MAC address
DeleteHC-06 datasheet
Deletehttp://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.
im also getting 503 error what should i do now? its shows not a valid bluetooth MAC address
ReplyDeletehttps://www.dropbox.com/s/px04onromnnw138/homeautomation.aia?dl=0, This is my aia file use it and check with your program
Deleteoke thnaks let me check
Deleteits Working !!!!!
ReplyDeleteHola buenas noches amigo, una pregunta. Como lograste resolver el problema 503?
Deletei'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?
ReplyDeleteYour 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.
DeleteIt 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.
DeleteThis comment has been removed by the author.
ReplyDelete1) if you are connecting bluetooth to 0,1 pin of arduino , no need to include serialsoftware.
Delete2) 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.
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeletehi
ReplyDeletei 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
Nice share, soo like it, very Best android tips trik
ReplyDelete"Program for arduino" can I have that video please?
ReplyDeleteyou simply copy and paste into arduino ide and upload to your arduino board it works well.
DeleteCan i have the mail? I need assistance in my project
DeleteHye..how about when i use ethernet shield and not the bluetooth,how it will work?can u explain?
ReplyDeletecan u make tutorial to create app using ethernet with mit app inventor?im new to this.Thank you
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
ReplyDeletehi..only supply from arduino to relay is enough to power the 12v relay or external power is required for the relay
ReplyDeletei am using relay RDL/4RB/13/001/V1.0 how to power up using arduino
ReplyDeleteThanks a lot for the share. Useful info written well and clear. Tolexo Coupons
ReplyDeleteHi
ReplyDeleteControl motor dc.arduino uno+blutooth+monster Moto Shield VNH2SP30
Help me.
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...
ReplyDeleteHello
ReplyDeleteActually i have connected an led to pin nomber 4 and i have made the same app from ur video and i run this programme into arduinoconnected blutooth but that led does not off when i click off button it always remains on......serial monitor shows tjat data goes off when press off...
please can you help me on home automation control by gsm please if you can send me on motibyenegole@gmail.com
ReplyDeletehi thanks for this tutorial , can you help me with servo motor voice command code for arduino.
ReplyDeletethanks in advance
Mobile app
ReplyDeleteWe provide information about fraudsters who are using readily available Mobile app information with Taxi booking app sophisticated techniques such as phishing with fake websites, hijacking social media or mobile devices. Contact us
If you want to save money, you should consider a set of all-season tires, which are made of high-quality materials. They offer excellent traction and braking distance, so you can enjoy a great ride throughout all seasons. If you want to get more interesting details about household utilities, you may go here.
ReplyDelete