Arduino With HC-05 Bluetooth Module in Slave Mode

Arduino and HC-05 in communication mode

Updated on 18.07.2015.

Updated 01.12.2016
There are now newer HC-06s and HC-05s that use the zs-040 breakout boards. These new modules have a LED (usually blue) at the top left of the Bluetooth daughter board and have a different firmware to the below. See HC-06 hc01.comV2.0 for an introduction to the HC-06. I haven’t written up details on the HC-05 yet.

Here is the zs-040 version of the popular HC-05. The HC-05 is based on the EGBT-045MS Bluetooth module. It can operate as either a slave device or a master device. As a slave it can only accept connections. As a master it can initiate a connection.

HC-05 zs-040

The EGBT-045MS Bluetooth modules (the smaller daughter board) is a 3.3v device. The HC-05 break out board has a 3.3v regulator that allows an input voltage of 3.6v to 6v but the TX and RX pins are still 3.3v. This means you can use the 5V out from the Arduino to power the boards but you cannot connect the Arduino directly to the HC-05 RX pin.

For the HC-05 RX pin (data in) we need to convert the Arduinos 5V to 3.3v. A simple way to do this is by using a voltage divider made from a couple of resistors. In my case I use a 1K ohm resistor and a 2K ohm resistor.

As a quick guide to the voltage divider; 1K + 2K = 3K. 1K is a third of 3K so it reduces the voltage by a third.
One third of 5V is 1.66 and 5-1.66 = 3.33 which is what we want. Putting the resistors the other way would reduce the voltage by 2 thirds.
For more information on voltage dividers have a look at the Sparkfun tutorial

Since the Arduino will accept 3.3 volts as HIGH you can connect the HC-05 TX pin (data out) directly to the Arduino RX pin (The 5V Arduino takes a voltage of 3V or more as HIGH).

HC-05 zs-040 Status LED

The onboard LED shows the current state of the module.
– rapid flash (about 5 times a second) – module is on and waiting for a connection or pairing
– single quick flash once every 2 seconds – the module has just paired with another device
– double quick flash every 2 seconds – connected to another device

The HC-05 remembers devices it has paired with and after cycling the power you do not need to re-pair. This means you can go from
– rapid flash (about 5 times a second) – module is on and waiting for a connection or pairing, to
– double quick flash every 2 seconds – connected to another device directly.


HC-05 Vcc to 5V (can be from the +5V out from the Arduino)
HC-05 GND to common GND
HC-05 RX to Arduino pin D3 (TX) via a voltage divider
HC-05 TX to Arduino pin D2 (RX) connect directly

HC-05 Basic Circuit
Remember to connect the GNDs together

HC-05 Basic set up - BreadBoard_1200

Power on the Arduino and the LED on the HC-05 should flash rapidly, about 5 times a second. This means it is on but not paired or connected. So far so good.

Default Settings

The default settings for new modules are
– Name = HC-05
– Password = 1234
– Baud rate in communication mode = 9600*
– Baud rate in AT/Command mode = 38400

*Not all modules have the same defaults. If you cannot get communication mode working with 9600 try other baud rates. 38400 is also common.

Thes above values can be changed but for now we will leave the default settings and try to connect to another device.

Added 12.07.2015
I have some new modules that have a default baud rate of 38400 for both AT mode and also communication mode. If you cannot get 9600 to work try 38400

Pair with an Android device

In my case, the Android device is a 7 inch tablet.

Before you can make a connection between blue tooth devices they need to be paired. So, with the Arduino and HC-05 powered, on the Android device;
– turn on bluetooth,
– scan for devices and the HC-05 should be listed,
– pair with the HC05 and enter the password “1234” assuming you have the default password.

Once paired the blinking LED on the HC-05 will change to a single short blink every 2 seconds or so.


Connect with an Android App

Connecting the Android device to the HC-05 creates a serial communication channel very similar to the serial monitor in the Arduino IDE. This means we need a Bluetooth version of the serial monitor. I use a Bluetooth terminal aptly named Bluetooth Terminal. Download it from Google Play here
Download, install, and open Bluetooth Terminal.
– open the menu,
– select “Connect a device – Insecure”,
– click “HC-05”, and “connected: HC-05” should appear at the top of the screen.

Once connected, the LED on the HC-05 will blink quickly twice every 2 seconds or so.

Bluetooth Terminal

OK, so the connection is working, now let’s try to send data from the Arduino to the Android device.

Arduino Sketch 01. Sending data to a connected Bluetooth Device

The following sketch sends “Bluetooth Test” to the serial monitor and the software serial once every second.

Upload the following sketch,

// Basic Bluetooth sketch HC-05_01
// Sends "Bluetooth Test" to the serial monitor and the software serial once every second.
// Connect the HC-05 module and data over Bluetooth
// The HC-05 defaults to commincation mode when first powered on.
// The default baud rate for communication is 9600
#include <SoftwareSerial.h>
SoftwareSerial BTserial(2, 3); // RX | TX
// Connect the HC-05 TX to Arduino pin 2 RX. 
// Connect the HC-05 RX to Arduino pin 3 TX through a voltage divider.
char c = ' ';
void setup() 
    Serial.println("Enter AT commands:");
    // HC-06 default serial speed for communcation mode is 9600
void loop() 
    BTserial.println("Bluetooth Test"); 
    Serial.println("Bluetooth Test"); 

Connect the HC-05 to the Android device and open Bluetooth Terminal. Open the serial monitor and you should see “Bluetooth Test” scrolling up the screen in both windows.

Bluetooth Test

HC-05  Serial Monitor

Arduino Sketch 02. Talking to a connected Bluetooth Device

Now lets try having a 2 way chat with the Android device. We are still using the Bluetooth Termainal app but this time we will trying sending messages to the Arduino.

// Basic Bluetooth sketch HC-05_02
// Connect the HC-05 module and communicate using the serial monitor
// The HC-05 defaults to commincation mode when first powered on.
// The default baud rate for communication mode is 9600
#include <SoftwareSerial.h>
SoftwareSerial BTserial(2, 3); // RX | TX
// Connect the HC-05 TX to Arduino pin 2 RX. 
// Connect the HC-05 RX to Arduino pin 3 TX through a voltage divider.
char c = ' ';
void setup() 
    Serial.println("Arduino is ready");
    // HC-05 default serial speed for commincation mode is 9600
void loop()
    // Keep reading from HC-05 and send to Arduino Serial Monitor
    if (BTserial.available())
        c =;
    // Keep reading from Arduino Serial Monitor and send to HC-05
    if (Serial.available())
        c =;

Upload the above sketch.
Open the serial monitor
Open Bluetooth Terminal and connect to the HC-05.

Now, whatever you type in the serial monitor should appear in Bluetooth Terminal a,d whatever is typed in Bluetooth Terminal should appear in the serial monitor.



The above examples use the HC-05 Bluetooth module in slave mode and the HC-06 acts exactly the same and the same sketches can be used.

Next step, turn a LED on and off from an Android app. I used the HC-06 in the LED example but a HC-05 can be used as well.


