Arduino With HC-05 Bluetooth Module in Slave Mode

Arduino and HC-05 in communication mode

Updated on 18.07.2015.

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

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.


76 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.

  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.

Leave a Reply

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

6 − = zero

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>