loading

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 

http://arduino.cc/en/Reference/SoftwareSerial

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 :)
Arduino has 5V and 3.3V outs - you should connect the hc-05 to the 3.3V port not to fry it, afaik.
<p>Hello, Do I need to use a voltage divider ? because the bluetooth module works with a 3.3v signal.</p>
How do i connect hc-06 to auxiliary chord?
<p>Nice Project. You can use DroidScript to easily create a pretty Android App to talk to the HC-05. Check out the 'Bluetooth Serial' sample :)</p>
<p>Nice tutorial! Really helpful and awesome images and instructions. Thanks!</p>
<p>My HC-05 is paired to pc and Android, however it is disconnected. I am unable to send AT commands. To assure that the HC-05 is functional I tried 2 other HC-05, and the other modules also were paired but disconnected. Any ideas on what's going on? </p>
<p>With Ubuntu 14.04, after pairing an additional step was required to make Bluetooth available as a serial device within Ubuntu. See<a href="http://www.westernwillow.com/cms/blog/franco/creating-bluetooth-serial-port-ubuntu." rel="nofollow">http://www.westernwillow.com/cms/blog/franco/creat...</a></p><p>The basic commands are<br>#sudo hcitool scan<br>this will give you the address of the HC-05 bluetooth module<br>next, create the serial device as<br>#sudo rfcomm bind /dev/rfcomm0 &lt;the device ID retrieved in the prev command, e.g. [20:15:10:19:37:81]</p><p>This will give you a serial port /dev/rfcomm0.</p><p>This serial port can be accessed from TeraTerm, like in this tutorial, or from moserial (my preferred tool).</p><p>HTH, Willem</p>
<p>Nice tutorial hehe</p>
<p>Nice tutorial hehe</p>
<p>Hello . I need help, can i help someone?<br>I need to Ceres Android app to connect with Adriano, but I have not found<br>If you help to me send pm in telegram @mohamm_ran</p>
<p>hi there, i paired up 2 hc05 master &quot;1&quot; and slave &quot;0&quot; doing this <br>AT commands</p><p>//SLAVE = 98d3:31:2093cb AT+ROLE=0</p><p>//MASTER= 98d3:32:204d2a AT+ROLE=1</p><p>//AT+BIND=98d3,31,2093cb</p><p>//AT+BIND=98d3,32,204d2a</p><p>The end im left with paired modules that can talk to one another now i set this in AT+UART=9600.0.0 or 38400,0,0 im not sure now but it worked out fine now in the sketch i was doing all this in terminal obvsly using the terminal baud rate which was </p><p>as follow</p><p>include SoftwareSerial.h</p><p>SoftwareSerial mySerial(10, 11); RX, TX</p><p>void setup</p><p>{ Serial.begin(38400);</p><p> pinMode(9, OUTPUT);</p><p> digitalWrite(9, HIGH);</p><p> Serial.println(&quot;Enter AT commands:&quot;);</p><p> mySerial.begin(38400);</p><p>}</p><p>so my problem is that when i try to take the 2 talking modules to use in another project im not sure but they dont communicate no more &quot;after uploading new sketch&quot; am i suppose to use the same baud rate as in the sketch (38400); or should i be using the baud that i set this 2 up to begin with when i did the whole AT+UART=9600.0.0 or 38400,0,0 ??? </p><p>i was assuming what i have now when they were talking was a wireless RS232/terminal right? if so then all i have to do is make sure in the loop of what ever other program i go to use this modules on that they talk to that SoftwareSerial mySerial or something like this </p><p>void loop()</p><p>{</p><p> if (mySerial.available())</p><p>mySerial.write(&quot;Variable or Array here&quot;);</p>
This is very good tutorial for learners...
<p>Thanks dude.. great instructable. got me working in no time. :)</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>
Im having the same problem. Did you get the solution?
My hc05 connects to my android phone but doesnt respond to commands sent from my android device.<br>Pls Help me to solve this issue.<br>Thank you :)
<p>how about for arduino nano??? are the same way with arduino uno????</p>
<p>very instructive tutorial. i made it with the differences that i use nano and &quot;bluetooth terminal&quot; android application. </p>
<p>how can i connect arduino nano to hc-05??</p>
<p>how do you connect arduino nano to bluetooth hc-05??</p>
<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>+1</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>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>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>

About This Instructable

738,343 views

295 favorites

License:

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