Hello Every body , This is my first artical on Instructable.com , I'm so happy for that , and I will start by How to connect arduino with bluetooth , I suffered a lot of problems when I try to connect it as the website and instructable artical did , So i decided To share my experience with You

The bluetooth module I will use today is HC-05 which is so familiar and cheap ,

Most tutorial on The website Connect the bluetooth with default Rx and Tx on the arduino Board , I faced a lot of problem and bluetooth didn't work will .

But arduino  support something Called Software Serial , which allow You to change any arduino board pin to serial pin 


so After reading this article you will be able to:

1) Connect arduino Board with PC By Bluetooth , to send and receive data .
2)Connect arduino Board with Any android device .

so you can send your information , Like Sensors reading , from arduino to PC Or android device , and you can build your Home automation system by bluetooth , and controlling your robot wirelessly


Step 1: Material and connection

you need to do this experiment :

1) Arduino Board " I used Arduino Uno ".
2) Bluetooth module HC-05.
3)Solderless jumper.
4)Bread Board .
5)Battery 9V "Optional".

The connction between  Arduino and bluetooth is like the schematic above 

well done , thanks for this tutorial <br>please do not forget to post this tutorial in your blog in Arabic :)
<p>also the link for the Android app is no longer valid - please use </p><p>https://play.google.com/store/apps/details?id=com.circuitmagic.arduinobluetooth</p>
<p>AdrianR11 you just made my day :-) I was going to test it as otherwise my Arduinopro micro serial ports would have been wasted and also two more pins were rendered out of use - thanks for sharing man ! </p>
<p>where the android apps? the link is missing</p>
ربنا يجزيك خير ويوفقك يا رب يا هندسه بنتعلم من حضرتك كتير
<p>Hello,</p><p>I have recently purchase some HC-05 bluetooth module and arduino board. I realise that HC-05 will only allow the inquiring mode to be set for 48*1.6sec = 61 sec. So i would have to type &quot;AT+INQ&quot; every 61sec. Is there a way i can make the HC-05 bluetooth module loop it's inquiring mode? :) </p><p>I need the bluetooth module to be constantly running in inquiring mode once i switch it on. </p><p>I hope you will be able to help me with this problem :)</p><p>Thank you!</p>
<p>Thank you for your guide! I was able to connect my arduino w/bt to my cell phone.</p>
<p>Great instructable, well done</p>
<p>nicely explained. thanks dude </p>
<p>very instructive tutorial. i made it with the differences that i use nano and &quot;bluetooth terminal&quot; android application. </p>
<p>Thanks for this tutorial. Very easy and well explained.</p>
<p>This is perfect for a co-workers project!</p><p>Program over Bluetooth!</p><p>Excellent, gonna give it a try, thanks for posting!</p>
<p>Thank you very much Mohannad! This one was easy and works like a charm.</p>
<p>This is amazing, would there be a way of communicating between a hc-05 with an arduino and a hc-05 with just a power source? i have very limited space and wondered if i would be possible to send a signal to turn a pin live on the arduino from a hc-05 without at arduino? i have ordered two and am awaiting postage. i have done this with 433mhz rf tx and rx but hey pick up to much interference. Basiclly hope to put a push switch on the hc-05 and have the ardino trip a relay. </p>
<p>nice project i do to ry</p>
<p>Hi Everyone,</p><p> For the third step, in which we upload the code to make the arduino run, do we upload it in an arduino sketch and then view it in the TeraTerm? It seems that when the teraterm and arduino are sharing the same com port, it gives the error (&quot;Serial com port 4 is already in use&quot;) Is there anyway to fix it?</p><p> Thanks!</p>
<p>This works fine for me when I test it <br>through the serial monitor in the Arduino IDE. And I can connect and <br>pair both windows and my android phone to the device. However, I'm not <br>able to get any reaction in Tera Term or any other terminal emulator on <br>Windows, nor the Bluetooth Terminal Emulator I'm using in Android. No <br>echo return, and no on/off switching. In short, it works in the Serial <br>Monitor but not over bluetooth.</p><p>Any ideas?</p>
Sir what u have provided lonk to download not found in google play say way to instal
<p>Hi ,</p><p>Thank you for a great instructable. I modified your code slightly to allow the use of hardware Serial1 , so I could connect my HC-05 to my Arduino Mega 1280. All I did was<em> ctrl+ f </em> to replace your software serial object with<em> Serial1 so </em><em>Genotronex.begin(9600);</em> will become <em>Serial1.begin(9600); </em>I also used the Tx1 and Rx1 pins connected to my HC-05 RX and Tx respectively . <strong><em>I had to remove the USB connection from my PC (Win7)to my Arduino and power it from a 5v wall wart. </em></strong>As my Arduino will not connect properly with bluetooth when the USB serial is connected. I xctu to scan for the (Blue Tooth)serial ports and used Putty Tel to try each com port (10 , 11 ), I had read somewhere the lower number would work but in my case it was Com port 11. I have put my mod of your code below for anyone using a mega.</p><p>//SoftwareSerial Serial1(10, 11); // RX, TX</p><p>int ledpin=13; // led on D13 will show blink on / off</p><p>int BluetoothData; // the data given from Computer</p><p>void setup() {</p><p> // put your setup code here, to run once:</p><p> Serial1.begin(9600);</p><p> Serial1.println(&quot;Bluetooth On please press 1 or 0 blink LED ..&quot;);</p><p> pinMode(ledpin,OUTPUT);</p><p>}</p><p>void loop() {</p><p> // put your main code here, to run repeatedly:</p><p> if (Serial1.available()){</p><p>BluetoothData=Serial1.read();</p><p> if(BluetoothData=='1'){ // if number 1 pressed ....</p><p> digitalWrite(ledpin,1);</p><p> Serial1.println(&quot;LED On D13 ON ! &quot;);</p><p> }</p><p> if (BluetoothData=='0'){// if number 0 pressed ....</p><p> digitalWrite(ledpin,0);</p><p> Serial1.println(&quot;LED On D13 Off ! &quot;);</p><p> }</p><p>}</p><p>delay(100);// prepare for next data ...</p><p>}</p>
<p>Hi, i have a question and i hope you guys can help me with this. how does the arduino actually know actually know which data it is going to send or receive? in which part of the code does it do that? i want to make two arduinos one having a HC05 as a master sending data over to a HC06 slave on two different laptops. I hope you can answer me.</p>
<p>The library opens a serial port and between the devices and that is what is used to send and receive the data. Therefore the data is sent in the code via the Serial.println and is received in the code via the serial.read() statement. I suggest looking at some examples of the serial communications that come with the IDE to assist further</p>
<p>Well done, nice article.</p>
<p>Problem:</p><p>I can connect to AT commands using HC-05 it responds everything,. But when I use any application from an application to light led up. it doesn't light the led up. but hc 05 keeps blinking. I am using Ardudroid application for testing. My hc 05 is paired already and I'm connected to HC05 But it doesn't light the LED. </p><p>arduino code:</p><p>int ledPin = 13;</p><p>int state = 0;</p><p>int flag = 0;</p><p>void setup(){</p><p> pinMode(ledPin, OUTPUT);</p><p> digitalWrite(ledPin, LOW);</p><p> Serial.begin(38400); </p><p>}</p><p>void loop(){</p><p> if(Serial.available() &gt; 0){</p><p> state = Serial.read();</p><p> flag = 0;</p><p> }</p><p> if(state == '0'){</p><p> digitalWrite(ledPin, LOW);</p><p> if(flag == 0){</p><p> Serial.println(&quot;LED: off&quot;);</p><p> flag = 1;</p><p> }</p><p> }</p><p> else if(state == '1'){</p><p> digitalWrite(ledPin, HIGH);</p><p> if(flag==0){</p><p> Serial.println(&quot;LED: ON&quot;);</p><p> flag = 1;</p><p> }</p><p> } </p><p>}</p><p>Any solution for this guys? What supposed to be the problem?</p><p>Thank you for your help guys</p>
<p>RX/TX from HC-05 carrier board you use are only 3.3 volts (I only saw a carrier board with 3.3 to 5 volt level translator on a HC-09 board), so if you pass too much data, your HC-05's RX will finally burn. So put some kind of level translator between those 2 pins, or your bluetooth device will burn.</p>
<p>No such app exists(android app) please update your link</p>
<p>Since app mentioned author not existed i tried bluetooth terminal app. It's working without any issue. U need to pair the HC-05 before using application</p><p><a href="https://play.google.com/store/apps/details?id=Qwerty.BluetoothTerminal&hl=en" rel="nofollow">https://play.google.com/store/apps/details?id=Qwer...</a></p>
<p>I had issue before and i fixed it. For anyone who having the same issue. My board is Mega 2560. I'm in windows 8.1 and COM15 was the outgoing port in my case. When I try to connect it using teraterm it always complained &quot;can't connect to COM15&quot;. I supplied 5V to the HC-05 before. When i changed it 3.3V voltage suddenely it begin to work. After that i switched back to 5V and its also working. Still i don't have any idea what happen before</p>
<p>after following this instructable, things went out so easily! thanku very much! I made it succesfully. :)</p>
<p>the application is no longer available on the play store page .. please , put it back , i neeeeeeed it urgently !</p>
<p>Hai,</p><p>I need to interface the arduino with smart phone instead of PC. Please suggest ways for mobile interface of arduino. Thank you</p>
<p>IT worked and its toooooooooooooooooooooooo simple</p><p>Tres bien</p>
<p>Done the connections in exactly the same manner, also used the same sketch, still doesnt work for me. Neither with android nor TeraTerm.<br>Please help. What could be the possible problem?</p>
<p>Did you figure out what was wrong?</p>
<p>I am having the same problem . Can't get any thing to show on the TeraTerm and the 1 or 0 command doesn't do anything</p>
<p>Try following along with the tutorial by GreatSott! on Youtube. I found it extremely useful!</p>
<p>Thank you SO MUCH for this tutorial. I am using a Mac, so the procedure was a bit different. </p><p>You don't need Tera Term</p><p>1. Simply pair your device using the bluetooth icon, the sensor is detected as HC-05, and the passcode is 1234 (note: the connection might or might now work, and sometimes takes many tries. Sorry, but I really have no idea why).</p><p>2. Make sure your arduino is NOT connected using the USB cable. Press upload, and it will give you the option of /dev/tty.HC-05-DevB (In my Mac, it shows 0-9, pick the lowest one). Your program will now be uploaded normally.</p><p>3. Open the Serial monitor and type 1 or 0 in the textbox next to send, right at the top. Sending 1 turns on the LED on pin 13, Sending 0 turns it off.</p><p>Once again, thank you very much for this instructive and coherent tutorial! </p><p>Cheers</p><p>Subha</p>
<p>Nice project. now i heave several question, hope you can help</p><p>1. will it work if i used atmega8525 instead of arduino kit|</p><p>2. do i need level converter module? or can i just use simple voltage divider to make it 3.3v for hc-05 vcc? because from what i read, it supplied with 3.3V vcc.</p><p>thanks :)</p>
<p>Very nice tutorial. I set my Arduino and HC-05 up exactly as you described. I ran a simple sketch that writes numbers to the monitor via Serial write. It works just fine when I use the USB connection and the Arduino serial monitor, but when I try the Teraterm via the bluetooth the page stays blank. The HC-05 seems to connect just fine and the bluetooth com port listed is com 5. I also tried it on the Arduino IDE using com 5 to the serial monitor and nothing happens. Any suggestions of how to get the Tera Term to display the Arduino messages?</p><p>I tried your sketch also, but the same results</p><p>Thanks</p>
<p>Thank you very much! Now my bluetooth module finally works!</p>
<p>For HC05 there are 6 pins, state, Rx, Tx, GND, Vcc and EN. I just need to connect 4 (Rx, Tx, GND, Vcc) to interface with Arduino? </p>
<p>Yes, you need only those 4 pins.</p>

About This Instructable


255 favorites


More by Mohannad Rawashdeh: Motor Driver BTS7960 43A BYJ48 Stepper Motor RF 315/433 MHz Transmitter-receiver Module and Arduino
Add instructable to: