I'm not sure if this is a dumb question, but here goes 🤞 :

I am developing an Android app that uses a custom Bluetooth device as a companion. I'm using an HC05 module to interface the device with my app. What I need is a way for me to distinguish my HC05 module from, say, some other HC05 module that might be in range.

The obvious way of doing this would be to set the device name in a certain format. But I was wondering if there was a more better approach to this.

On searching, I found that UUID's are used for a similar purpose (i.e. service discovery), but I couldn't find any further info. Is it at all possible to set a custom UUID for the HC05 module so that I can filter devices in my Android app based on that?

  • 1
    AFAIK not directly, but I don't think you connect to the HC05 just to say "Hey, I'm here". You should have something attached to the HC05 serial port. What you can implement is a sort of identification command (like they always do for AT modems). For instance, when you connect you send "?" (or "ATI" like in modems) and it returns you "ShahiM's Bluetooth companion v1.05" or whatever string you prefer. This way you just have to ask him this. In the same way you can ask for a UUID (note that unique implies flashing a different value on each prototype or using hardware UUID memories)
    – frarugi87
    Jan 25, 2017 at 10:56
  • 2
    And, by the way, there's no such thing as a stupid question
    – frarugi87
    Jan 25, 2017 at 11:01

2 Answers 2


Your options are:

  1. As you guessed, you could set the name with AT+NAME=, and only use the names matching some pattern. It would work if you're only user so you just want to ignore other BT devices, but is problematic if you're having multiple independent users (each with its different set of *HC05*s) who might be in range (you could set different pattern for each user, though).

  2. build a database of addresses (read-only with AT+ADDR?), and only access those devices that are belonging to that user. It would avoid problem above with multiple users, but would require some logistics on your part (for example, when you sell user the app and HC05s, in the registration process you'll need to assign exactly which HC05 address that user my access. Or you might want to allow user to pick which devices are his, by having him specify specify PIN for pairing set with AT+PSWD=)

  3. third way is to use custom Inquire Access Code instead of GIAC so only that set of devices is scanned. HC05 allows setting it with AT+IAC=. However, as it is more complex and nonstandard that (2), and you'd probably still need to registration to differentiate which user is allowed which IAC, I'd recommend you do (2) instead.


As frarugi87 recommended in the comments, you need to change the device's name. Changing the device name will allow you to identify it by a custom name that you come up with. To do this you need to use something called AT Commands. Here is a guide that contains many of the system parameters that you can check and change via AT Commands: http://www.instructables.com/id/Modify-The-HC-05-Bluetooth-Module-Defaults-Using-A/?ALLSTEPS

Here is a brief summary about how to change the device name, quoted from the above Instructable:

First switch the device into command mode

For the HC-05 module to switch to AT command mode, the HC-05 pin 34 (often referred to as the Key pin) needs to pulled HIGH but in a certain order of events explained below. When the HC-05 enters the AT command mode, it will communicate at 38400 baud rate. Follow these steps in the stated order to switch to the HC-05 to AT command mode.

  1. Wire the HC-05 and Arduino Uno per instructions.
  2. BEFORE YOU CONNECT THE ARDUINO TO THE USB remove the VCC (power) red wire from the HC-05 so it's not getting any power from the Arduino. All other wires are still connected.
  3. Now connect the Arduino Uno to the USB cable extended from your PC.
  4. Make sure the HC-05 module is NOT PAIRED with any other Bluetooth device.
  5. Re-connect the Arduino Uno 5V wire to the HC-05's VCC (5V power) pin.
  6. The HC-05 LED will blink on and off at about 2 second intervals. Now the HC-05 is in AT command mode ready to accept commands to change configuration and settings.
  7. To test if everything is wired correctly, open the Serial Monitor from the 8. Arduino IDE and type "AT" and click SEND. You should see an "OK" If you don't see an "OK" check your wiring.

Next run this program on your Arduino


AUTHOR: Hazim Bitar (techbitar)
DATE: Aug 29, 2013
LICENSE: Public domain (use at your own risk)
CONTACT: techbitar at gmail dot com (techbitar.com)


#include <SoftwareSerial.h>

SoftwareSerial BTSerial(10, 11); // RX | TX

void setup()
  pinMode(9, OUTPUT);  // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
  digitalWrite(9, HIGH);
  Serial.println("Enter AT commands:");
  BTSerial.begin(38400);  // HC-05 default speed in AT command more

void loop()

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

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

Finally (the quotes aren't part of the command)

To change device name from the default HC-05 to let's say MYBLUE enter: "AT+NAME=MYBLUE"

  • This answer has been copied from a site. It shouldn't be allowed to collect this bounty.
    – Dat Ha
    Jan 26, 2017 at 13:04
  • I disagree. I know about bluetooth chips from past experiences, but I have never worked with the HC-05 so I had to look up how to put it in command mode. Then I summarized the article as it directly relates to the question. I think this should qualify for the bounty as I answered the question.
    – Joel
    Jan 26, 2017 at 18:15
  • Joel has given attribution, and he would be told off for posting a link-only answer, so I think this is OK. If another person posts an answer which is accepted by the OP then that answer would collect the bounty.
    – Nick Gammon
    Jan 26, 2017 at 20:39
  • Yes. I know changing the Device name is possible. My question was whether if there are any other methods.
    – ShahiM
    Jan 27, 2017 at 20:19
  • Why do you need other methods? Are there any limitations, or application specifics that prevent you from changing the name? This will help give me more context for the answer.
    – Joel
    Jan 27, 2017 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.