Introduction: Arduino AND Bluetooth HC-05 Connecting Easily

Picture of Arduino AND Bluetooth HC-05 Connecting Easily

Hello Every body , This is my first artical on , 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

Picture of 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 

Step 2: Connect Arduino With PC

Picture of Connect Arduino With PC

We now want to send or receive Data between arduino and computer , first we need to make a Communication link to Definition arduino Board to the computer .

We will need a software called Tera Term to show the data received or what we want to send through it .

You can download Tera Term or any terminal emulator software , you can download Tera term  from this link :

To make a link between your Arduino and bluetooth , do the following :

1) Go to the  bluetooth icon , right click and select Add a Device 

2) Search for new device , Our bluetooth module will appear as HC-05 , and add it 

3) The pairing code will be 1234 .

4)after make a pairing , we can now program the arduino and upload a sketch  to send or receive data from Computer.


Step 3: Arduino Code

Picture of Arduino Code
As I mentioned before , I will use software serial library to make pin D10 & D11 As Tx & Rx instead of using the default Rx and tx " D0 &D1 On most arduino Board " .

this program below allow us to control LED connected to D13 To blink on/off , by press # 1 from PC Keyboard the LED blink on , and if we press 0 LED blink off ! 

To send the Control commands from Computer to arduino , Go to the tera term , Run it , and choose Serial , and select the bluetooth Serial from the list as Shown on the picture .

The code below :

// This program shown how to control arduino from PC Via Bluetooth
// Connect ...
// arduino>>bluetooth
// D11   >>>  Rx
// D10   >>>  Tx
//Written By Mohannad Rawashdeh

// you will need arduino 1.0.1 or higher to run this sketch

#include <SoftwareSerial.h>// import the serial library

SoftwareSerial Genotronex(10, 11); // RX, TX
int ledpin=13; // led on D13 will show blink on / off
int BluetoothData; // the data given from Computer

