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

void setup() {
  // 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();
  if (Serial1.available()) {
    c = Serial1.read();

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.
    – cjs
    Apr 12, 2017 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. Jul 11, 2017 at 22:06
  • 1
    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, 2017 at 17:01

4 Answers 4


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.

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...


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.


Somehow I ended up in such an endless auto-reconnect loop after activating AT+ROLE1 without setting AT+IMME1 first. Nothing seemed to help, not even pulling PIO0 low for 1s. I still don't even know which device my HM-10 was connecting to. It just autoconnected to something on boot...

The only way I could find to break out of this endless loop was using this sketch below. The trick was that I had to wait for "OK" response after "AT" before issuing the follow-up command "AT+RENEW" to restore factory settings.

#include <SoftwareSerial.h>

SoftwareSerial BTserial(8, 9);

void waitForOK()
  while (!BTserial.available());

  char c = BTserial.read();
  c = BTserial.read();

void setup()
  BTserial.begin(115200); // fw v700 changed default to 115200, otherwise use 9600
  Serial.println("BTserial started at 115200");


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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