This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to pair two bluetooth devices??

Hii guys ,

            I am trying to pair two nrf52 bluetooth devices.  How can we pair two stand alone nrf52 devices to send and receive data? Is there any example code to show such demonstration?

          

Parents
  • Hello NJ_B,

    If you are interested in seeing an example of basic pairing and information sending / receiving, I would recommend that you take a look at the BLE Blinky example from the nRF5 SDK.
    The example might seem convoluted when you first look into its source code, but just remember that most of it is standard functions for configuring and initiating the BLE communication. Other than that, the application only sends it button state to the paired device. The example comes with one peripheral and one central application and works by having the peripheral device start advertising with its name 'Nordic_Blinky'. The central then scans for advertisers with this name, and requests to connect to it if one is found.
    From there, the connection is established, and the two devices will alert each other if their button state should change. For this, they use notifications, to send the newest button state.

    Contrary to IOT_Man's suggestion I would not recommend that you try to use Mesh for this if you are only interested in sending and receiving information between two devices. Mesh is better suited for larger networks which spans a range larger than the range of BLE communication - creating the need for relaying messages. This is where Mesh shines, not on 1 to 1 communication.

    Please do not hesitate to ask if anything should be unclear, or if you encounter any other issues or questions!

    Best regards,
    Karl

Reply
  • Hello NJ_B,

    If you are interested in seeing an example of basic pairing and information sending / receiving, I would recommend that you take a look at the BLE Blinky example from the nRF5 SDK.
    The example might seem convoluted when you first look into its source code, but just remember that most of it is standard functions for configuring and initiating the BLE communication. Other than that, the application only sends it button state to the paired device. The example comes with one peripheral and one central application and works by having the peripheral device start advertising with its name 'Nordic_Blinky'. The central then scans for advertisers with this name, and requests to connect to it if one is found.
    From there, the connection is established, and the two devices will alert each other if their button state should change. For this, they use notifications, to send the newest button state.

    Contrary to IOT_Man's suggestion I would not recommend that you try to use Mesh for this if you are only interested in sending and receiving information between two devices. Mesh is better suited for larger networks which spans a range larger than the range of BLE communication - creating the need for relaying messages. This is where Mesh shines, not on 1 to 1 communication.

    Please do not hesitate to ask if anything should be unclear, or if you encounter any other issues or questions!

    Best regards,
    Karl

Children
No Data
Related