HC-05 curious address

I am trying to configure 2 HC-05s to talk to each other and getting nowhere. I’m using

// Basic Bluetooth sketch BT_config
// Connect the HC-05 module in AT mode and communicate using the serial monitor
//
// The HC-05 defaults to commincation mode when first powered on you will need to manually enter AT mode
// The default baud rate for AT mode is 38400
// See www.martyncurrey.com for details
//
 
 
#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.begin(9600);
    Serial.println("Arduino is ready to configure");
    Serial.println("BT speed is set at 38400");
 
    // HC-05 default serial speed for AT mode is 38400
    // HM-10 default serial speed for AT mode is  9600
    BTserial.begin(38400);  
}
 
void loop()
{
 
    // Keep reading from HC-05 and send to Arduino Serial Monitor
    if (BTserial.available())
    {  
        c = BTserial.read();
        Serial.write(c);
    }
 
    // Keep reading from Arduino Serial Monitor and send to HC-05
    if (Serial.available())
    {
        c =  Serial.read();
        BTserial.write(c);  
    }
 
}

I’m actually having 2 problems which may be connected. When I enter AT and send, sometimes I get an OK and sometimes not. The first time after power up I usually get an OK. Then it’s iffy. Part of the problem is that I think I may not be seeing the first 2 characters of a reply.

The problem holding me up is the addresses of the devices. The normal address format is 1234-12-123456. The 4 modules I have all return 1234-12-1234. If I enter AT+ADDR?, I get

+ADDR:FCA8:9B:3947
OK

When I try to use that in an AT+BIND I get Error (7).

Do I have a bad batch?

Edit: I found another thread on this, so I’m still trying…

How have you connected the HC-05 with your UNO? Is it like the similar with a voltage divider for the RX-pin of the BT? RX=pin of BT is not 5V tolerant!!!
hc5uno.png

hc5uno.png

Did you do this?

// See www.martyncurrey.com for details

you will get the best on this there.

GolamMostafa:
RX=pin of BT is not 5V tolerant!!!

BT modules like HC-05s and HC-06s are commonly used without logic level shifters (including myself) and have had 0 problems with it.

Even though it is about how to pair and bind an HC-05 with an HC-06, you might be interested in looking at this bluetooth tutorial.

This is the code I use.

Power_Broker:
BT modules like HC-05s and HC-06s are commonly used without logic level shifters (including myself) and have had 0 problems with it.

The voltage divider circuit for RX-pin of BT05 has been recommended in this link.
BT05Conn.jpg

BT05Conn.jpg

Clearly, it would be good practice to use the divider with a 5v Arduino, but there is no need for the exclamation marks, particularly as OP may not be using a Uno. I have never heard of Bluetooth dying, or even causing a problem for the lack of a divider - ever. Indeed, in this case, I submit the divider is more likely to be the problem than the solution. If OP gets to be more forthcoming, and tells us about his 3.3v Arduino, remember where you heard that first.....