advertising range extender

We have sensors that advertise their status to a main device using the NRF-Connect, which works fine.

In this arrangement, the central unit does not initiate connections; rather, the sensors solely advertise their status.

The challenge arises with certain sensors, where the signal strength becomes weak and unreliable, particularly at distances exceeding 50 meters. To address this, I am exploring the possibility of programming a repeater that can continuously scan and then rebroadcast every packet that meets specific criteria.

Is this a feasible solution?

Has anyone attempted something similar before?

I'm also open to the possibility that there might already be an existing solution to this problem.

Thanks

Johanan

Parents
  • Yes, it is certainly possible. You just need to set it up to scan for the advertising packets coming off your devices and update the advertising data on the repeater / relay. Wether or not this is feasible is a question of how much data you need to pass through the relay. If your sensors are sending tons of advertising packets really quickly, having several of them go through one relay will be difficult. I'm not going to post my full project, but hopefully this can guide you in the right direction. Disclaimer that some of this can probably be done more efficiently and you'll have to figure out the indexes for your application. This is based on a combination of several examples included in the SDK (notably ble_central_and_peripheral/experimental/ble_app_hrs_rscs_relay)

    Initialize the scan to filter for your devices, start the scan, and start advertising

    In your scan event handler (for case NRF_BLE_SCAN_EVT_NOT_FOUND in my application), pull the data from the advertising packet:

    for (i=0; i<mfg_data_len; i++)
    {
        mfg_data[i] = * (p_adv_report->data.p_data + i);
    }

    I have a static advertising buffer so I can write data in from multiple locations easily. Write the relevant data into the buffer and call the update handler:

    for (i=0; i<17; i++)
    {
        adv_buffer[i] = mfg_data[i+7];
    }
    
    adv_data_update_handler();

    Your update handler should look something like:

    static void adv_data_update_handler(void)
    {
        //Change advertising data
        ret_code_t                  err_code;
        ble_advdata_manuf_data_t    manuf_data;
    
    /* change these values for your application
        new_advdata.p_manuf_specific_data = &manuf_data;
        new_advdata.name_type = BLE_ADVDATA_SHORT_NAME;
        new_advdata.short_name_len = 5;
        new_advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
        
        manuf_data.company_identifier = 0xFFFF;
        
    */
    
        manuf_data.data.p_data = adv_buffer;
        manuf_data.data.size = sizeof(adv_buffer);
        
        err_code = ble_advertising_advdata_update(&m_advertising, &new_advdata, NULL);
        APP_ERROR_CHECK(err_code);  
    
    }

    You might need to play with the scan interval, scan window, and advertising interval values. I also had to set the link count values in sdk_config to 0 and APP_BLE_CONN_CFG_TAG to 0. 

    Hope this helps

    *Edited to correct a little inefficiency 

Reply
  • Yes, it is certainly possible. You just need to set it up to scan for the advertising packets coming off your devices and update the advertising data on the repeater / relay. Wether or not this is feasible is a question of how much data you need to pass through the relay. If your sensors are sending tons of advertising packets really quickly, having several of them go through one relay will be difficult. I'm not going to post my full project, but hopefully this can guide you in the right direction. Disclaimer that some of this can probably be done more efficiently and you'll have to figure out the indexes for your application. This is based on a combination of several examples included in the SDK (notably ble_central_and_peripheral/experimental/ble_app_hrs_rscs_relay)

    Initialize the scan to filter for your devices, start the scan, and start advertising

    In your scan event handler (for case NRF_BLE_SCAN_EVT_NOT_FOUND in my application), pull the data from the advertising packet:

    for (i=0; i<mfg_data_len; i++)
    {
        mfg_data[i] = * (p_adv_report->data.p_data + i);
    }

    I have a static advertising buffer so I can write data in from multiple locations easily. Write the relevant data into the buffer and call the update handler:

    for (i=0; i<17; i++)
    {
        adv_buffer[i] = mfg_data[i+7];
    }
    
    adv_data_update_handler();

    Your update handler should look something like:

    static void adv_data_update_handler(void)
    {
        //Change advertising data
        ret_code_t                  err_code;
        ble_advdata_manuf_data_t    manuf_data;
    
    /* change these values for your application
        new_advdata.p_manuf_specific_data = &manuf_data;
        new_advdata.name_type = BLE_ADVDATA_SHORT_NAME;
        new_advdata.short_name_len = 5;
        new_advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
        
        manuf_data.company_identifier = 0xFFFF;
        
    */
    
        manuf_data.data.p_data = adv_buffer;
        manuf_data.data.size = sizeof(adv_buffer);
        
        err_code = ble_advertising_advdata_update(&m_advertising, &new_advdata, NULL);
        APP_ERROR_CHECK(err_code);  
    
    }

    You might need to play with the scan interval, scan window, and advertising interval values. I also had to set the link count values in sdk_config to 0 and APP_BLE_CONN_CFG_TAG to 0. 

    Hope this helps

    *Edited to correct a little inefficiency 

Children
No Data
Related