Introduction: Arduino Bluetooth With App Virtual Response (Like J.A.R.V.I.S)
Hello Every body , This is my first article on Instructable.com , I'm so happy for that , and I will start by How to connect arduino with bluetooth, To share my experience with You .The bluetooth module I will use here is HC-05 which is so familiar and cheap ,Most tutorials are based on connect the bluetooth with Rx and Tx on the arduino Board.
So, here we are going to controll a light with this tutorial at the end you can just use it control your A.C , T.V or any Electrical appliance.
Here : Video of J.A.R.V.I.S App
Link For App : Arduino Jarvis
Step 1: Components and Connections Required
- 1x Arduino
- 1x Bluetooth Module ( HC-06)
- 1x Smartphone (any Android will work)
- 1x Led
- 3x resistors
- 1x Breadboard
- Jumper Cables
Step 2: Upload the Sketch
int ledblue=2;
int tx=1; int rx=0; char inSerial[15];
void setup(){ Serial.begin(9600); pinMode(ledblue, OUTPUT);
pinMode(tx, OUTPUT); pinMode(rx, INPUT); allpinslow(); }
void loop(){ int i=0; int m=0; delay(500); if (Serial.available() > 0) { while (Serial.available() > 0) { inSerial[i]=Serial.read(); i++; } inSerial[i]='\0'; Check_Protocol(inSerial); }}
void allpinslow() { digitalWrite(ledblue, HIGH); digitalWrite(ledblue, LOW); }
void Check_Protocol(char inStr[]){ int i=0; int m=0; Serial.println(inStr);
if(!strcmp(inStr,"2off")){ //Led Off allpinslow(); digitalWrite(ledblue, LOW); Serial.println("Blue Off"); for(m=0;m<11;m++){ inStr[m]=0;} i=0;}
if(!strcmp(inStr,"2on")){ //Led on allpinslow(); digitalWrite(ledblue, HIGH); Serial.println("Blue on"); for(m=0;m<11;m++){ inStr[m]=0;} i=0;}
else{ for(m=0;m<11;m++){ inStr[m]=0; } i=0;
}}
Step 3: Android App
1) Connect BT gnd to gnd of arduino and 5v to 5v of arduino , connect tx pin of bluetooth module to rx pin, then connect rx pin of arduino to 2.2 k ohm resistor and connect the other end of resistor to 4.7 k ohm and connect the other end of 4.7 k ohm resistor to gnd and the rx of BT module should be connected to the middle of both 2.2 k ohm and 4.7 k ohm resistors.
2) Check the connections.
3) Now after setting everything install the application
4)go on to BT and select the device to connect
5) After device connected come to back section main menu where there are ON/OFF buttons. Now click on to the buttons for testing and congrats you made it working hurray!!
6) Any doubts and clarifications will be cleared in the application and further versions will be much better for controlling more than 10 devices at once. with virtual operations.
7) Please do comment and share your thoughts for future upgradations and versions of the application.
Link For The Android APP : Arduino JarvisBT
Video Guide : Android App Working
Step 4: Things in MIND
- You need to remove the RX and TX cables when you’re uploading the sketch to your Arduino.
- If the HC-05 Bluetooth Module asks for a password, It’s’1234′.or '0000'
- The TX of bluetooth should be connected to the RX of arduino and vice versa. So make sure You didnt do the wrong way. Make sure you connect it properly, the TX into RX and the RX into the TX.
- While uploading sketch remove RX and TX conections , And connect them back when the sketch is uploaded.
- Check the connection before giving supply
- Check whether the module is operated at 5v or 3.3v.
- If you don't see devices during searching in the app just click on the lines which are formed when the devices are available, then you see devices which are invisible till then. This was made for safety purpose.