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

Connecting to multiple BLE peripherals

Hi All,

I am trying to understand how should I define the BLE UUIDs in my peripherals and connect to each peripherals.

Basically I have several BLE sensors. My goal is to connect to each sensor peripherals and obtain the sensor data using an IOS app.

In my peripheral code, I have defined a Service UUID (128 bit). Currently I scan for this particular UUID and connect to the peripheral.

My questions are:

1. If I have multiple peripheral sensors, how should I program the UUID for each one? Is it the same for all the sensors?

2. Is there is a unique way we can differentiate each and every sensor tag from my app?

Thanks!! 

Parents
  • Do you mean that each tag has the same same set of sensors, i.e. each sensor reports temperature and humidity or something like that?  And the iOS app needs to connect to a bunch of sensors, that each report the same type of data, and know which tag is which?

    We're developing something similar, so here's what we've done:

    Each type of data has its own set of characteristics, arranged into services.  E.g. we have a battery level service that includes a battery voltage characteristic, and a temperature service that includes a couple of different temperature characteristics.  Each characteristic has a fixed UUID across all the sensor devices, e.g battery level service is always

    // Battery level service:               F38A0001-B4CF-4F2B-99DD-72CF82F60521
    //   Battery voltage characteristics:   F38A0002-B4CF-4F2B-99DD-72CF82F60521
    //                                      F38A0003-B4CF-4F2B-99DD-72CF82F60521

    Each device ("tag") has unique serial and batch numbers, programmed into the UICR as part of PCBA test (the test jig scans a sequential barcode label on the PCB).  There is also a model number, which is fixed for these devices:

    // device data read from UICR flash
    #define MODEL_NUM (NRF_UICR->CUSTOMER[2])           // 0x100010088
    #define SERIAL_NUM (NRF_UICR->CUSTOMER[3])          // 0x10001008C
    #define BATCH_NUM (NRF_UICR->CUSTOMER[4])           // 0x100010090

    We then include this in the manufacture data section of our advertising packet, in advertising_init():

        // add manufacturing data
        static struct
        {
            uint16_t model;
            uint16_t batch;
            uint32_t serial_num;
        } device_data;
        
        device_data.model = MODEL_NUM;
        device_data.batch = BATCH_NUM;
        device_data.serial_num = SERIAL_NUM;
    
        static ble_advdata_manuf_data_t manuf_data = {
            .company_identifier = MANUFACTURER_ID,
            .data.size = sizeof(device_data),
            .data.p_data = (uint8_t *)&device_data};
        adv_init.srdata.p_manuf_specific_data = &manuf_data;
    

    where MANUFACTURER_ID is the ID assigned to our company by the Bluetooth SIG.

    So, to uniquely identify that specific product, our IOS app looks for our manufacturer id and the specific model number.

    Then to know which tag is which, it looks at the batch and serial numbers (of course you only need a single unique serial number, we just add batch to make it easier to keep track).

    Hope that helps!

  • Hi David,

    Many thanks for the reply. 

    Do you mean that each tag has the same same set of sensors, i.e. each sensor reports temperature and humidity or something like that?

    Yes. This is the type of development I am doing. I think your reply answers my requirement. 

    So in general and in practice, Bluetooth Sig only provides one ID for a company?

    When the company manufactures multiple devices, we have to handle these devices in our FW?

    Thanks!

  • Yes to both. 

    You need to join the Bluetooth sig as an associate member (its free, they make their money from the qualification fee on your product}, then you can apply for a company ID - also free.

    But beyond that, you're on your own. You can use whatever scheme you want to identify your products. Ours is just a suggestion, but it works for us.

Reply Children
No Data
Related