I'm working on a small project and for it I need to pair two HC05 Bluetooth modules together.
No matter what I do or what kind of tutorial I follow I never seem to be able to change the role from slave to master on any of my modules. It always stays on slave.
After "AT+ROLE=1" it displays "OK" but it never changes the value to "+ROLE:1", it stays as "+ROLE:0".
I'm using:
2x Arduino Nano Every
2x HC05 modules (I also have 2x HC06 but they are no use if I cant ger a master one)
I'm using code from SoftwareSerialExample - Arduino example (followed this tutorial: https://www.youtube.com/watch?v=SWEDCZSa3ow&list=LL&index=2&ab_channel=techiesms):
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3);
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// set the data rate for the SoftwareSerial port
mySerial.begin(38400);
//mySerial.println("Hello, world?");
}
void loop() { // run over and over
if (mySerial.available()) {
Serial.write(mySerial.read());
}
if (Serial.available()) {
mySerial.write(Serial.read());
}
}
I only changed the baud values
Serial monitor:
AT+ROLE?
+ROLE:0
AT+ROLE=1
OK
AT+ROLE?
+ROLE:0
HC05 pin connection:
RXD - D3
TXD - D2
GND - GND
VCC - 5V
EN - none
STATE - none
The LED on the HC05 module blinking every 2 sec.
AT+STATE? => gives me "+STATE:PAIRABLE"? Could this be it?
What could be the problem? How can I fix this? Are my HC05 broken? Are there other ways of setting a role for a HC05?