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

BLE Central Server multiple Peripheral Clients

I need to have a Central device physically connected (via UART) to a sensor. Data is collected from the sensor and sent to a number of Peripheral devices which use the data to perform a task.

So far I have set up a 52-nRF DK board to act as a Multilink Central (S132) as in the example ble_app_multilink_central and two 51-nRF DK boards to function as the Blinky peripherals (S130).

The blinky demo works fine. I have got the nRF-52 to read the data from the senor and store it in a set of variables.

What I am struggling with is how to set up my own service where the Central device acts a Server and the Peripheral devices act as Clients. I then need to send the collected data (about 100 bytes every second) from the Central device all of the Peripherals. There does not seem to be any examples available showing this type of configuration.

Ideally I will be wanting to use the perhiperal devices in a Mesh connection at a later date

  • Oh yes, MESH will magically solve all IoT problems;).

    Anyway, before that happens, to your architecture: why you don't keep Peripheral devices as GATT Servers with one custom Service and Characteristic where Central device ("hub" with sensor data) will connect and write your custom data structure to the Characteristic's value as GATT Client?

    You can of course do it also in opposite way but it looks more cumbersome:

    • "Hub" as GAP Central will scan and connect to all GAP Peripherals it needs.
    • Peripherals being GATT Clients need to do Service discovery (or your server needs to be static and all handle numbers could be then hardcoded in the Peripheral firmware).
    • Once it finds target Service and Characteristic it will write to CCCD to enable GATT Server Notifications (or Indications if you want to work slower but with confirmations on APP layer).
    • Finally "hub" can start to send asynchronously sensor data inside Notification events to each Peripheral which enabled it through CCCD.

    Cheers Jan

Related