void setup() {
  // put your setup code here, to run once:
  Genotronex.println("Bluetooth On please press 1 or 0 blink LED ..");

void loop() {
  // put your main code here, to run repeatedly:
   if (Genotronex.available()){;
   if(BluetoothData=='1'){   // if number 1 pressed ....
   Genotronex.println("LED  On D13 ON ! ");
  if (BluetoothData=='0'){// if number 0 pressed ....
   Genotronex.println("LED  On D13 Off ! ");
delay(100);// prepare for next data ...

After uploading This sketch go to tera term and press 0 or 1 and see the results

This Video show the results of this code .

Step 4: Connect Arduino to Android Device

Picture of Connect Arduino to Android Device
after we finished from connecting arduino with PC By bluetooth , let's move to how we can connect arduino To android device .

at first you need a terminal emulator on your andriod device to send or receive  data to arduino .

You can download this app from Google play .

after that , you can use the same arduino Sketch and control LED Blinking on or Off from android device .

just  type and t send #1 to make LED Blink on , or 0 to blink off .

this video below show how to control arduino I/O from android tablet .

Step 5: Receiving Data From Arduino

Picture of Receiving Data From Arduino

The last arduino Sketch that i wrote , used to send commands from PC Or android device  to android , Now in this program i will use arduino to Calculate the time since the start of the program in second , and send it Via bluetooth to any pairing device .

the code below 

// This program shown how to control arduino from PC Via Bluetooth
// Connect ...
// arduino>>bluetooth
// D11   >>>  Rx
// D10   >>>  Tx
//Written By Mohannad Rawashdeh

// you will need arduino 1.0.1 or higher to run this sketch

#include <SoftwareSerial.h>// import the serial library

SoftwareSerial Genotronex(10, 11); // RX, TX
int ledpin=13; // led on D13 will show blink on / off
long previousMillis = 0;        // will store last time LED was updated

// the follow variables is a long because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long interval = 1000;           // interval at which to blink (milliseconds)
int ledState = LOW;             // ledState used to set the LED
long Counter=0; // counter will increase every 1 second
void setup() {
  // put your setup code here, to run once:
  Genotronex.println("Bluetooth On please wait....");

void loop() {
  // put your main code here, to run repeatedly:
  unsigned long currentMillis = millis();

  if(currentMillis - previousMillis > interval) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;  
    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW)
      ledState = HIGH;
      ledState = LOW;

    // set the LED with the ledState of the variable:
    digitalWrite(ledpin, ledState);

at the end , You can visit the orginal artical in arabic language on my website

Hope my first artical here is useful to you  , thank you for your time , 


sunxing22 (author)2013-06-05

well done , thanks for this tutorial
please do not forget to post this tutorial in your blog in Arabic :)

JeremyR85 (author)2017-09-27

The HC05 used Bluetooth 2.0, while almost all mobiles understand only Bluetooth 4.0. Can the HC05 talk to a mobile with Bluetooth 4.0

Thanks for an answer,

Best wishes, Jerry

Unfortunatley I didn't have now a new smartphone(still stick with my old S4) but even S4 with BLT 4.0 works fine with HC05 , HC06 as well

You can use newer Bluetooth module like CC2540/CC2541 , support 4.0 BLT and work with Iphone and android as well

Sorry for the delay. Thanks for telling me about the CC2540/CC2541 module. I'll try it out

Best wishes, Jerry

VikiM4 (author)2017-09-28

simulate a push button using bluetooth from my phone on a music systemhi i want to simulate a push button using bluetooth from my phone on a music system what i want to achieve by doing this is when we power on the music system(by using WiFi enabled Sockets), by default it starts in aux mode by using mobile with bluetooth it changes it from aux to bluetooth mode so we can connect it with mobile and play music at scheduled time by using Tasker app
so we dont have to physically push any button
i use Zebronics ZEB-BT361RUCF Bluetooth 2.2 Ch. Multimedia Speaker System and i want to make change in this system

you need an App developer to help you in this , if your multimedia device support Bluetooth so all you need is to design an App to control it


sereyen (author)2016-08-15

hi, i am sereyen and i'd like to ask you about the bluetooth module HC-05 as i have met many troubles while working with it. i really don't know where is the error i've connected the VCC to 5v , the GND to GND and the RX of module to 18 pin and the TX to 19 pin and i've written the same code as you've written but, the bluetooth couldn't read any data and i am asking for help please. Here is the code i've written .

Open up the serial monitor and try .
Change the baud rate , worked at 38400 for me .

comiicome (author)2016-11-07

I'd like to connect my computer to my arduino Uno using a hc 05. I did every step carefully but when I go to Tera term I connect to COM3 (my receiving Bluetooth port) but nothing happens, and I can't even type 0 or 1. Do someone know where could the problem come from?

Try changing the baud rate from to 38400 . Just try different ones till it works. It worked at 38400 for me . Did not work at 9600 .

PetioP1 (author)2017-06-25

I would like to test this out on a teensy 3.2. What pins should I connect to in that case?

on teensy 3.1 / 3.2 you need to use Digital Pins with serial 1 (D0,D1) ,serial 1 (D9,D10) OR serial 3 (D7,D8) and use the hardware serial serial , which is easier and have more capability than software serial

Thanks for quick reply!

LeeC93 (author)2017-05-29

Has this been updated for Arduino IDE 1.6.1

And changed libraries?

MasumH1 (author)2017-05-13

The google play link is not working, please provide a replacement.

HimanshuM26 made it! (author)2017-05-23

terminal is asking me to press either 1 or 0 , but when I am giving either of them nothing happens. Nothing is displayed. Please help ASAP.

what is the software do you use on your PC ? check your Rx pin connection , and did you try from a mobile and got the same results ?

ShahM11 (author)2017-05-04

Sir, can you guide me on How to turn on buzzer if the connection bluetooth module HC-05 connection were lost with my phone. i'll really appreciate for any help. Thank You

you can check that using at command

otherwise connect bluetooth pin PIO9 to your board , this pin will give you pulses if no connection available , or give you HIGH if there is an connection

AmarnathM3 (author)2017-04-09

got an error of incorrect passkey

it never asked for any passkey

Pass key is 1234 or 0000

HarshC17 (author)2017-03-30

1)I installed tra term

2) paired hc-05 to my PC

3) open tera term

but the serial port for my bluetooth module does not show up in the list.

Only the Serial port for my arduino (connected via usb) appears in the list.

Can anyone help me resolve the issue?

Thanks for the help.

OK you need to check the serial port# of the bluetooth , are you using external bluetooth usb dongle or build in bluetooth ?

I am using built in bluetooth. HC-05 shows up as com-9 in control pannel.

VincentY16 (author)2017-02-16

Hello there sir, I'll like to ask a few questions, my HC-05 Module has no "KEY" pin but a "EN" pin, but I can't seem to use the Arduino IDE to enter AT mode unless I have to manually hold the button on the HC-05 Module itself. I've connected the "EN" pin to one of the socket on my Arduino Uno, and have set :-

pinMode(12, OUTPUT);

digitalWrite(12, HIGH);

Still couldn't enter the AT Mode.

I thing you need to power it off and then power it again to enter AT mode

Hmm, do I have to link the "GND" with a resistor to the "EN" pin to make it workable? o.O

EN pin is connected to wakeup pin in HC05 , you need to connect Key pin to VCC and then power off the VCC and re-power it again to enter to AT mode.

after you enter to AT mode you can disconnect this pin , no need to connect it to GND .
open serial monitor and set the serial option "both NL & CR" not
no new line"

But Mine only has the "EN" pin on my HC-05, I've tried powering it off and turning it back on while my "EN" pin is connected to the VCC. It still wouldn't enter the AT Command mode. Unless I have to manually hold a button that is on my HC-05 module and turning the VCC back on. Then only, I'll enter the AT Command mode... I've been frustrated with this problem for the pass 1 month. Couldn't solve it.

siffup (author)VincentY162017-03-26

I`m using ftdi module to connect, but should work the same way for you.

Connect the bt modul as usual (led´s blink fast)

bridge vcc to en for a second (led`s still blink fast) and open arduino serial @ 38400, nl and cr.

fmarengo (author)VincentY162017-03-15

Hello VincentY16. I had the same problem as you, until I powered up the Arduino Uno alone. Then I powered up the HC-05 module while keeping the button pressed. Hope this helps :)

