0

I have developed an application on Android, which connects to a Bluetooth HM10, launches commands, and turns LEDs on and off through my Arduino. All of this works properly.

So, I want to make Bluetooth secure, so that nobody can connect to it, and keep it busy and I can't connect myself.

To do this, from my Serial Monitor I execute the corresponding configuration commands, but I never get it to link correctly on my Android.

I have tried many options, to no avail:

OPTION 1)

  • AT+ROLE? = Ok+Get:0 (Slave or Periphe)
  • AT+TYPE2 = Ok+Set:2 (Auth with PIN)
  • AT+PASS123456
  • AT+RESET

OPTION 2)

  • AT+ROLE? = Ok+Get:0 (Slave or Periphe)
  • AT+TYPE3 = Ok+Set:3 (Auth and bond)
  • AT+PASS123456
  • AT+RESET

In both cases (and more failed tests), I see the BLE device on my Android Bluetooth. I give it to connect and the window to enter the password pops up. I introduce 123456 And it always tells me that it could not be linked.

Any ideas for why?

Thank you.

16
  • I'm not an expert but the AT commands seems a bit strange. e.g. I would expect to enter a new PIN with AT+PASS123456. Perhaps the space is part of the PIN in your case. Just a guess. Also, the question mark after PASS is used (AFAIK) to read the PIN, not to set it. Just some guesses, without knowing much about AT commands. Perhaps it works. Cheers. – Peter Paul Kiefer Jan 27 at 11:19
  • The ROLE command also has a question mark. But as 0 is the default it is not a problem. PASS is just an alias for PIN so the official AT-command to set a new PIN is AT+PIN123456. – Peter Paul Kiefer Jan 27 at 11:29
  • As you set the type to 3, the module requires authentication, but (I guess) the password/PIN is still 000000. – Peter Paul Kiefer Jan 27 at 11:34
  • @PeterPaulKiefer I have modified the initial message, because yes, I put it wrong. The password setting is without "?" And, no, I am not putting any spaces after the password. I have made sure they are only 6 digits, clean, with no spaces. – Javier Jan 27 at 20:16
  • @PeterPaulKiefer AT+PIN? it never gives me a value of OK, with the default pin. And AT+PIN123456 does not react the Bluetooh module for that command. – Javier Jan 27 at 20:23

Your Answer

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

Browse other questions tagged or ask your own question.