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

NRF51822 peripheral keep it invisible

Hi I am planning to use NRF51822. Have not used these parts yet.

I have 4 peripherals and 1 central hub. All communicating in BLE. And central hub will also connect to cell phone.

How can I have

  1. 4 peripherals connect to the hub automatically without any manual intervention. The hub need to scan for pre-defined names and connect to them. This should happen very first time, the devices are powered on.

  2. The 4 peripherals should NOT be visible on the cell-phone. Cell phone should only see one device which is the hub.

  3. During normal operation, I am thinking of keeping the peripherals and hub in lowest possible power state. But peripheral should be able to wake up the hub. Is that possible?

  4. All the 4 peripherals and hub will be with in 2meters distance. The hub may be able communicate to phone which is 10-20m away. But 4 peripherals can save power. Is such a mode possible?

Thanks Ashwin

  • FormerMember
    0 FormerMember

    1) When a central (the hub) scans for advertising devices it will receive the adverting data in advertising reports. It then possible to "inspect" the advertising report and check the name of the device, and then, if the name matches the pre-defined name, initiate a connection. That is what the ble_app_mulilink example in the SDK does, see the below code snippet from main.c:

    static void on_ble_evt(ble_evt_t * p_ble_evt)
    {
    uint32_t        err_code;
    
    switch (p_ble_evt->header.evt_id)
    {
        case BLE_GAP_EVT_ADV_REPORT:
        {
        ...
        ...
        ...
            // Verify if short or complete name matches target.
            if ((err_code == NRF_SUCCESS) &&
               (0 == memcmp(TARGET_DEV_NAME,type_data.p_data,type_data.data_len)))
            {
                err_code = sd_ble_gap_scan_stop();
                if (err_code != NRF_SUCCESS)
                {
                    APPL_LOG("[APPL]: Scan stop failed, reason %d\r\n", err_code);
                }
    
                // Initiate a connection if the name matches the pre-defined name:
                err_code = sd_ble_gap_connect(&p_ble_evt->evt.gap_evt.params.adv_report.\
                                              peer_addr,
                                              &m_scan_param,
                                              &m_connection_param);
        ...
        ...
        ...
    

    2) By using directed advertising, no other centrals then the one specified in the advertising data may initiate a connection. Directed advertising is described in the Bluetooth Core Specification v.4.2, Vol. 6, Part B, chapter 4.4.2.4.

    3) It is not possible for the peripheral devices to wake up the central device; when there is no connection, it is the central that scan for peripherals.

    To save as much power as possible you can use slave latency and the longest possible connection interval, see explanation in this thread.

    4) Yes, it should be perfectly possible to get 10 to 20 m range.

    Update 03.03.16: Another solution could be to combine BLE with another protocol. You can for example combine BLE with the Nordic proprietary protocol "Gazll". You can find an an example of that in the following folder in the SDK: ..\nRF51_SDK_10.0.0_dc26b5e\examples\multiprotocol\ble_app_gzll

    1. It is not possible for the peripheral devices to wake up the central device...

    This is an inherent part of the way BT works

    The 4 peripherals should NOT be visible on the cell-phone

    So why use BT for the 4 peripherals at all? Especially, as noted above, given that some of your requirements do not fit the way BT works anyhow?

  • Are there any alternate solutions possible? On the hub, I need the BT to connect to the phone. As such, I am thinking of using same BT to connect to the peripherals.

    Also, so far I did not come across a solution, where a peripheral can wake up another device. Even with NRF24, the the sleeping device need to wake in intervals scan for available transmits and go to sleep.

  • Of course there are many possible solutions!

    The NRF51822 can support other 2.4GHz protocols. I think it can do both BT and "proprietary" at the same time?

    Clearly, one device can only wake another if it is "listening"...

  • FormerMember
    0 FormerMember in reply to FormerMember

    Yes, @awneil says, it may be a better solution to combine the BLE with another protocol. You can for example combine BLE with the Nordic proprietary protocol "Gazll"- You can find an an example of that in the following folder in the SDK: ..\nRF51_SDK_10.0.0_dc26b5e\examples\multiprotocol\ble_app_gzll (I will update this in the "main" answer as well.)

Related