is it possible to disconnect bluetooth?

i want to communicate one master and multiple slaves. i’m trying to pairing one master to ‘A’ slave and if finish to send data, then disconnect ‘A’ slave and connect to ‘B’ slave…

i have AT-09(HM-10 bluetooth 4.0) and it’s output looks like this.

i’m sorry that is in korean, but i can’t find exact datasheet about this.

and it’s At command is like this.

master

********************************************************************
* Command             Description			           *
* ---------------------------------------------------------------- *
* AT                  Check if the command terminal work normally  *
* AT+RESET            Software reboot				   *
* AT+VERSION          Get firmware, bluetooth, HCI and LMP version *
* AT+HELP             List all the commands		           *
* AT+NAME             Get/Set local device name                    *
* AT+PIN              Get/Set pin code for pairing                 *
* AT+BAUD             Get/Set baud rate		                   *
* AT+LADDR            Get local bluetooth address		   *
* AT+ADDR             Get local bluetooth address		   *
* AT+DEFAULT          Restore factory default			   *
* AT+RENEW            Restore factory default			   *
* AT+STATE            Get current state				   *
* AT+PWRM             Get/Set power on mode(low power) 		   *
* AT+POWE             Get/Set RF transmit power 		   *
* AT+SLEEP            Sleep mode 		                   *
* AT+ROLE             Get/Set current role.	                   *
* AT+PARI             Get/Set UART parity bit.                     *
* AT+STOP             Get/Set UART stop bit.                       *
* AT+INQ              Search slave model                           *
* AT+SHOW             Show the searched slave model.               *
* AT+CONN             Connect the index slave model.               *
* AT+IMME             System wait for command when power on.	   *
* AT+START            System start working.			   *
* AT+UUID             Get/Set system SERVER_UUID .            	   *
* AT+CHAR             Get/Set system CHAR_UUID .            	   *
* -----------------------------------------------------------------*
* Note: (M) = The command support master mode only. 	           *
* Copyright@2013 www.cyobd.com.   All rights reserved.		   *
********************************************************************

slave

********************************************************************
* Command             Description			           *
* ---------------------------------------------------------------- *
* AT                  Check if the command terminal work normally  *
* AT+RESET            Software reboot				   *
* AT+VERSION          Get firmware, bluetooth, HCI and LMP version *
* AT+HELP             List all the commands		           *
* AT+NAME             Get/Set local device name                    *
* AT+PIN              Get/Set pin code for pairing                 *
* AT+PASS             Get/Set pin code for pairing                 *
* AT+BAUD             Get/Set baud rate		                   *
* AT+LADDR            Get local bluetooth address		   *
* AT+ADDR             Get local bluetooth address		   *
* AT+DEFAULT          Restore factory default			   *
* AT+RENEW            Restore factory default			   *
* AT+STATE            Get current state				   *
* AT+PWRM             Get/Set power on mode(low power) 		   *
* AT+POWE             Get/Set RF transmit power 		   *
* AT+SLEEP            Sleep mode 		                   *
* AT+ROLE             Get/Set current role.	                   *
* AT+PARI             Get/Set UART parity bit.                     *
* AT+STOP             Get/Set UART stop bit.                       *
* AT+START            System start working.			   *
* AT+IMME             System wait for command when power on.	   *
* AT+IBEA             Switch iBeacon mode.	                   *
* AT+IBE0             Set iBeacon UUID 0.            	           *
* AT+IBE1             Set iBeacon UUID 1.            	           *
* AT+IBE2             Set iBeacon UUID 2.            	           *
* AT+IBE3             Set iBeacon UUID 3.            	           *
* AT+MARJ             Set iBeacon MARJ .            	           *
* AT+MINO             Set iBeacon MINO .            	           *
* AT+MEA              Set iBeacon MEA .            	           *
* AT+NOTI             Notify connection event .                    *
* AT+UUID             Get/Set system SERVER_UUID .            	   *
* AT+CHAR             Get/Set system CHAR_UUID .            	   *
* -----------------------------------------------------------------*
* Note: (M) = The command support slave mode only. 		   *
* For more information, please visit http://www.cyobd.com          *
* Copyright@2013 www.cyobd.com.   All rights reserved.		   *
********************************************************************

