Arduino Bluetooth Control Home Appliance Using Handset
Connect Arduino as per below diagram
User below Android application from google play store
https://play.google.com/store/apps/details?id=com.giumig.apps.bluetoothserialmonitor&rdid=com.giumig.apps.bluetoothserialmonitor
Connect as terminal and send data 0 for LED Off, 1 for LED On, 2 for Fan Off and 3 for Fan On.
Sample Arduino code to run Bluetooth
#include <SoftwareSerial.h>
char incomingByte; // incoming data
int bluetoothTx = 2; // TX-O pin of bluetooth mate, Arduino D2
int bluetoothRx = 3; // RX-I pin of bluetooth mate, Arduino D3
const int LED = 11;
const int FAN = 12;
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
void setup() {
Serial.begin(9600); // Begin the serial monitor at 9600bps
bluetooth.begin(115200);
bluetooth.print(“$”);
bluetooth.print(“$”);
bluetooth.print(“$”);
delay(100);
bluetooth.println(“U,9600,N”);
bluetooth.begin(9600); // Start bluetooth serial at 9600
pinMode(LED, OUTPUT);
pinMode(FAN, OUTPUT);
Serial.println(“Press Button to LED ON OFF or FAN ON OFF…”);
}
void loop() {
if (bluetooth.available())
{
incomingByte = bluetooth.read(); // read byte
Serial.println(incomingByte);
if(incomingByte == ‘0’) {
digitalWrite(LED, LOW); // if 0, switch LED Off
Serial.println(“LED OFF”);
}
if(incomingByte == ‘1’) {
digitalWrite(LED, HIGH); // if 1, switch LED on
Serial.println(“LED ON”);
}
if(incomingByte == ‘2’) {
digitalWrite(FAN, LOW); // if 2, switch LED Off
}
if(incomingByte == ‘3’) {
digitalWrite(FAN, HIGH); // if 3, switch LED on
}
}
}
Go to the below link for video tutorial