149 thoughts on “Arduino With HC-05 Bluetooth Module in Slave Mode

  1. Hi Martyn,

    Thanks for the useful tutorial. I am facing an issue with using the HC-05 – initially on power up, the status LED blinks fast and on pairing with my smartphone it blinks slowly (once every 2s, I think) indicating that it is connected. However, the issue is that even after I disconnect on my phone, the LED still blinks slowly – even though the pairing has been broken. Do you see this as well?


  2. On start up, with the HC-05 previously paired, the LED flashes quickly.
    From the Bluetooth Terminal app I connect to the HC-05 and the LED changes so this is blinks quickly twice every 2 seconds.

    When I disconnect from Bluetooth Terminal (the BT module is still paired but not connected), the LED on the HC-05 returns to blinking quickly.

    If I then unpair the HC-05, the LED stays blinking quickly.
    If I then re-pair the HC-05, I get a single blink every 2 seconds.

    The only time you get the quick single flash every 2 seconds is directly after pairing. The HC-05 remembers devices it has paired with so after pairing you go from not connected directly to connected.

  3. Hello

    Thanks for the easy integration article.I am a research student working on health sensor devices using arduino uno. I am using this kit .

    Now i want to use ardunio HC05 bluetooth module to send data from sensor board to my android phone.Idea is to write a simple programme which can pull sensor data from sensor board and send it to the cloud through HTTP.I am looking for possible collaboration/help or suggestion on this. I am stuck on integration the bundle(ardunio + ehealth sensor board) with android phone. The ehealth shield has support for bluethooh(their own Bluetooth solution) and 3g connectivity(it requires bending the pins, which i am afraid to do, because it can break the circuit)

    Would it be possible for you to communicate? skype or email?

    Thanks very much and i would really appreciate your help

    • This is beyond the scope of my blog. I would suggest you join the Arduino forum. You will get lots of help there.

      If you haven’t started on an Android app have a look at MIT’s appinventor. This is easy to use and should be enough to create an app to do what you want.

  4. Pingback: Connecting 2 Arduinos by Bluetooth using a HC-05 and a HC-06: Pair, Bind, and Link | Martyn Currey

  5. Thanks for your very good lessons.
    I can do work sketch 1 and 2, but something is wrong on my system: I can send words from serial monitor to Blueterminal, but not in the other direction. Nothing apears in serial monitor, except “arduino is ready”. Any sugestion?
    thanks for your attention.

    • Do you have the correct baud rate for BTserial?

      Not all HC-05s and HC-06s have the same default settings. Try other settings. 38400 and 115200 are also popular.

      To try different baud rates you need to change the BTserial.begin(9600) statement. For example BTserial.begin(38400)

      If you are not sure and you know how to enter AT mode then you can change the baud rate using “AT+UART=9600,0,0”. This sets the baud rate to 9600.

  6. Hy Martyn
    I feel I’m very close to the goal, but not enought.
    I ‘m using a new zs-040 HC-05, and a Mega ADK, but same pins as your sketch. Also 3.3v maximun (shift bridge divider) in H5-RXD.
    Also I changed to another zs-040-HC 05 and no difference. both same action: I can connect from android BT terminal, and send ascci from Android, but nothing appears on Arduino Serial monitor. But the good thing is that every word I send from Arduino Serial monitor, it appears in Android BT terminal. So some way is working.
    Changing baud ratio to other values in BTserial do de same, no better, no worse.
    One important thing, but I dont understand meaning: RXled on MEGA blinks when I send from Arduino Serial Monitor (it is OK), but TXLed on MEGA never blinks when I send from Android. Also it is 3.3v (I tester measured it) on HC05-TXD pin, but never changes , neither TXled on MEGA does.
    I thing it means something clear, but i dont know what it is.
    Any idea?

  7. Hy again Martyn.
    No progress.
    I tried run the sketch // Basic bluetooth test sketch 5a for the Arduino Mega. (in your web …, and I could went to a new mode (HC05 blinking on/off every 2 seconds) with the button switch, but nothing more.
    When I send 1 from Serial monitor, nothing happens, except RXLed on MEGA ADK blinks once.
    In this case, I use pins 18/19 for tx1/rx1, same as your sketch.
    I am using Arduino IDE 1.6.5, and seems Ok,
    Also tried IDE 1.5.6-r2 and same results. Sending 1 from Serial monitor does nothing.
    More ideas?

      • Hi Martyn
        Thanks a lot for your patience and dedication.
        Finally it works !!!!!!!!! .
        I’m ashamed to say it was my fault. I’m guilty (Very much!!). My voltage divider resistors (made on a breadboard) did BAD contacts, so it failed one way of the BT communication.
        I am sorry you wasted this time.
        By the way I have played a lot (really many hours) and I learned something .
        I also used the SenaBT (an android BT terminal) that gives some help using the AT mode (but on the BT android of my Samsung) .

        For information I discovered my ZS-040 firmware version obtained with AT commands
        this is the output :


        Thanks again.

  8. Hello Martyn ,
    I want to use HC 05 to send my sensor reading via bluetooth on another BT device connected to COM port of my PC.

    Please help me stepwise.

  9. HELLO,
    by using of hc-05 & arduino r3, i want to do something like, to know the communication status between terminal device(from my laptop) and hc-05,
    For this initially i will pair the hc-05 with my laptop ,when ever it is paired i want to make one digital o/p pin of arduino should be HIGH, after when ever i move the laptop beyond the range to comminicate i want to make one digital o/p pin of arduino should be LOW, and again it should be when ever i move the laptop with in the range , this must be done automatically for this process i am stucking,
    so please provide me the solution. thank u..

  10. Updated:

    To confirm my understanding, you want to have a LED light when the laptop is out of range. I don’t think there is a way to do this through the hardware but you could do it through software. The Arduino could send a message to the laptop and if no reply is received then the laptop will be out of range or no longer connected. I would send the message every 1 or 2 seconds.

    It would be worth while asking on the Arduino forum. There are many helpful people there.

    • The STATE pin is normally connected to the LED2 pin on the mini BT module. It goes HIGH when the module in connected. You can connect to the Arduino to determine if the BT module is connected.

      I do not have any boards that have a WAKEUP pin. However, if the breakout board is the same as others then it will trace back to pin 34.

  11. one more query!!!
    when the HC-05 is AT MODE can we communicate with the mcrocontroller
    for making the digital o/p HIGH & LOW
    waiting for ur reply??

    • Do you mean the pins on the Bluetooth module or the Arduino?

      If you mean the BT module:
      I don’t know what version of the HC-05 you have but for most you can control the pin state using the AT+PIO=, command. See the At command manual page 12. However, the pins on the mini BT module are not broken out and you will need to solder a contact yourself.

      If you mean the Arduino then please explain a little more about what you want to do.

  12. Dear Martyn,
    First thank you very much for your quick reply. Those are really helpful. I and Viswesh working together.
    Here I am re-framing Viswesh question:
    1) Are there any AT commands ,which we can use when HC05 is in “Communication Mode”(not in AT MODE)?
    2) In Arduino programming: How can we read AT command responses and compare?
    3) When HC05 is in pairing with some device .. can I use “AT+STATE? ” to know the status of the device? One of Response of the “AT+STATE” is “DISCONNECTED” . How do I implement in code?
    4) Our basic need is to know the connection status of the HC05 dynamically . I.e when HC05 is CONNECTED with any device my Arduino board should be able to identify and at the same time whenever it is DISCONNECTED from device my Arduino board should be able identify the same. I dont mind whether it is by Software code or by Hardware connection to Arduino

    Thanks in advance.

    • Hi, I will try to answer your questions.

      1. NO. Once the BT device is in communication mode everything it receives it treats like data and sends to what ever it is connected to. In communication mode the BT module simply sends out everything it receives.
      If you need to move in and out of AT mode then you can make a connection from the Arduino to pin34 on the mini BT module (you will need to reduce the voltage to 3.3v though). Put the pin HIGH to go in to AT mode. LOW to return to communication mode. Have a look at

      2. You need to parse the replies you receive from the BT module via the serial connection. Use a char array to store the reply. Keep adding the latest byte you get from the serial connection to the array. Once you have a full reply determine what it is.
      You may need to experiment to see if there are common terminating characters used (I think chr(10)/nl is used) at the end of the data the BT modules sends out. When get the terminating character you know you have a full reply and can then work out what the reply is (such as “OK”).
      I don’t have an example to post and I’m not at home for the next week or so so cannot work on anything. Go to the Arduino forum and search for serial basics by Robin2 this should get you started.

      3. I don’t think you can check the pair status through the STATE pin. The STATE pin will go HIGH once a connection is made but it remains LOW at other times. Remember that the paired state is different to the connected state. It may be possible to tap in to the LED1 pin and check the flash rate. Most modules change the LED flash rate to show the device is paired. Or, depending on the module you have you may be able to use the serial response from the module. For example the FC-114 modules report when they are paired. If I needed to do this I think I would try using the LED1 pin.

      4 You can do this through the STATE pin. LOW for not connected and HIGH for connected. Simply connect the STATE pin to an Arduino digital pin and use digitalRead() to get the value.
      You can also do it through software by sending a regular message and reply. If you do not get a reply then you know you are not connected.

      I have done this both ways. The STATE pin can tell the Arduino when the BT module is connected but it cannot tell the other device (in my case an Android device or a PC). Using software means both ends can be aware when there is a connection and when there isn’t.
      For example. I have a Android app that after a connection is made sends out “” once a second and expects “” as a reply.
      If the app does not get the “
      ” reply then the app knows there is no connection.
      If the Arduino does not get the “” every second then the Arduino knows there is no connection.

      Please be aware that connected is a different state to being paired. When you pair the HC-05/06 with another device all that happens is the HC-05/06 stores the information of the other device so that a connection can be made later.

      I would suggest you experiment. Pair the HC-05 with different devices and make different connections and monitor the pin states and the LED state. Do this with the serial monitor open and see what messages you get. Once you know the behaviour of the BT module you can decide how to proceed.

      What module do you have? Is there a model number?

      • Thanks alot Mr Martyn for your reply. Unfortunately I couldn’t reply immediately as I was out of station. I will check the code as per your suggestion and will be back soon with details of my experiments.

  13. Dear Martyn,

    I have an Intel Galileo Gen 2 and I tried to communicate with Intel Galileo via HC-05 zs-40 bluetooth module from my computer but I couldn’t accomplish. I have already done the communication with my Arduino Uno and I want to do the same thing with my Intel Galileo. SoftwareSerial library is not supported for Galileos so I’ve decided to connect HC-05 module’s rx and tx pins to Galileo’s tx and rx pins. Unfortunately, I wasn’t succesfull. I will be so happy if you send a message related to my problem.

    Best Regards…

  14. Pingback: How to communicate wirelessly with your controller? | H.M.B

  15. hello

    i have a problem, with the second code
    when i send data from the serial monitor to android
    1. i can’t see the data on the serial monitor, but i receive the data on the android app

    and when i send data from the android app to the serial monitor
    2. i see the data on the android app ( orange color) but i don’t receive anything on the serial monitor

    and i really don’t know why!
    so what could be the problem?

    • Hi Anthony,

      1. This is correct. The data you enter in the serial monitor is not copied to the serial monitor main window.

      2. Check the connection from the bluetooth module to the Arduino and check that you are using the correct pin. BT TX/OUT goes to Arduino D3.

      I notice from the post in the Arduino forum you may have used different pins to connect to the Bluetooth module. I would suggest using the sketch as it is and using pins 2 and 3. Once you have it working then change the pins if you want to.

      • HI!! tried changing pins but it seems my module only communicate on pin 0 and pin 1. I am only able to send data from arduino to phone.

        But data from phone to arduino is not coming to serial monitor.

        So it would would be awesome if you can help me with this

        • Pins 0 and 1 are the hardware serial which probably means you are not using software serial.

          When one side of the communication is not working it is normally a bad connection or the wrong pin is being used.

  16. Pingback: HC-05 fs-040 State Pin | Martyn Currey

  17. Pingback: Quick Links | Martyn Currey

  18. Hi, thanks for your post, its really helpful.
    But, i want to ask, what happen is pin Rx directly connected to 5v?
    I use HC-05 connected to RS232 to ttl adapter (not to arduino), as far as i know the adapter have 5v.
    as long as i try, it still can send data, but i don’t know long effect of connecting Rx directly to the adapter without voltage divider.

    • The only reliable way I have found is to have one device poll the other. The polling frequency based on you own needs.

      For example, once a second:
      Device A sends a “are you there” request to device B.
      Device B replies “yes I am”.

      If device A does not receive a reply within a second then it knows the connection is lost.
      If device B does not get the “are you there” request within a second (I use slightly longer) then device B knows the connection is lost.

      I should add that I am using app inventor to create Android apps and this has limited Bluetooth functionality. Using Java may be better.

  19. hi there, i paired up 2 hc05 master “1” and slave “0” doing this
    AT commands

    //SLAVE = 98d3:31:2093cb AT+ROLE=0

    //MASTER= 98d3:32:204d2a AT+ROLE=1



    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

    as follow

    include SoftwareSerial.h

    SoftwareSerial mySerial(10, 11); RX, TX

    void setup

    { Serial.begin(38400);

    pinMode(9, OUTPUT);

    digitalWrite(9, HIGH);

    Serial.println(“Enter AT commands:”);



    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 “after uploading new sketch” 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 ???

    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

    void loop()


    if (mySerial.available())

    mySerial.write(“Variable or Array here”);

  20. Hello, I can send text from android app to serial monitor, but not from serial monitor to android app. What is happening?

      • it happen to me also. all the connections are correct. but i only can receive the text that were sent from bluetooth terminal but i cant see the text from serial monitor send to the bluetooth terminal.

  21. I ran the first sketch, successfully connected to the Android, however the text message did not appear in Blue Terminal. In the Arduino serial monitor, Arduino Ready only appeared. Any help is appreciated.

  22. hello sir
    thanks for such a great tutorial.
    my communication between 2 bluetooth modules is started but when i am sending something from 1st serial monitor it is not coming same on another one for example if i am sending ‘p’ in another monitor it prints some kind of symbols
    pls help me in resolving it

  23. Hi, I am trying to connect the bluetooth on an android to the HC-05 and it disconnects after about 10 seconds or so, any idea as to why this keeps happening?

    • Sorry, I can’t help except suggesting you check the time outs on the Android device. Try increasing the time before it goes to sleep.

      I did some basic experiments and the connections I have are very stable. HC-06/05 to Sony Z3 Compact and also a Samsung 7inch tablet. Even after the Android device closes the screen and then comes back the connection is still available.

  24. Martyn,

    The HC-05 modules that I bought on eBay look like yours.
    I have the RXD pin connected directly to D9 on the Arduino, and the module works.

    Should I be concerned?

    • Some have connected the Bluetooth modules directly and report they work fine. Others report they slowly kill the RX pin on the BT module. I would always suggest adding a voltage divider and believe it is better to be safe than sorry.

      The daughter board is a 3.3v device and if you trace the RX pin on the breakout board you can see that it goes directly to the RX pin on the daughter board.

  25. Disregard previous question as it was answered.

    It seems that I need to leave the EN pin floating or the HC-05 module will not work.
    By will not work, I mean that the red LED is not lit at all. If I have the EN pin connected to D13 on the Arduino Uno, the module is unresponsive.

    I have tried setting D13 to an output and setting it to LOW.

    Any ideas?

  26. hello martyn ,i am a great admirer of your work over the internet.
    can you please enlighten me whether i can use bt slave mode to get arduino working with other tasks. My main idea is when the bluetooth module connected with the arduino gets the signal of the android bt(app driven), then it gets to work i.e its gets on and when the bt signal of the android is off peripheral arduino connected projects like object detecting, relaying stops working;;;main theme is to use the arduino in standby mode and working mode when it gets the android bt signal; then what will be coding modification of your provided sketches;;so please give me a solution so that i can use bt signal to get my arduino working from “standby” mode(no android bt signal) to “working” (android bt signal on,hence the app too) mode;;;
    i know my question is lengthy;;; just want to be enlightened by you sir;
    it will be a great help;;tc;;

    • Hi manjur,
      if I understand correctly, you want to have the Arduino + BT module come out of standby mode (sleep mode), connect to an Android device, send data, go back to sleep.

      Will you power down the BT module when not in use/in standby mode?

  27. thanks for your reply;;;
    the main idea is to when the bt module detects the signal of android device bt, the arduino starts “working” with my project;; and when not the arduino stops working;; so do i have to create multiple functions to link the bt code with the peripheral arduino project i.e relaying ,detecting object etc?? Like, while arduino gets signal of android bt then it passes the task from bt sketch to other sketches;; and is power down is an easy option?? If not then its not necessary;;;the necessary thing is to get the arduino to “work” when it gets android signal;;no signal no working to the peripheral projects;:: so where the bt code should be modified and for passing the task to another sketch what can i do???
    Your advice is very much appreciated;;

  28. This is fairly straight forward if the Arduino and BT module are always on.

    When the BT module receives data it will forward to the Arduino. When the Arduino receives the data it should do something based on the data received.

    I am assuming that you have several different things to do and use different codes.
    For example:
    if recievedCode == “LEDON”, turn on the LED
    if recievedCode == “LEDOFF”, turn off the LED

    Within the main loop you keep checking for received data until you have something.

    Powering down the Arduino is possible but adds many complications. I am not sure if you can power down the BT module and have it wake on a connection being made. I suspect this is not possible with the cheap HC-05s and HC-06s but I do not know.

    Experiment with the connection, pair and connect the BT device with Android and then restart the BT module and see what happens.

    A quick google brings up some autoconnect apps. Such as These may be the way to go.

  29. Hello!
    I need to read/write PIO from pc connected in bluetooth (without pc connected directly to HC-05 )
    Is there the possibility to send AT command from remote PC?
    I can see 2 com port in the device connected in bluetooth; what is the second one?
    Thank tou very much!

  30. Hi Martyn,
    Is it possible that HC-05 receive and send data simultaneously?
    I am trying to use multiple Arduino+HC-05 to sense signal from each other.
    Using “AT+INQ” to receive RSSI signal, then sent the value to PC (wireless),
    but the result show the same value and repeated.

    like this:

    here is my code:
    void loop()
    //when BTserial.available()..
    char c =;
    readString += c;


    It seems that HC-05 receive data once and send data repeatedly.

    • Hi Donna,

      If you mean better read/write performance; the example sketch uses software serial which is not that good, for better performance use altSoftSerial, or better yet, the hardware serial to talk to the Bluetooth module. Note that AltSoftSerial uses pins 8 and 9 on the Arduino.

      If you mean connect more than 2 modules at the same time then this is not possible. With Bluetooth you can only connect 2 devices at a time. To have a small network you would need to make a connection to each module one at a time.
      Make a connection to device 1, get data from device 1, close the connection.
      Open connection to device 2, get data from device 2, close the connection.
      etc etc

      • Hi Martyn,

        My work is:
        Using multiple Arduino+HC-05 to sense signal from each other
        And all of them just connect to PC (let PC collect the data)

        So maybe I should try these steps

        Arduino wake up
        send data to PC
        Arduino sleep

        But how could I keep the RSSI value after “AT+INQ” until paring PC and send to PC?
        Is there some command/instruction in Arduino to keep data in register?

        Thanks :)

        • If you need to store a value for an indefinite amount of time and across resets use eeprom.

          Do you really need to store the RSSI value? This is just an approximation of the signal strength.

  31. My homework just let me collect the approximation value, so I use RSSI.
    I’ll try EEPROM to store the data.

    Thank you Martyn : )

  32. hi there!! when i tried both the examples ,the first one worked just fine but the second one in which a message is transmitted ,i received some symbols in my serial monitor,so what should i do to get the exact same transmitted code from my phone. is it any related to changing my AT baud rate…? if yes how can i do it ? I have got the same hc-05 zs-40 module …..or any other suggestions to get it working..

    • This normally indicates either; an incorrect baud rate or trying to send too much data too fast.

      When using Software Serial, keep the baud rate low and keep the data segments as short as possible. If you need to use a faster baud rate, use AltSoftSerial or better still the hardware serial.

  33. Hello,

    I would like to log my temperature information. Should the HC05 be in slave or master mode? Is there a simple way to receive them on my laptop via the bluetooth connection.


    • The HC-05 should be in slave mode.

      You can connect from the computer. Use the PC to initiate the connection. Once you have made a connection you should have a COM port, use this as you would a usb COM port.

  34. Hello,
    I tried to program my arduino nano with the program that you have published on this webpage. I connect my HC05 in the same manner as you have suggested. I am able to receive all the characters on serial monitor properly but when I send message from serial monitor to BTSerial then I am only getting double digit numbers on BTSerial. May I know what would be the problem? Thank you very much.

  35. Hello,
    I am having problem while receiving data into my android bluetooth serial monitor from arduino connected with HC-05 bluetooth module. I am able to send data from arduino to the computer serial monitor correctly but I am not getting correct data while sending it from arduino to my android phone.

    I am using the code as below:

    SoftwareSerial BTserial(10,11);

    void setup() {
    Serial.println(“Arduino is ready”);


    void loop() {


    On my android bluetooth serial monitor I am receiving data like 31 30 32 34 0D
    i dont know what is the problem.

    I have checked the Buad rate of HC 05 using AT it shows it is 9600, 0, 0

    Please help.

    Thank you very much.

    • BTserial.println(1024); sends the values 1,0,2,4 and the values you are receiving are the hexadecimal values of the numbers; 31=1, 30=0, 32=2, 34=4, and OD is the carriage return character added by using println.

      If you want to send as ascii put the number in quotes – BTserial.println(“1024”);

  36. I been doing my final project. I wonder, can i connect HC-05 to car Bluetooth then comunicate to arduino uno to trigger the port at arduino ??

    • Without knowing what Bluetooth system is being used by the car I can’t really say. However, I would suspect it is Bluetooth 3/HID or Bluetooth 4 and if so the HC-05 will not connect.

      To know for sure you need to confirm what version of Bluetooth the car uses.

  37. Hi, all,

    thanks for this page, it is great.

    I have a Arduino Mega with a HC 05 Bluetooth Modul as Master and a connected second BT Modul HC 05 as Slave, whithout any board. It is only powert by VCC and ground. After automaticlly connection i need then name of slave modul, or the adress???? is it possible??

    thanks for helping.

  38. hi,
    I’m using bluetooth module hc05 with Arduino uno. I’m facing a problem in pairing my module with my android device. The module gets listed in the available devices, however, when I select it to pair, I get the message “Couldn’t pair because of incorrect pin”. My device does not even ask for any passkey.
    Also, certain AT commands such as AT+PSWD does not respond.
    Please provide a solution.

  39. hey i have a problem with my hC- 05 IT cannot appear with my phone Bt when i search for devises its said nothinf appear
    please help

      • its JY-muc,usually when i plug the current in 3.3v its appear in most videos in youtube but mine no i dont know what’s the problem exactly

        • If you are connecting vcc to the breakout board then the minimum voltage is 3.6v but 5v is better.

          The breakout board has a voltage regulator that reduces the vcc to 3.3v. To work it needs at least 3.6v in.

    • The button switch brings pin34 HIGH which puts the module in to AT mode.

      You connect to other Android devices in exactly the same way as the first device; pair, connect. You can only be connected to one Android at a time though. So to connect to a 2nd device you would need to disconnect from the first one.

  40. I am working on a project using HC-05. It get connect with terminal but when i am using my android app, sometimes it get connection error and sometimes it works. I set baud rate at 9600. Can anyone tell me what is the problem??

  41. hi. I am trying to control mindwave headset with hc 05 and the led first rapidly blinks then it slowly blinks for about 2 seconds what is going on can you explain pls

  42. hi martyn, i am not able to recieve the messsage in serial monitor when send from bluetooth serial terminal for pc but the bluetooth terminal is recieving from serial monitor.can you help me out?
    i am using the HC-05 with ttl output

        • i am using arduino mega 2560


          SoftwareSerial BTserial(2,3); // RX | TX
          // Connect the HC-05 TX to Arduino pin 2 RX.
          // Connect the HC-05 RX to Arduino pin 3 TX through a voltage divider.

          char c = ‘ ‘;

          void setup()
          Serial.println(“Arduino is ready”);

          // HC-05 default serial speed for commincation mode is 9600

          void loop()

          // Keep reading from HC-05 and send to Arduino Serial Monitor
          if (BTserial.available())
          c =;

          // Keep reading from Arduino Serial Monitor and send to HC-05
          if (Serial.available())
          c =;


  43. So I tried alot of stuff couldnt figure the problem…the first code works even though i connected my RX/TX pins in pin 0/1 of my arduino. In the second code, if i connect to 0,1 pin and change the code BTSerial(0,1); then when i send from android to computer i get wierd symbols. Also, I cant seem to send data from serialmonitor to the android.

    But if i connect the TX pin of HC-05 to someother pin then it works( by changing BTSerial to the corresponding pin). But i cant figure how to send data properly from arduino to the android…

  44. Hi Martyn,
    In my home automation project, I’m using both BT HC-05 and IR, with RTC 1307 and 20*4 LCD on I2C bus. First problem is that buzzer / tone command is not supported with I2c , gives compiling error, secondly major issue is that either BT or IR works, depending on which is placed first in loop.
    Individually both IR and BT function well. Can you guide?

    • I haven’t used BT and IR together but suspect it is a resource conflict, possibly they are trying to use the same timer. I have had issues using software serial and the servo libraries together due to this.

      If not already a member, join the Anduino forum and ask there. I am sure somebody there can help.

      • Hi Martyn,
        Thanks for your quick reply, I’ll try to find and resolve these conflicts, one more thing can I use an Atmega with bootloader , say a nano or Pro Mini with IR sketch in slave mode and master Uno having LCD, RTC , BT and relay output. Connecting both thru I2C. How to configure …any hints or idea.

  45. Hi !
    I got a problem with my hc05.It.s the third module that i`m using and the result is the same.It doesn.t pair with any phone (but with a bluetooth LE app seems to connect, even though it.s not helping me in any way), with my laptop pairs without asking me for any password but finnaly it doesn.t show up on com ports list. Long story short, i tried to enter in command mode, but there ar more command that it doesnt respond to, such as AT+UART=, AT+CMODE (i tried using \r\n but no difference) , on AT+NAME or AT+ROLE the value after these commands it.s used(including =). What should i do? it upsets me for 2 weeks but i don.t want to go back:)
    -pins are correctly attachet
    -blth module it.s not burnt , i use a voltage divider just in case(when it.s “paired” with laptop or phone in ways that i said earlier the led is stop blinking)
    Sorry for waisting your time and for my bad english but i would appreciate a lot any help.

      • as i tried before, my phone sees the blth module but using apps just for scanning is not helping that much. I tried the apps u mentioned in that link and with HMBLE Terminal connects but doesn.t recieve any data. I tried a code that lights up a led when press1 and goes off when 0.The program that i.m using has a default message that shows up (when i open serial monitor) on this app (i charge my board using laptop) which tells me that i miss smth else.
        I tried to find any other apps but stiil can.t find one as this

  46. I m using hc 05 for smartphone controlled car . It was working in good condition in beginning. But from last 2 to 3 days my bt module is not working properly. It’s not giving respone to my signals. It is paired and connected to my phone but it don’t recieve the signal please help.

  47. I have a Samsung Chromebook, an HP envy running windows 10, a Toshiba machine with windows 7, two kindle fires and a couple of I-pods, none of which will let me access Google play store. Do you have some suggestions on another app, like Bluetooth Terminal, that will run on these machines, or on an I-phone?

  48. How i can clear the receive data of hc-05 ?
    The serial.available() It still retains the last command i sent from android .

      • Not explaining myself well.

        What I meant was that I got it right .
        But when I read it again after a while , I expect to get serial.available() = 0
        or empty buffer.

        • If you are not getting an empty buffer it means you are receiving data. Check the sending device, is it sending data?

          Also make sure you are using serial.available() == 0 rather than serial.available() = 0.

  49. hello , all i need is how to send data from arduino to pc via bluetooth thats my app i havn’t found a solution yet welll any one can help !

  50. Hallo Martyn

    i was using HC-05 with arduino nano and arduino Leonardo using the pins TX, RX on Arduino to connect with HC-05 and i used of corse voltage divider and connected Vcc to 5V on Arduino. I was using an android app i created to drive a dc motor via bluetooth. everything was working perfectly, suddenly i can connect to HC-05 successfully but cant send any Data from my phone to Arduino.. i didnt change anything niether in code nor wiring..what do you think is the problem ?


    • Try one of the basic serial in / serial out sketches with software serial on pins other than TX&RX and an Android terminal app and see if you can get it working.

  51. Sir im doing project based on Bluetooth based home automation.the problem im facing is about Bluetooth (HC-05). im able to read data on serial monitor but it’s not controlling the home appliances. It would be helpful if u suggest something..tq u

  52. my bluetooth module hc-05 connected with ardunio UNO and well paired with mobile phone but its not working , when i open serial monitor of ardunio and sends command 1 from mobile phone ,serial monitor shows βΈ® at every command.
    what should I do……please help….??

  53. Thank you very much for this post. This was the tutorial that worked for me. I was also able to use your sketch to customise my HC-05 with AT commands by editing 9600 to 38400 (in 2 places – a tiny troubleshooting exercise there).

  54. I have successfully connected two hc-05 Bluetooth modules in master-slave mode. And they are working fine with reliable data exchange using ‘AT+LINK’.

    Once I enter the Link mode, I am unable to come out of it. How can I come out of this mode as module doesn’t recognize any AT commands now? Do I need to use a termination character to break the link?

    • You need to bring the EN (or BRK) pin momentarily LOW to break the connection. Note though, if you have the modules set to auto connect they will simple reconnect on power on.

  55. I’m using the hc 05 module with a connection to arduino for a bluetooth control robot. The issue I’m facing is that the first time i paired with the module, it easily paired and connected to the application. I accidentally reset the module by pushing the small black button on the module and now it won’t connect to any application and will only pair with the phone.
    Can you please suggest a solution?
    Please and Thankyou.

    • Not sure what you mean by reset.

      The small push button connects pin34 to HIGH and puts the module in AT Command mode. Cycling the power to the module starts the module in communication mode again.

  56. Hello Martyn
    After reading some of your excellent articles I purchased three HC-05 modules to experiment with. They all seem to work OK but switch off after 5 seconds. The power has to be removed for at least 30 seconds and then re-applied, then they work for another 5 seconds before shutting down. AT commands seem to work but you have to be quick! Is there an AT command I haven’t yet come across that will cause them to stay on? SW version is 3.0 – 20170601. Thanks for your help.

  57. hi i ordered a kit off of amazon that included this and it claimed that this caold use ir signals. is that true and if it is, how?

  58. I have gone through your instructions and connected circuits as told. But after connection,though led is blinking rapidly but HC-06 is not discovered in app and it simply says “No device found”.

  59. I was having the same problem that many others in these comments have encountered – I could send from serial to bluetooth but not the other way.

    In my case I finally figured out that the problem was I had not tied all my GNDs together. My Arduino was running from USB power, while I had the HC-05 and the ground of the voltage divider coming from a separate power supply. As soon as I added a link between the GND of the Arduino and the GND of everything else, it started working.

    I hope this might help someone else who runs into this problem!

    Another issue I found was that Bluetooth Terminal would not find the HC-05 when it was unpaired. I had to pair it first in my phone’s Bluetooth settings, and only then would the Terminal connect to it.

    • Thanks for the comment. Since this post is about getting the HC-05 working I don’t go in to detail about connecting grounds. It is mentioned in the connections list but I now realise that it is not explicitly stated. I will add a comment to say the GNDs need connection. The above does say you need to pair before you can make a connection though.

  60. please do not provide … I repeat…DO NOT PROVIDE any information about the serial library you use

    this could actualy be helpfull and make sens…but, for f@#k sake, DO NOT DO THAT

  61. Dear Martin,

    I have been working on my project with Arduino for over one year and a half. Since then, I’ve been facing issues with the use of bluetooth (HC-05) and GSM (SIM 800L), because when the gms send sms, the bluetooth module would automatically loose connection with my cell phone. Reading this article of yours, I suspected that the HC-05 was actually restarting to protect itself against current overload (since the RX port works with 3.3V and not 5V that Arduino works). I bought the resistors and put it as you suggested here, and voila!!! It worked perfectly!!!! I’m really thankful for your help!!! Regards From Brazil!!!

  62. Hi! I am using arduino uno, hc 05 Bluetooth module and P10 DMD. However I cannot display more than 60 characters when I type 100 characters from the phone. What might be the problem?

  63. Martyn,
    Can HC-05 reduce the connectivity range?
    As I know, HC-05 is Class-2 Bluetooth module which has nominal range of 10 meters.
    I want to reduce it by only 2 meters. Do you have any idea?

  64. It’s actually a great and useful piece of info. I’m happy that you simply shared this helpful information with us.

    Please stay us up to date like this. Thank you for sharing.

  65. Hey, I have been using this method to configure following things on my bluetooth module.
    AT+VERSION? > V2.0-20171015
    AT+NAME=abcd 123 > OK
    AT+POLAR=1,0 > OK
    AT+UART= 57600,0,0 >OK

    It was completely working for a long long time now that I have got a different bluetooth modules its not working now. I suspect it’s because of the version change. Now I am unable to make it work in case of AT+POLAR? its always returning ERROR(0) due to the version change.


    Anyone has any idea on the AT Commands for Bluetooth V4.0 (NOT BLE)

  66. Anyone managed to get a Arduino Mega to talk to a HC-05 using Sketch in a Windows 10 x64 environment ?

    Despite being 100% in AT Mode and connected correctly I simply cant get ANY response to an AT Command in Serial Monitor.

    Tried all Baud rates (especially 38400 & 9600), CR & LF selected, correct board/processor, correct port but nothing (even entering the commands whilst holding the button on the HC-05 board). ANY IDEAS ??

Leave a Reply

Your email address will not be published. Required fields are marked *