Android controlled smart home
Step 5: Software
- Download HC-06 Control.apk Android app from here Link
- Copy and download "HC-06 Control.apk" in your smart phone
- Check the download from unknown sources setting before installation on your phone. Allow download/ install from unknown sources
- Install the app.
- Download Code in Arduino Board
- While Downloading Arduino Code Disconnect the Bluetooth module
Arduino Code:
/* www.circuits4you.com blog.circuits4you.com This code demostrates Bluetooth based Device control It controls Four Devicess through Relay This example code is in the public domain. */ //Define Relay Connections #define Relay1 9 #define Relay2 10 #define Relay3 11 #define Relay4 12 int inByte = 0; // incoming serial byte void setup() { Serial.begin(9600); pinMode(13, OUTPUT); pinMode(Relay1,OUTPUT); //Relay Pins in Output mode pinMode(Relay2,OUTPUT); pinMode(Relay3,OUTPUT); pinMode(Relay4,OUTPUT); } void loop() { if (Serial.available() > 0) { inByte = Serial.read(); switch (inByte) { case 0x03: digitalWrite(Relay1, HIGH); //Relay 1 on when inByte equals A break; case 0x04: digitalWrite(Relay1, LOW); //Relay 1 off when inByte equals B break; case 0x05: digitalWrite(Relay2, HIGH); //Relay 1 on when inByte equals A break; case 0x06: digitalWrite(Relay2, LOW); //Relay 1 off when inByte equals B break; case 0x07: digitalWrite(Relay3, HIGH); //Relay 1 on when inByte equals A break; case 0x08: digitalWrite(Relay3, LOW); //Relay 1 off when inByte equals B break; case 0x09: digitalWrite(Relay4, HIGH); //Relay 1 on when inByte equals A break; case 0x0A: digitalWrite(Relay4, LOW); //Relay 1 off when inByte equals B break; case 0x0B: digitalWrite(Relay1, HIGH); //All Relays ON when inByte equals 1 digitalWrite(Relay2, HIGH); digitalWrite(Relay3, HIGH); digitalWrite(Relay4, HIGH); break; case 0x0C: digitalWrite(Relay1, LOW); //All Relays OFF when inByte equals 2 digitalWrite(Relay2, LOW); digitalWrite(Relay3, LOW); digitalWrite(Relay4, LOW); break; } } }
Step 6: Power Supply Connections
- Connect +12V Adapter to Arduino
Step 7: Testing
- Turn on all setup
- Turn on Bluetooth on your phone and pair it with HC-06 (Pin 1234 or 0000)
- After successful pairing start the application
- You have done it…..
5. Connect your appliances to
relay board
nyc project
ReplyDeleteHow can i insert program to arduno,,,iam using arduno atmega 325 is it okay,,
ReplyDeleteits ok any board will work only take care of proper connections
Delete