Can't configure HC-05 as master

I am trying to configure the HC-05 as master by using the AT+ROLE command:

AT+ROLE=1
OK

The response is "OK". However, if I check the role, it says that the role is 0, which stands for slave:

AT+ROLE?
+ROLE:0

I tried AT+INQ, which requires being in master mode, but it returns an error:

AT+INQ
ERROR:(16)

I guess it confirms that the module is not in master mode.

I tried restoring the settings (AT+ORGL) and resetting (AT+RESET) before and after changing the role, but it is still always at zero. Changing role to 2 also returns "OK" but the role does not actually change.

I am using hardware serial for reading AT commands from PC and software serial for reading response from HC-05.

#include <SoftwareSerial.h>

SoftwareSerial softSerial(2, 3);

void setup() {
  Serial.begin(19200);
  softSerial.begin(38400);
}

void loop() {
  if (softSerial.available()) {
    char c = softSerial.read();
    Serial.write(c);
  }
  if (Serial.available()) {
    char c = Serial.read();
    softSerial.write(c);
  }
}

My wiring schematic is shown below:

I would appreciate any help on this

maybe helpful:
https://medium.com/@karkhanaclub/how-to-enable-and-use-at-commands-of-hc-05-using-arduino-f8983fa56eaa

Added:

http://edge.rit.edu/edge/P17310/public/Final%20Documents/Latch%20Arm%20Control%20Box.pdf

Arduino with HC-05 (ZS-040) Bluetooth module – AT MODE | Martyn Currey

1 Like

When you start the HC05 in AT mode (EN to 3.3V) how does the LED flash?

I set up my Uno with an HC05, EN pin to 3.3V, and tried your code. I can change role, code works fine.

From runaway_pancake link, this statement

There are 2 options for entering Master Mode; bring Pin 27 HIGH or bring pin 28 HIGH. Pin 27 allows you to use software and pin 28 allows you to use a hardware switch.

In an earlier post I mentioned that it looks likes pin 27 or pin 28 has to be pulled HIGH to enter Master Mode and this does indeed seem to be the case. Everything I have tried without pulling the pin(s) HIGH has failed. They reply with “OK” and if you interrogate with “AT+ROLE” they report “+ROLE=1” but they are actually still in Slave Mode. They reply with “OK” and if you interrogate with “AT+ROLE” they report “+ROLE=1” but they are actually still in Slave Mode.

I cannot confirm the above behavior.

1 Like

From the article:

As the module has 2 modes Partial AT mode and Full AT mode.
...
The only change to switch the module from Partial to Full AT mode is the switch that was released when the wire was connected to the 3.3V, now for switching it to Full AT mode, the switch must not be left unpressed, and wire should be connected now without letting the switch go.

In my attempts I was not holding the button, so, according to this article, the module must have been in Partial AT mode. I tried pressing the button, powering up the HC-05, and sending AT commands (all while the button is still pressed). The only difference I noticed is that AT+MPIO? returns different values when the button is pressed and released. But I am still unable to change the role.

The LED is blinking with 2 seconds interval (On for 2 seconds and Off for 2 seconds)

I tried connecting pin 27 and 28 to 3.3V, but I didn't notice any difference at all.

1 Like

I proceeded this way a few years ago.

1)AT

Answer was OK.

  1. AT+UART?

Answer was +UART:9600,0,0 OK.

3)AT+ROLE=1

Answer was OK.

4)AT+CMODE=0

Answer was OK.

AT+BIND= 9***,,***
Here I typed the slave's address after the equal sign. There was a point to be noted. At the time of slave configuration, I got the slave's address that contained some numbers and semicolons. But in the command above I had to replace semicolons by commas. And the answer was 'OK'.

At the time of master-slave operation, slave has to be powered up before the master.

I repeated the same steps, and the answer was always OK. But I can't connect to slave (AT+PAIR and AT+LINK give errors) and AT+ROLE? still returns 0.

At the times of up of powering both the Slave and Master module, you have to keep the power buttons pressed for 3 seconds and then release them. Are you following this step?

It did not help either.

I ended up buying a new HC-05 module. I did exactly the same steps with it, which i previously tried with the old one. And the new one worked just fine.
BTW, the 2 modules look different. The faulty one has 2 black chips and 1 white chip on it and it has only 1 red LED. The good module has 3 black chips and 2 LEDS: red and blue.

Please provide a link to the new device.

Good to know that. May be the previous one was a knock off.

I would like to see it too.

The old one: https://aliexpress.ru/item/1005002168332848.html?_ga=2.122264075.1255622978.1647457450-1975065871.1614176644&sku_id=12000018925700215

The new one: https://www.ozon.ru/product/modul-bluetooth-hc-05-arduino-269103746/?sh=uCjgTOFu7A

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.