and here is my code

#include <SoftwareSerial.h>
#define BT_RX 7
#define BT_TX 8
#define EN 2
#define STATE 3
 
SoftwareSerial HM10(BT_RX,BT_TX);  // RX핀(7번)은 HM10의 TX에 연결 
                                   // TX핀(8번)은 HM10의 RX에 연결  
void setup() {  
  Serial.begin(9600);
  HM10.begin(9600);
  pinMode(STATE, INPUT);
  pinMode(EN, OUTPUT);
}

void loop() {
  if (HM10.available()) {
    Serial.write(HM10.read());
  }
  if (Serial.available()) {
    HM10.write(Serial.read());
  }
}

master and slave both are same.

i want to disconnect current slave so i tried to write “AT+RESET” at Serial, it just send to connected module, not reset.

is there any way to do this?

Look for my tutorial on using the 74HC125 / 126 quad tri-state buffers.

i'm sorry but is here right?

sinsin63:
i'm sorry but is here right?
Classic Microcars and AJL Electronics Ltd Gloucester - Reliant specialists, parts and restoration. Gloucestershire's experts in TV, Satellite and all home entertainment. Freesat specialists

No, but now you mention it, maybe I should archive stuff on my own website too!

The tutorial is on here somewhere. Let me see if I can find it for you.

Here it is: Arduino Forum

thanks. very impressive post, but i'm weak at electronic engineering, maybe my understand is wrong.

i understand that install more buffer and just change connection if i need to transmit data to other hardware, right?

but if i need to communication a lot of hardware, BLE module will be more need propotional by hardware. i think it's not good way to solve this problem.

is there any other way to cut or reboot bluetooth module by software method?

thank you for your interest!

You put the buffers in the serial lines and connect the enable to the USB power input. That way, when you connect the computer for programming, it disconnects the serial line. If you want to redirect the serial, then you use more than one buffer which outputs to the other serial devices but strap all the enables together.

wow, very interesting solution, i didn't imagine that way.

but, I don't think that's the solution in the direction I thought. sorry for it. and thanks!

You can disconnect Bluetooth simply by having the power thereto under software control. I have no idea what a tri state buffer is. Maybe it does the same thing. If it doesn't, it is probably a pointless pursuit. Once you have stopped Bluetooth, you then have the option to re-start, and reconfigure it to auto connect to another slave. I'm not familiar with HM-10, it may not be necessary to turn it off like an HC-05, but you asked the question.
I believe even with HM-10, you cannot send AT commands once you are in comms mode, AT+Ladedah is just more serial data.

i'm sorry to late to reply

wow you're exactly right. when i connected it, i can't send AT command.

so i thought cut off the power, too.

thank you for your advise!

Nick_Pyner:
You can disconnect Bluetooth simply by having the power thereto under software control. I have no idea what a tri state buffer is. Maybe it does the same thing. If it doesn't, it is probably a pointless pursuit. Once you have stopped Bluetooth, you then have the option to re-start, and reconfigure it to auto connect to another slave. I'm not familiar with HM-10, it may not be necessary to turn it off like an HC-05, but you asked the question.
I believe even with HM-10, you cannot send AT commands once you are in comms mode, AT+Ladedah is just more serial data.

A tri-state buffer is basically an output that can have three states; HIGH, LOW and high impedance. Think of the IO pins of an Arduino; output HIGH, output LOW and input. Except that e.g. the HC125 only has output functionality.

Powering a module off probaby requires more than just switching the power off; one has to prevent parasetic power via the modules RX pin.