-
Notifications
You must be signed in to change notification settings - Fork 0
Report
Automated Room The main aim of the project is to control electronic appliances using an android device.
Communication To communicate with the electronic device we have used RN-42 blue-tooth module.We send information to the RN-42 using an android device,which sends it to the arduino in ASCII format which further switches the relay on or off.You can check the connections of RN-42 to arduino at this link.
Relay Basically relay is a switch. On sending the required information, the arduino establishes a current in the relay circuit which turns ON a bulb or vice-versa. We used a 6V relay in our case.The connections of relay to arduino is given in this link
Arduino Code `#include <SoftwareSerial.h> SoftwareSerial bluetooth(0,1);//it is (rx,tx) int a;
void setup() { pinMode(1,OUTPUT); pinMode(0,INPUT); pinMode(8,OUTPUT); pinMode(10,OUTPUT); pinMode(13,OUTPUT); Serial.begin(9600); setupBlueToothConnection(); }
void loop() { digitalWrite(8,LOW); digitalWrite(10,LOW); digitalWrite(13,LOW); while(1){ if(bluetooth.available() ){ int a=bluetooth.read(); Serial.println(a);
if (a==111) //I've used 'o' in my code.ASCII value of 'o' is 111. { digitalWrite(13,HIGH); digitalWrite(8,LOW); digitalWrite(10,HIGH); while(1) {if (bluetooth.read()==111) { digitalWrite(13,LOW); digitalWrite(10,LOW); digitalWrite(8,HIGH); delay(2000); digitalWrite(8,LOW); break; } } }
} } }
void setupBlueToothConnection() { bluetooth.begin(115200); // The Bluetooth Mate defaults to 115200bps delay(320); // IMPORTANT DELAY! (Minimum ~276ms) bluetooth.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode bluetooth.print("\r\n+STNA=SeeedBTSlave\r\n"); //set the bluetooth name as "SeeedBTSlave" bluetooth.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me bluetooth.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here delay(2000); // This delay is required. bluetooth.print("\r\n+INQ=1\r\n"); //make the slave bluetooth inquirable Serial.println("The slave bluetooth is ready!"); delay(2000); // This delay is required. } `
You can check out a demo of our project in this link
If you have any doubts,feel free to contact: Chaitanya - [email protected] Sudhakar - [email protected] Gunish - [email protected] Akhil Shetty - [email protected]
With Best Wishes -Team Appster