# bluetooth: Can i connect multiple hc-05 slaves to one hc-05 master?

I am completely new to the bluetooth world so please bare with me.

Can one hc-05 be the master and connect to multiple hc-05s slaves? I've done a lot of research and some say it can and some says it can't. It's making me super confused.

I'm working on a project where the master will connect to one slave whenever I call for the master. The other slaves will be on standby. So is it possible to do the connection with hc-05? Or do I have to use other bluetooth modules in the market? And what's the maximum number of slaves that can be connected to one hc-05 master? Thanks in advance.

• instructables.com/id/… May 19 '18 at 13:42
• Someone managed to have one master with two slaves, code and video at: saibatudomt.com.br/2018/01/… May 19 '18 at 13:47
• "... so please bare with me." Why do we get so many invitations to undress in the questions? Do you mean "bear with me"? See here. May 19 '18 at 13:53

It seems to be limited, but some folks have had success with two slaves

Master

[/*
This code is in the public domain.
written by Itamar Eduardo Gonçalves de Oliveira
*/

#include <SoftwareSerial.h>
#define bt_power 12
#define bt_key_power 9
#define indication_led 13

SoftwareSerial BT(11, 10); // RX | TX

void setup()
{
// set the pins to OUTPUT
pinMode(bt_power, OUTPUT);
pinMode(bt_key_power, OUTPUT);
pinMode(indication_led, OUTPUT);

// set the pins to LOW
digitalWrite(bt_power, LOW);
digitalWrite(bt_key_power, LOW);
digitalWrite(indication_led, LOW);

/************************************************
Setting the pins to low is important because
in order for us to get into AT mode the key pin
has to be set to Ground FIRST. Many tutorials out
there fail to mention this important fact and
therefore many people have problems with getting
into the AT mode of the HC-05
************************************************/

// make sure the key has been LOW for a bit
delay(100);

// set the key pin to High
digitalWrite(bt_key_power, HIGH);

// small delay
delay(100);

// now power on the BT
digitalWrite(bt_power, HIGH);

// start our serial so we can send and recieve
// information from the BT module
Serial.begin(9600);
// initiate the BT serial at 38400 which is the default
// speed at which the BT AT mode operates at
BT.begin(38400);

// self explanatory
Serial.write("For a list of commands, visit: \n");
Serial.write("Type AT commands  \n\n");

// Send an "AT" command to the AT (without quotes)
// if response is OK, then we are connected
// and ready to program the BT module
delay(3000);
BT.write("AT+ROLE=1\r\n");
Serial.write("AT+ROLE=1\r\n");
delay(1000);
BT.write("AT+CMODE=1\r\n");
Serial.write("AT+CMODE=1\r\n");
delay(1000);
}

void loop()
{

BT.write("AT+BIND=98d3,31,b40056\r\n");
Serial.write("AT+BIND=98d3,31,b40056\r\n");
delay(2000);
BT.write("AT+INIT\r\n");
Serial.write("AT+INIT\r\n");
delay(3000);
BT.write("AT+INQ\r\n");
Serial.write("AT+INQ\r\n");
delay(4000);
delay(4000);

BT.write("a");
delay(2000);
BT.write("b");
delay(4000);
digitalWrite(bt_power, LOW);
digitalWrite(bt_key_power, LOW);
digitalWrite(indication_led, LOW);
delay(100);
digitalWrite(bt_key_power, HIGH);
delay(100);
digitalWrite(bt_power, HIGH);
Serial.write("Desconectando\r\n");
delay(4000);

BT.write("AT+BIND=98d3,31,b40057\r\n");
Serial.write("AT+BIND=98d3,31,b40057\r\n");
delay(2000);
BT.write("AT+INIT\r\n");
Serial.write("AT+INIT\r\n");
delay(3000);
BT.write("AT+INQ\r\n");
Serial.write("AT+INQ\r\n");
delay(4000);
delay(4000);

BT.write("a");
delay(2000);
BT.write("b");
delay(4000);
digitalWrite(bt_power, LOW);
digitalWrite(bt_key_power, LOW);
digitalWrite(indication_led, LOW);
delay(100);
digitalWrite(bt_key_power, HIGH);
delay(100);
digitalWrite(bt_power, HIGH);
Serial.write("Desconectando\r\n");
delay(4000);

// listen for a response from the HC-05 and write it to the serial monitor
if (BT.available())

// listen for user input and send it to the HC-05
if (Serial.available())

}][1]


Slave

/*
This code is in the public domain.
written by Itamar Eduardo Gonçalves de Oliveira
*/

#include <SoftwareSerial.h>
#define bt_power 12
#define bt_key_power 9
#define indication_led 13
#define led 2

SoftwareSerial BT(11, 10); // RX | TX

void setup()
{
// set the pins to OUTPUT
pinMode(bt_power, OUTPUT);
pinMode(bt_key_power, OUTPUT);
pinMode(indication_led, OUTPUT);
pinMode(led, OUTPUT);

// set the pins to LOW
digitalWrite(bt_power, LOW);
digitalWrite(bt_key_power, LOW);
digitalWrite(indication_led, LOW);

/************************************************
Setting the pins to low is important because
in order for us to get into AT mode the key pin
has to be set to Ground FIRST. Many tutorials out
there fail to mention this important fact and
therefore many people have problems with getting
into the AT mode of the HC-05
************************************************/

// make sure the key has been LOW for a bit
delay(100);

// set the key pin to High
digitalWrite(bt_key_power, HIGH);

// small delay
delay(100);

// now power on the BT
digitalWrite(bt_power, HIGH);

// start our serial so we can send and recieve
// information from the BT module
Serial.begin(9600);
// initiate the BT serial at 38400 which is the default
// speed at which the BT AT mode operates at
BT.begin(38400);

// self explanatory
Serial.write("For a list of commands, visit: \n");
Serial.write("Type AT commands  \n\n");

// process complete turn on led 13
digitalWrite(indication_led, HIGH);

// Send an "AT" command to the AT (without quotes)
// if response is OK, then we are connected
// and ready to program the BT module
delay(3000);
BT.write("AT+ROLE=0\r\n");
Serial.write("AT+ROLE=0\r\n");
delay(1000);
BT.write("AT+CMODE=1\r\n");
Serial.write("AT+CMODE=1\r\n");
delay(1000);
BT.write("AT+INIT\r\n");
Serial.write("AT+INIT\r\n");
delay(3000);
BT.write("AT+INQ\r\n");
Serial.write("AT+INQ\r\n");
delay(3000);
}

void loop()
{

// listen for a response from the HC-05 and write it to the serial monitor
if (BT.available()){
Serial.write(te);
if(te=='a'){
digitalWrite(led,HIGH);
}
else if(te=='b'){
digitalWrite(led,LOW);
}
}

// listen for user input and send it to the HC-05
if (Serial.available())