1

I have two HC-05 modules the first one's role as a Master and the other is a slave one. I've done some AT commands to set up each HC-05 module

= Master's configuration has to be like that: name=Master, Password=2021, only accept connection from one HC-05 module only (for privacy purposes) via the Slave's Address, Baud rate = 9600,0,0.

= Slave's configuration has to be like that: name=Slave, Password=2021, Baud rate = 9600,0,0.

The AT command I used to set this configuration like that:

Slave:

/*Set Slave mode.*/

AT+ROLE= 0

/*Setting up Baud rate (The same as the Master Baud Rate to proper connection).*/

AT+UART= 9600,0,0

/*Rename the module.*/

AT+NAME=Slave.

/*Get the Slave address to save it for Master*/

AT+ADDR?

(The response will be the module Address, I will save it for Master configuration) let it = 98d3:a1:fd7a0f

Master:

/*Set master mode.*/

AT+ROLE= 1

/*For secured connection make Master accept only one module via its unique Address.*/

AT+CMODE=0

/*Setting up Baud rate (The same as the Master Baud Rate to proper connection).*/

AT+UART= 9600,0,0

/*Save salve address*/ 

AT+BIND=98d3,a1,fd7a0f 

/*Rename the device.*/

AT+NAME=Master.

/*Change Password.*/

AT+PSWD= 2021

I saw a lot of videos the result of all of them is: the two modules are automatically connected to each other when power is on. but mine is not!

Were I make any mistake!? these are some videos that I've watched to achieve my goal: https://www.youtube.com/watch?v=DgFZE16UKTM&t=31s https://www.youtube.com/watch?v=BXXAcFOTnBo&t=222s

note:

wiring when AT command was Tx->Tx, Rx->Rx, EN->3v3, GND->GND, VCC->VCC.

wiring when normal condition was Tx->Rx, Rx->Tx, EN->(not connected), GND->GND, VCC->VCC.

1 Answers1

0

I saw a lot of videos the result of all of them is: the two modules are automatically connected to each other when power is on. but mine is not!

This confuses me, I can't see any command that will let you initiate connection. My guess is that AT+BIND is a command for trusting. However AT+CMODE is explained as:

Param1: Connection mode: 0 -> Connect the module to the specified Bluetooth address. (Bluetooth address can be specified by the binding command)

In this case, I would send AT+BIND first rather than setting CMODE.

If we have a look at HC-05 AT command list, we can see that there are other commands that are used to establish classical Bluetooth connection. I would do the following in order:

  1. AT+PAIR=MAC
  2. AT+BIND=MAC
  3. AT+LINK=MAC

I would also check the status via AT+STATE?.

Mr. Panda
  • 485
  • 3
  • 14