Forum >conecting one central BLE to several perihperal BLE
conecting one central BLE to several perihperal BLE

Hi
is it possible to connect several peripherals BLE to a single CENTRAL one.
I want to put several sensors in different locations . where each of the sensors is connected to arduino and BLE.
the data is gonna be transmitted to main BLE that is defined as CENTER,
I tried that with 2 peripherals and 1 center , and connection was made only between the central and one of the peripherals
any settings I need to change?
tnx
Roman
is it possible to connect several peripherals BLE to a single CENTRAL one.
I want to put several sensors in different locations . where each of the sensors is connected to arduino and BLE.
the data is gonna be transmitted to main BLE that is defined as CENTER,
I tried that with 2 peripherals and 1 center , and connection was made only between the central and one of the peripherals
any settings I need to change?
tnx
Roman
2018-02-07 06:25:03 This can be achieved with the BBC Microbit.
In the web block IDE you can give each microbit a radio group ID, then all micro bits in the same group can receive the same data even without pairing. (clever huh)
Use radio send value 'name' + value, to send data to all microbits with same radio group ID
To see if the data received is for this device use..
On radio receive 'name' + value
IF 'name' == value doAction ELSE ignore as not for me to respond.
I guess its a bit like doing a WEB URL POST or GET REQUEST
i.e. SEND GROUP ID + VAR + VALUE
Javascript example..
// set group same ID for all devices that you want to connect
radio.setGroup(406721)
// transmit code
input.onButtonPressed(Button.A, () => {
radio.sendValue("SID", 1)
})
// receive code
radio.onDataPacketReceived(({ receivedString: SID, receivedNumber: value }) => {
if (SID == "01") {
if (value == 1) {
do whatever
}
if (value == 0) {
do something else
}
}
})
brianmoreau
In the web block IDE you can give each microbit a radio group ID, then all micro bits in the same group can receive the same data even without pairing. (clever huh)
Use radio send value 'name' + value, to send data to all microbits with same radio group ID
To see if the data received is for this device use..
On radio receive 'name' + value
IF 'name' == value doAction ELSE ignore as not for me to respond.
I guess its a bit like doing a WEB URL POST or GET REQUEST
i.e. SEND GROUP ID + VAR + VALUE
Javascript example..
// set group same ID for all devices that you want to connect
radio.setGroup(406721)
// transmit code
input.onButtonPressed(Button.A, () => {
radio.sendValue("SID", 1)
})
// receive code
radio.onDataPacketReceived(({ receivedString: SID, receivedNumber: value }) => {
if (SID == "01") {
if (value == 1) {
do whatever
}
if (value == 0) {
do something else
}
}
})

2018-01-12 01:47:43 Is it possible to detect specific BLE device's mac address to do specific task? Cause i am trying to connect two different Bluno to do different task. Like to ask how to use the mac address for while loop or if else
16agm060d

2015-09-29 04:50:00 that's a shame
Ill try your solution , but it takes several seconds to make a new connection , that's a big delay if you have many BLEs
do you know if XBEE transceivers have the same problem?
Gandelman Roma
Ill try your solution , but it takes several seconds to make a new connection , that's a big delay if you have many BLEs
do you know if XBEE transceivers have the same problem?

2015-09-28 22:35:14 Hi Roman,
Sorry it does not support multiple connection between several peripherals BLE to a single CENTRAL one. But it can be done by a different way, I called it Switching connection.
The basic idea and steps:
****till the last one and then go back to LINK with the first BLE device.
Btw, this post can help you to enter AT mode in code. How do I know my Bluno is connected in code?
*******Update********
I had some spare time to finish the code, it worked. However, for the connection to link with another BLE requires some time, so the link just can not switch from one to another very quickly. I test with 10 seconds, it would be fine.
Here is the code:
NOTE: Once you entered AT mode using code "Serial.print("+++")", it won't print any info through serial port, i.e. the Serial.print("....") won't work.
Leff
Sorry it does not support multiple connection between several peripherals BLE to a single CENTRAL one. But it can be done by a different way, I called it Switching connection.
The basic idea and steps:
- Set the BLE devices to be CENTRAL( One ) or PERIPHERAL( others )
- Keep record the MAC address of the PERIPHERAL BLE from the first to the last one.
- Set the CENTRAL BLE with AT comands AT+CMODE=UNIQUE and AT+BIND=0x0017ea9397e1( NOTE: just an example of a BLE mac address) to bind the first BLE;
- After finishing the data transmission from the first one, then use AT command "AT+RESTART" to disconnect the LINK with the first BLE.
- Repeat the step3 to bind the second BLE device.
- Repeat the step4 ...
****till the last one and then go back to LINK with the first BLE device.
Btw, this post can help you to enter AT mode in code. How do I know my Bluno is connected in code?
*******Update********
I had some spare time to finish the code, it worked. However, for the connection to link with another BLE requires some time, so the link just can not switch from one to another very quickly. I test with 10 seconds, it would be fine.
Here is the code:
NOTE: Once you entered AT mode using code "Serial.print("+++")", it won't print any info through serial port, i.e. the Serial.print("....") won't work.
Code: Select all
/*my Bluno Mega2560 0xC8A030FA0CEF;
my Romeo BLE 0x20CD3987C659
my bluno 0xD03972C4CF0F
my Bluno Mega1280 0xB4994C5C2E77
*/
char* peripheral[] = {"0xC8A030FA0CEF", "0x20CD3987C659", "0xD03972C4CF0F", "0xB4994C5C2E77"};
unsigned long previousMillis = 0;
const long interval = 15000; // interval at which to awitch the connection (milliseconds), at least 10 seconds
int linkTo = 0;
void setup() {
Serial.begin(115200);
pinMode(13, OUTPUT);
delay(100);
}
void loop() {
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
atBind(peripheral[linkTo++]);
//control();
}
if (linkTo > 3) linkTo = 0;
}
void atBind(char* peripheralAdd) {
digitalWrite(13, HIGH);
Serial.println("AT+EXIT");
delay(100); //can't be omitted, same below
Serial.print("+++");// Enter AT mode of itself
delay(700); // 700 milliseconds MUST be added or AT ode not work
Serial.print("AT+BIND=");
Serial.println(peripheralAdd); delay(100);
Serial.println("AT+RESTART"); delay(100);
digitalWrite(13, LOW);
}
void control() {
for (int i = 0; i++; i < 2) {
Serial.write(1);
delay(500);
Serial.write(0);
delay(500);
}
}