after you re-power on the module remove EN pin from Vcc and keep it unconnected to enter AT mode .

did you try different buad rate ? sometimes it's 9600 another time 38400

you need to power off the module and then power it on again

VismayP (author)2017-03-02

I tried connecting HC 05 with arduino NG or older but the bluetooth is not discoverable on my android device can you please help me out with it.

i also changed its AT+class=0 to 1

the problem in the bluetooth it self.
can you just power on the bluetooth alone and check the led status

I did its blinking.

you need to set HC05 as a slave so your phone can pair with it , otherwise it will not see it.

vu2aeo (author)2017-02-23

Excellent tutorial. Thanks for uploading.


vivekschari (author)2017-02-06

I want the LED to turn on for 10 minutes when the button is pressed like a timer circuit can you help me plz.....

just set the delay on your code

this is a simple solution , you can use metro library

harsithng (author)2017-02-03

the version is not supporting windows 10

Try to download putty from here

if not working you need to search on Microsoft store for something similar to this

dianasthat (author)2017-01-23


I'm diana, for my final year project at school, i want to write an application that will run on microsoft waist band using arduino uno and bluetooth low energy, please, is that possible and how do i start with it?

AkshayJ42 (author)2016-12-28

int ledPin=13;

int state=0;

int flag=0;

void setup()


pinMode(ledPin, OUTPUT);

digitalWrite(ledPin, LOW);

Serial.begin(9600);// put your setup code here, to run once:


void loop()


if(Serial.available()>0) // put your main code here, to run repeatedly:






digitalWrite(ledPin, LOW);

if (flag==0)






else if(state=='1')


digitalWrite(ledPin, HIGH);








Can someone please say this code is right or wrong ...

Becasue im getting following error:

avrdude: stk500_recv(): programmer is not responding

avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x9a

delaflota (author)2016-11-16

Hi Mohannad,

thanks for sharing your experience!
I'm not sure if that does what I wanted to do.
What I want is connecting my door bell to arduino(via cable) and let arduino transfer the bell ringing to some bluetooth receivers like speakers or earphones for example.

Is that also possible?



HirdeshS2 (author)delaflota2016-12-05

yes possible pm me

Raudatul Jannah (author)2016-11-15


I want to ask about the thesis that I do. I have 2 robots. each robot using bluetooth. how pseudocode arduino that both the robot is connected via bluetooth. and how the program so that the robot can each access the data with each other

please send it to:

thank you

About This Instructable




Bio: Maker, PCB designer , electronics instructor from Jordan just one word ! I Adore electronics follow me on FB
More by Mohannad Rawashdeh:Convert Your Pringles Cans to RTTTL Audio PlayerTTP224 Digital Touch Sensor Applications Using ArduinoRF 315MHz/433MHz Wireless and Arduino...again!
Add instructable to: