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);
}
}
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.
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.
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.
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?
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.