Household equipment such as bulb or fan controlled using your android device is an interesting project which most hobbyists want to do. A communication should be there between the android device and household equipment through some microcontroller boards such as Arduino uno. Bluetooth is a simple method to establish a communication between android device and household equipment. Here, I am using a HC-05 bluetooth module to communicate with android device. HC-05 is connected to Arduino uno to receive the data sent from android device. Depending on the data received from android device, we can use this Arduino uno to control our household equipment.
Connections are done as shown in the following diagram. Connections can be summarized as,
1. 5V pin of Arduino uno is connected to the VCC terminal of HC-05 bluetooth module.
2. Gnd pin of Arduino uno is connected to the Gnd terminal of HC-05 bluetooth module.
3. RX pin of Arduino uno is connected to the TX terminal of HC-05 bluetooth module.
4. TX pin of Arduino uno is connected to the RX terminal of HC-05 bluetooth module.
After completing the circuit, upload the following program to your Arduino board. Disconnect RX and TX pins connected to Arduino uno for successful uploading. Otherwise, uploading will be failed. After successful uploading, reconnect the RX and TX pins.
Next steps will be in your android device. Install Bluetooth Terminal application in your android device from Google Play Store.
After installing, open Bluetooth Terminal application and connect your android device to bluetooth device HC-05.
Select your bluetooth device from a list of available devices.
If connection goes successful, your Bluetooth Terminal will be as shown below.
Now, type letters in the text box and send.
Letters sent from your android device will be displayed in the serial monitor of Arduino.
Connections are done as shown in the following diagram. Connections can be summarized as,
1. 5V pin of Arduino uno is connected to the VCC terminal of HC-05 bluetooth module.
2. Gnd pin of Arduino uno is connected to the Gnd terminal of HC-05 bluetooth module.
3. RX pin of Arduino uno is connected to the TX terminal of HC-05 bluetooth module.
4. TX pin of Arduino uno is connected to the RX terminal of HC-05 bluetooth module.
After completing the circuit, upload the following program to your Arduino board. Disconnect RX and TX pins connected to Arduino uno for successful uploading. Otherwise, uploading will be failed. After successful uploading, reconnect the RX and TX pins.
char junk; String inputString=""; void setup() { while (!Serial); Serial.begin(9600); } void loop() { if(Serial.available()) { while(Serial.available()) { char inChar = (char)Serial.read(); //read the input inputString += inChar; //make a string of the characters coming on serial } Serial.println(inputString); while (Serial.available() > 0) { junk = Serial.read() ; } inputString = ""; } }Now, open the serial monitor from Arduino IDE. Nothing will be displayed in the serial monitor. Still, you must keep the serial monitor open until the remaining steps also get completed.
Next steps will be in your android device. Install Bluetooth Terminal application in your android device from Google Play Store.
After installing, open Bluetooth Terminal application and connect your android device to bluetooth device HC-05.
Select your bluetooth device from a list of available devices.
If connection goes successful, your Bluetooth Terminal will be as shown below.
Now, type letters in the text box and send.
Letters sent from your android device will be displayed in the serial monitor of Arduino.