[MyHosting.com]   [KO4BB Home Page]   [Manuals Home Page]   [KO4BB Wiki]
 

This is an old revision of the document!


HC-05 Bluetooth Module

The HC-05 Bluetooth module is widely available and inexpensive.

A lot of information is available on the Internet so I am not going to repeat everything here, just some notes and observations that may not be obvious even after plenty of Googling.
One of the better pages is arduino-info.wikispaces.com/BlueTooth-HC05-HC06-Modules-How-To

  • There are 2 ways to put the module in command mode (so that it responds to AT commands):
    1. Hold pin 11 high while applying power (once power is applied, pin 11 may return to open/ground). In this case, the baud rate is fixed at 38,400 bauds.
    2. Hold pin 11 at any time after having applied power. If so, pin 11 must be held high until you are done with AT commands. In this case, the baud rate is the rate defined by command AT+UART
  • There are many firmware versions, there may be very significant differences between the versions.
    1. Some will not let you go to command mode, or will severely limit the kind of commands available.
    2. If you can, make sure to buy modules that can be put in Master mode, they tend to have better firmware.
  • When you change a setting, it is automatically saved. Some settings take effect immediately, some wait until you reboot

A note about using multiple HC-05 modules with an Android device and renaming your HC-05s

Since all the modules come with the same name of “HC-05”, it may be difficult to work with multiple modules at the same time because if you pair multiple HC-05 with one Android phone or tablet, they will all show up as HC-05. How do you know which is which?

This is compounded by the fact that the HC-05 can only be paired with one master at a time. Once you pair an HC-05 with a device, it will forget whatever device it may have been paired with previously. However, the device it was paired with previously may remember it yet it will not be able to reconnect unless you “forget” it and pair again. This can get aggravating, even more so if you try to explain that to a non-technical person.

To alleviate this problem, I rename my modules HC05-XXXX where XXXX are the last 4 digits of the MAC address. This makes it very unlikely that any 2 modules I am working with have the same name. I put a sticker on the HC-05 module with the last 4 of the MAC address and I know exactly which module I am connected to.

You can query the MAC address of an HC-05 module with command “AT+ADDR?\r\n” It will return a string like this“+ADDR:2017:5:152449. This represents MAC address 20:17:05:15:24:49 in conventional dot (or colon) notation. So in this example, I would rename the module HC05-2449 using command “AT+NAME=HC05-2449\r\n”

A quirk: even though the “AT+NAME=XXXX” command works fine on my modules (with version of “hc01.comV2.1”), the AT+NAME? command is totally ignored and returns nothing (no OK, no ERROR). This may be due to the particular firmware in my modules.

When you pair a Bluetooth device with an Android device, Android remembers the Bluetooth device by its name and its MAC address but it only displays the name when you are in the Bluetooth settings page. Even if you tell Android to forget the device, it will remember the name-MAC address as a set (at least for a while). So if you previously paired a module to your phone as HC-05, change the name of the module to, say, HC05-2449 and try to pair it again, Android will show it under the old name HC-05, even if you have told Android to forget the device (at least on Android 5.1). Once you pair with it again however, the name will then change to the new name.

 
bluetooth/notes_on_hc-05_module.1520084144.txt.gz · Last modified: 2018/03/03 08:35 by ko4bb
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
Except as noted, this entire site Copyright © 2002-2017. KO4BB All rights reserved.