April 4, 2011 | Posted in:Arduino


I recently purchased the HC-05 RS232 serial bluetooth module from eBay. These modules sells from $10 to $20 including shipping. My plan was to use it as a economic wireless communication tool between PC and the Arduino board. The module has built-in Serial<–>Bluetooth protocol converter. Therefore it can be connected directly to Arduino serial pins without any ttl level translator chip and with a few external components. One thing to note though, the seller I purchased the module from on ebay had the wrong schematic posted on the listing which was meant for a older version of this module. So depending on which version you have, you will have slightly different pin connection for the AT command enable pin and led indicator pins. The major difference between the two version of the module is, the newer version works in both master and slave mode depending on how you set it up via AT commands and improved firmware. The specification of this module is as follows:

● Bluetooth protocol:  Bluetooth Specification v2.0+EDR
● Frequency:  2.4GHz ISM band
● Modulation:  GFSK(Gaussian Frequency Shift Keying)
● Emission power:  ≤4dBm, Class 2
● Sensitivity:  ≤-84dBm at 0.1% BER
● Speed: Asynchronous:  2.1Mbps(Max) / 160 kbps, Synchronous: 1Mbps/1Mbps
● Security:  Authentication and encryption
● Profiles:  Bluetooth serial port

Power supply: +3.3VDC 50mA
Working temperature: -20 ~ +75 Centigrade
Dimension: 26.9mm x 13mm x 2.2 mm

Here are the data sheet, example schematic for this module:

BC4_Bluetooth Module Datasheet.zip (1.12 mb)

The schematic I used to connect to arduino is as follows:

This can be used as a cheap way to talk to your Arduino wirelessly and debug your quad copter over serial port without using the relatively expensive XBee modules, even though you will not get as much range as the XBees.

Here is my version of the break out board.

Figure: Front side of the break out board.

Figure: Back side of the break out board.

Testing the module with MultiWii quad and configuration tool:

42 Comments

  1. Kai
    September 1, 2011

    Leave a Reply

    Hi Pial,

    why did you use the 10 Ohms resistor (R5) in TX line?

    Thank you
    Kai

  2. pial
    September 2, 2011

    Leave a Reply

    Hi Kai,
    I used a 15 or 20 Ohms resister instead, because I didn’t have any 10 Ohms in hand and it worked fine for me.

    Thanks.

  3. Kai
    September 2, 2011

    Leave a Reply

    Thanks for your reply. But my questions was, why to use a resistor in TX (!) line (regardless which size).
    I know that using a voltage dividor in RX is needed to come get it from 5V down to 3.3V. But TX is 3.3V going to the Arduino…

  4. Teejay
    September 21, 2011

    Leave a Reply

    Hi Pial,

    I have the same bluetooth but the one i bought is the master not the slave one. Now i got this bluetooth working on uart interfaced to my microcontroller.

    The problem is that when i want to change the name,password,baud etc. i cannot go to the AT command via serial com in pc

    i already put the PIO11 in 3.3v or high level and still no response to any AT command. Everything is check even the connections, level converter.

    Thanks
    Teejay

  5. pial
    September 27, 2011

    Leave a Reply

    Hi Teejay,
    There are couple of firmware versions available for this module. You will need to check the data sheet or manual that is provided with your module. Your module could be programmed in a different way. Therefore it may not respond to AT commands exactly the way my modules did. Hope this helps.

  6. assad
    October 3, 2011

    Leave a Reply

    is it possible to communicate 4 modules at a time

  7. Anand Dhuru
    November 28, 2011

    Leave a Reply

    Hi, I have been trying to get an answer to this; hoping you can help!

    I understand the ratio of resistors in the voltage divider for the Rx line. That is when you connect it to a TTL micro, right?

    So, when one connects the module directly to a PC (real serial port, NOT USB-to-serial), wouldnt these have to be changed, to say 10K and 2.2K? Would like to be sure before I toast my module!

    Regards,

    Anand Dhuru

  8. pial
    November 29, 2011

    Leave a Reply

    Hi Anand,
    The voltage divider is used to lower the voltage to a tolarable limit of the module. When you are connecting it to the PC serial port, I believe the voltage will be more than 3.3v; which is the operating voltage of this module. So you will need a voltage divider to manage the voltage on tx/rx lines. Check this page to calculate your resistor values: http://en.wikipedia.org/wiki/Voltage_divider

    Hope this helps.

  9. Anand Dhuru
    November 29, 2011

    Leave a Reply

    Of course! I was being very dense. I now realize the module, when connected to a PC, will be thru’a level shifter (like a MAX232), so will not have to deal with non-TTL levels at its input. So, just a drop from 5 to 3.3 is what is required.

    Thanks for the prompt response.

    Regards,

    Anand

  10. Pooya
    December 8, 2011

    Leave a Reply

    Pial, do you know how I could set this module (HC-05) to low-power (energy-saving) mode? I’d really appreciate it if you could help me out.

    Thanks
    Pooya

  11. Andre Matos
    December 10, 2011

    Leave a Reply

    Pial, I use same module, but I don’t put resistor on tx / rx line, and my status led only work only on pin 24 (http://www.gemmarduino.com/PM-1/00100-002/datasheet.pdf page 4 ) , Bluetooth parity work ok on mac osx , what baud rate you are using ? I set mine as 115200 , configured with AT command with usb rs232 ttl ( http://wiki.openpilot.org/display/Doc/Serial+Bluetooth+Telemetry ) with pin 34 on 3v3 ( hight level ) .. but my setup don’t work with my multiwii GUI … start, connect to bluetooth , but don’t star cycles, and sensors graph .. Thanks for any help and idea … best regards, and great job, sorry bad english. Andre from Brazil

  12. pial
    December 10, 2011

    Leave a Reply

    Hi Andre,
    One major reason for the multiwii configuration to unable to communicate with the BT module is the BT stack installed on your mac/pc. I am not exactly sure about mac, but on my pc I had to install the toshiba bluetooth stack to make it work. Hope this helps.

  13. Marcelo
    December 23, 2011

    Leave a Reply

    Hi Pail,

    I’m trying to configure a BC417143BGQ(K121AY AND K119BL)

    How may i know if i have HC05 or HC04/06?
    http://www.hmangas.com/Electronica/Datasheets/Bluetooth%20Module/HC%20Serial%20Bluetooth%20Products%20201104.pdf

    Can the Bluetooth module handle 5V from the Max232/PIC18?
    or i should buy/build it?
    http://www.sparkfun.com/products/8745

    How did you install the bluetooth stack if your toshiba already has one?

  14. Marcelo
    December 23, 2011

    Leave a Reply

    Thanks for any help.
    best regards,
    Marcelo

  15. Marcelo
    December 27, 2011

    Leave a Reply

    Hello Pial,

    I’m sorry i did a mistake and called you Pail instead of Your name in the earlier note.

    Can you help me with the above

    best regards,
    Marcelo

  16. pial
    December 28, 2011

    Leave a Reply

    Hi Marcelo,
    I heard there are couple of variations of this module in the market. However, I was able to see only two of the variations. The picture posted here in this post with one of the chip marked as MX… is the HC-05 version, at least at the time I purchased the modules. The HC-04 module had a different chip (that was not marked as MX…). This module runs on 3.3V, so it will be a good idea to use a level converter/voltage devider between the rx/tx pins of the module and your microcontroller just to protect the module from over voltage damage. If you already have a toshiba laptop and it has the BT stack installed, you should be good to go. I had a dell and needed to install the toshiba BT stack on it.

    I hope this helps.

  17. Mehqui
    January 12, 2012

    Leave a Reply

    Hi Pial,

    I’m doing a same project, but i need to integrate this module with Android plataform…

    But at this moment, i had a lot difficult to communicate with bluetooth module… Apparently, my bluetooth module doesn’t responding… I don’t know why…

    I’m trying to do a simple communication by UART interface on AT mode… i don’t no why doesn’t working…

    Have some idea?
    Maybe you can help me…

    thank you

  18. pial
    January 15, 2012

    Leave a Reply

    Guys, please follow this post on multwii, it has a lot of information on troubleshooting different variations of this bluetooth serial module:

    http://www.multiwii.com/forum/viewtopic.php?f=6&t=133

    Good luck!

  19. Marcelo
    January 15, 2012

    Leave a Reply

    May be the solution is Max3232, works with 3V

  20. Khan
    February 23, 2012

    Leave a Reply

    Hi Pial,

    Please help me with the bluetooth module, i want to change the baud rate and the pairing info, i used a usb to ttl adapter, connected TX, RX of USB to ttl to RX, TX of Bluetooth Module respectively and applied 3.7V to the Bluetooth module(made sure that its not in paired mode, Led flashing) – The problem i have is, as soon as i open session – hyper-terminal or putty or any com tool, the BT module is contentiously sending non stop ‘Y’ kind of characters
    "ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ"

    This is what i bought off ebay : "NEW Serial Bluetooth RF Transceiver Module RS232 Master + backplane 4 pin TTL"
    Item No: 110805911219

    I tried going through all the google searches but no vail, please help. Thanks in advance, Khan

  21. pial
    February 24, 2012

    Leave a Reply

    Hi Khan,
    From your description it seems you do not have the correct baud rate set up in your terminal connection. Try changing the baud rate to match the one specified in your user manual and you should see correctly decoded characters on hyper terminal.

    I hope this helps and good luck.

  22. Khan
    February 24, 2012

    Leave a Reply

    Thanks Pial,

    As per the product description provided by the seller the default baud is 9600, i will try all the available baud rates and will get back to you. Thanks again for the help.

    >My other concern is (when connected to ttl adapter to modify the values), even if nothing is issued to the BT Module, its continuously sending data …not sure y, do i have to pull up High – to the Key Pin ? and is there a way to identify what Module i am using, like HC04 or 05 or 06 .. ?

  23. Mehqui
    February 24, 2012

    Leave a Reply

    I think your problem is with baud rate…
    I had the same problem here… I changed the baud rate so many times to discover the correct baud rate of communication… When the baud rate is wrong, you will receive this kind of characters…

    When i changed the baud rate to 115200, the communication works…

  24. Khan
    February 25, 2012

    Leave a Reply

    Thank you Pial and Mehqui,

    I am not sure what fixed it, but i was finally able to change the baud and pairing info.

    I tried all the baudrates this time but nothing worked, all these time it would not even display those wierd characters and would never go into pairing, i tried 2 different rs232 to ttl boards nothing worked.

    What my guess is, this time i soldered the tx,rx, gnd directly on the BTModule it self and used 9600 Baud, And was good to go.

    So i am guessing a simple loose connection might have caused it, i didnt do any pullup or reset as mentioned at few places on googling..

    By the way, i found this tool to be very helpful, you can type the AT+ command and then click send.. i was not able to do that on Hyperterminal

    http://musicshield.googlecode.com/files/sscom32E.exe

    Thanks guys for the help.
    Good luck.

  25. bambuko
    March 18, 2012

    Leave a Reply

    Thanks Pial !! – very useful, although might a bit too late for me? :-)
    Before I have found your blog I have connected my TX directly without voltage divider (at 5V) – I guess I have fried it? because now even with divider it doesn’t work :-(
    Or do you reckon it might have survived 5V and there is something else wrong with my setup?

  26. bambuko
    March 19, 2012

    Leave a Reply

    Just a follow up to my yesterday’s comment:
    No I didn’t fry it up! :-)
    After a bit of googling I have discovered that I needed MAX232 or MAX233 (I used the latter because it was easier to use) – my logger (which I have been trying to connect to BT module) was RS232 and the module requires TTL.
    All is working perfect now – thank you.

  27. Paola
    April 26, 2012

    Leave a Reply

    Deseo saber mi tiene UN MODULO BLUETOOTH HC04. si lo tiene cuanto vale?, cuanto se demora el envio.

  28. B M Sangati
    June 30, 2012

    Leave a Reply

    Hi all,
    i used 29lv800bbxei-70g bluetooth module ,here i faced one problem this device detected first 2 times when power ON and OFF. But 3rd time not detected i checked 4 modules same problem so please any one help me how to test this module.
    regards,
    B M sangati

  29. Matt
    August 4, 2012

    Leave a Reply

    hi all.
    I have a module blue tooth. When i power it, it automatic into work mode. PIN32 is high level before paired, once paired it get low level, which different from datasheet. Now, i put PIN34 on high level, but module can’t into AT command mode. How can i fix it ??
    Can u help me, Thanks first
    P/s : i buy it on ebay :http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=190673725698

  30. Adrian Gin
    August 20, 2012

    Leave a Reply

    I did some performance parameters on this HC-05 device.
    Check it out, it talks about latency etc.

    http://adriangin.wordpress.com/2012/08/21/bluetooth-uart/

  31. nikhil
    September 2, 2012

    Leave a Reply

    thnx …….great information….
    it costs 40$ in india…
    :P

  32. Varma Naidu V
    October 30, 2012

    Leave a Reply

    Hi,
    I am not able to detect this module through and android phone. I am able to detect it through my nokia phone and all laptops but not android phone.
    is there any reason, can you help me on this?

  33. pial
    October 31, 2012

    Leave a Reply

    Which android phone are you using. Is the bluetooth hardware on the android phone of higher version than the bluetooth module module? I believe you need to have bluetooth v1.1 or v2.0 hardware on the android phone. I can not think of any other reason but the hardware compatibility in this case. Please check the specifications of your android phone and the bluetooth module.

  34. Fadi
    December 31, 2012

    Leave a Reply

    I am wondering, and could not find any definitive answer online. Does the master mode support multiple active connections?
    (BT 1.1 / 2.0 dictates piconets and multiple active connections/slaves)

    Thanks

  35. pial
    January 3, 2013

    Leave a Reply

    Sorry I have not tried the master-slave functionality of these modules. Good luck.

  36. Jim
    February 23, 2013

    Leave a Reply

    Does anyone know if this will work with iPhones?

  37. ashwini
    March 1, 2013

    Leave a Reply

    can 3 bluetooth modules interact simultaneously ? how to program it ? i am using arduino with bluetooth . kindly replay soon ..

    regards Ashwini

  38. david
    March 8, 2013

    Leave a Reply

    Hi

    I want to use HC-05 for projects in my schoole using MCU 8051.

    Is there any schematic for it ?

    Where can I find C code for it ?

    Thnaks

    Solemany

  39. eric
    March 18, 2013

    Leave a Reply

    just bought hc-05 6pin on ebay

    http://www.ebay.com/itm/HC-05-Bluetooth-Transceiver-Host-Slave-Master-Module-Wireless-Serial-6pin-/221158958927?pt=LH_DefaultDomain_0&hash=item337e19e74f

    is this safe to run directly w/arduino uno or do i need to bring it down to 3.3v? can i send AT commands over the first bluetooth connection or do i need to force AT mode and send over serial w/pc?

  40. pial
    March 19, 2013

    Leave a Reply

    Looks like you bought the module with the carrier board. The carrier board should take care of the 5v to 3.3v logic level conversion.

  41. viki
    April 16, 2013

    Leave a Reply

    hi pial
    iam using this module to control my bot using mobile…iam having app in my mobile to communicate ….i connected tx, rx, 3.3, gnd pins to arduino.. i didnt used 31,32 pins . my device is detected in the app…nothing happns that is bot not moving ..iam usin following code

    #define lp 9
    #define ln 8
    #define rp 7
    #define rn 6

    int val; // Variable to receive data from the serial port

    void setup() {

    // initialize the digital pins as output
    pinMode(lp, OUTPUT);
    pinMode(ln, OUTPUT);
    pinMode(rp, OUTPUT);
    pinMode(rn, OUTPUT);

    Serial.begin(9600);
    }

    // Read serial port and perform command
    void loop () {
    if (Serial.available()>0) {
    val = Serial.read();
    switch (val) {
    case ‘D1′:
    digitalWrite(lp, HIGH);
    digitalWrite(ln, LOW);
    digitalWrite(rp, HIGH);
    digitalWrite(rn, LOW);
    Serial.println(" go straight");

    break;
    case ‘D4′:
    digitalWrite(lp, LOW);
    digitalWrite(ln, HIGH);
    digitalWrite(rn, HIGH);
    digitalWrite(rp, LOW);
    Serial.println("back");

    break;
    case ‘D2′:
    digitalWrite(ln, HIGH);
    digitalWrite(lp, LOW);
    digitalWrite(rn, LOW);
    digitalWrite(rp, HIGH);
    Serial.println(" left turn");

    break;
    case ‘D3′:
    digitalWrite(lp, HIGH);
    digitalWrite(ln, LOW);
    digitalWrite(rn, HIGH);
    digitalWrite(rp, LOW);
    Serial.println(" right turn");
    break;
    }}}

  42. pial
    April 18, 2013

    Leave a Reply

    Hi Vicky,
    Looking at your code I see issues in the case statement. Please note that Serial.read() returns you one character byte at a time. Meaning if you are trying to read D1, you need to put the input in a buffer and run the case statement when the buffer reaches two characters. Instead, you can go with the simple approach and write the case statement for one character, Like instead of D1, use 1, D2 for 2 etc. and send the commands accordingly from your remote control device over bluetooth.

    Hope it helps.

Leave a Reply

*



8 + seven =


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=""> <strike> <strong>