1

I have 2 HM10 Bluetooth modules connected to 2 Arduino Teensy running the following code.

void setup() {
  Serial.begin(9600);
  Serial1.begin(9600);
  // If the baudrate of the HM-10 module has been updated,
  // you may need to change 9600 by another value
  // Once you have found the correct baudrate,
  // you can update it using AT+BAUDx command 
  // e.g. AT+BAUD0 for 9600 bauds
}

void loop() {
  char c;
  if (Serial.available()) {
    c = Serial.read();
    Serial1.println(c);
  }
  if (Serial1.available()) {
    c = Serial1.read();
    Serial.print(c);    
  }
}

By pairing them using the AT commands I was able to send messages back and forth by writing to Serial1. However now when I try to send AT commands it will just send the string to the other module instead of replying OK etc. How do I break the connection and make the AT commands work again?

The tutorial I used to pair the modules.

  • Give us the final set of commands you sent to the Bluetooth modules to get them to pair and then forward your input to each other. – Curt J. Sampson Apr 12 '17 at 2:01
  • 1
    I'm voting to close this question as off-topic because it is about the command set of the HM10 module, not Arduino. – Chris Stratton Jul 11 '17 at 22:06
  • I'd say this is something you only encounter on Arduinos (Serial.println(), Arduino Teensy and etc.) so I think this suits Arduino SE. Neither can I think of a better SE community to answer this question. – Avamander Jul 12 '17 at 17:01
1

To Break Connection via BT Commands, I do the following (programmatically):
command 1: AT
command 2: AT+IMME1
When the BT is in Work Mode it does not recognize regular BT commands. The exception to this is the AT command by itself. But, it must be followed by another command (#2) within the Supervision Timeout Period which is fairly quick. IMME1 takes the BT back to AT Mode where it is no longer connected and will recognize your AT[+...] commands. If the Save Setting is enabled, it will attempt auto-reconnect too quickly...

0

From the device datasheet:

System KEY function (PIO0) if Low > 1000ms:

7.3.1 If Module is in sleep mode Module will wake up immediately, if AT+NOTI value is “1”, module will send “OK+WAKE” string through UART.

7.3.2 If Module has already connected to remote device Module will disconnect from remote device.

7.3.3 If Module is standby mode Module will reset to default configuration. Then restart.

0

I was able to break the connection with: AT

The data sheet says to use AT+PWRM1, but it didn't work for me. Instead the above command dropped the connection to the remote device.

From the Datasheet:

  1. Execute “AT+PWRM1” command, Module will auto into sleep mode when power on or disconnect from remote device.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.