This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Automatic pairing between bluetooth devices

Hi,

I am new to bluetooth. I am working on a new design and need to know if automatic pairing between bluetooth devices is possible if unique information (i.e. password/passcode/PIN) is known in advance by bluetooth devices.

In my design, I am planning to use 1 master and 1 or 2 slaves. None of bluetooth devices used in design will will be BLE since I will be sending audio and data over bluetooth link (My understanding is that BLE doesn't do audio).

In my design, we could have more bluetooth devices around master so the intent is communication link with master needs to be restricted only with slave(s) that know unique information (i.e password/PIN/passcode).

Also how long does that unique information needs to be (i.e number of bits)? If I now want master to communicate with different bluetooth device(s) (1 or 2 slaves), is it possible to programmitically change unique information for master so that master can now pair and restrict communication with different bluetooth device(s)? Note I will be using micro-controller with bluetooth devices (both master and slave).

Please let me know.

Thanks!

Umesh

  • Hi Umesh,

    Yes, automatic pairing is possible. But you need to implement it.

    and passkey of  4- digits is sufficient for authentication , for normal pairing and the use of 6 digits is allowed in secured simple pairing.

    what do you mean by changing the unique information? 

    Please go through the Bluetooth specifications(see below), where you should find most of the answers

    https://www.bluetooth.org/en-us/specification/adopted-specifications

  • Sundeep,

    Thanks for your reply!

    With my design, each slave has it's own unique passkey known by slave in advance. When slave is in proximity to master, slave communicates passkey via infrared to Master. Once Slave communicates passkey to Master via infrared, master pairs with slave via passkey sent through infrared. From here on, communication between master and slave is via bluetooth and infrared is out of picture. Also eventhough master is surrounded by other slaves, it would pair only with intended slave (and ignore other slaves) since passkey is known only by intended master and slave.

    Now, if original slave goes away and a different slave is brought in, then this different slave would too then communicate passkey to master via infrared. The master would then pair with new slave via passkey sent through infrared.

    This is what I meant when I asked if its possible to change unique information (aka passkey) for Master so that it can communicate different slaves (since passkey is unique to each slave).

    Please let me know if what I am asking is possible.

    Thanks again!
    Umesh

  • Umesh,

    Try this.

    Your master will have to maintain a table of Bluetooth addresses for the slave and a PIN code corresponding to those.

    You probably want to do legacy pairing here as you want to control the PIN code on both sides. If not, you can try making both devices Keyboard only.

    During the connection process, you can either make the Master force pairing whenever a slave tries to connect (put it in Manual connection mode, and when you get an connect request indication, initiate bonding from Master and once bonding is successful, respond to connect request), if bonding fails, and master has a link key, it should throw away the link key as it could mean the slave has thrown away it's link key.

    or

    since you control slave, you can force it to bond with the master before you try to connect.

    So using one of the two above whenever slave tries to connect to Master the first time, Master will receive a PIN code request and use the PIN from its database and they will pair. It will not have a PIN for an unknown slave and you can reject the pairing request in that case.

    The next time you will be asked a link key and you will be ok as the previously generated link key would work.

    If the slave wants to change PIN code, it should also throw away all link keys that it has generated.

    And yes, if the PIN code changes over IR, throw away link key as well.

    Hope this helps,

    Stonestreet One.

  • Thanks very much for your reply! I appreciate it.

    -Umesh