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

Understanding the roles of central / peripheral in terms of unique application

So I have my custom board up and running (nrf51822) pluged into the nrf51DK with RTT debug comm and uart comm working, also starting some initial experimentation.
I'm trying to understand the roles of central and peripeheral devices and my use case kind of falls inbetween.
The goal being that the custom device will pair with a phone and be searching for other identical devices in proximity using advertising data, (within a foot)  and when they come in contact with eachother they will each share less than a few hundred bytes of information, disconnect and then relay the exchanged info back to their paired phones. (each device is used with one unique phone)
Please forgive my misunderstanding I'm trying to understand BLE and how it works.
I have two questions about this:
1) If i have a device looking for other identical devices within a radius, do i have to have every device basically listening or in receive mode constantly 24/7?  I'm unfamiliar on a hardware level how the device "finds" other devices initially.  when a device sends out a advertising data once every few seconds, does a receiving unit already have to be "primed" to scan on the advertising channels or are they always listening somehow?
2) and also is each device a central or peripheral in this case?  Can two identical peripherals detect eachother, establish connection and not step on each-others toes?     
If anyone can guide me to any resources that would be appreciated. I've found some starter BLE tutorials on youtube and im following the SKD examples but  I see a lot of very high level information and a lot of very low bit level ble information but im getting a bit lost on common ble procedure/setup and for BLE "works"
Again, any help is greatly appreciated. 
Thanks!
Parents
  • Hello,

    1)

    You have to tell the device to scan. But you can do this while you are advertising. Just look in any of the ble_central examples on how to set up scanning. Scanning window and scanning interval are two keywords you should look up.

    2)

    Well. a peripheral is the device that is advertising, while the central is scanning. However, as I mentioned, you can act as both in one device. however, if both the devices are identical, you do risk of getting two connections between the same two devices, where both devices has a link where it acts as a peripheral, and another link where it is the central. Maybe it helps to just tell the device that it should not request a connection if it is already in one, but you will have to test this.

     

    If you want to check out the simultaneous scanning and advertising, I suggest you look at the example found in:

    SDK\ble_central_and_peripheral\experimental\ble_app_hrs_rscs_relay

     

    For the big data transfers, you will have to enter a connection (a couple of hundred bytes will take some if you only use advertising.The rest looks like you can do only with advertising.

     

    Best regards,

    Edvin

Reply
  • Hello,

    1)

    You have to tell the device to scan. But you can do this while you are advertising. Just look in any of the ble_central examples on how to set up scanning. Scanning window and scanning interval are two keywords you should look up.

    2)

    Well. a peripheral is the device that is advertising, while the central is scanning. However, as I mentioned, you can act as both in one device. however, if both the devices are identical, you do risk of getting two connections between the same two devices, where both devices has a link where it acts as a peripheral, and another link where it is the central. Maybe it helps to just tell the device that it should not request a connection if it is already in one, but you will have to test this.

     

    If you want to check out the simultaneous scanning and advertising, I suggest you look at the example found in:

    SDK\ble_central_and_peripheral\experimental\ble_app_hrs_rscs_relay

     

    For the big data transfers, you will have to enter a connection (a couple of hundred bytes will take some if you only use advertising.The rest looks like you can do only with advertising.

     

    Best regards,

    Edvin

Children
  • Great info, Thanks,

    I'm curious if there is any clever tricks to save power if i have a continuous scan window.    Since the device only needs to transmit when in range of less than 1-2ft but not any further away. unfortunately I can't request user input (e: button presses etc to initiate scanning) it needs to just be scanning constantly.

    I see that the receive power is locked to 31ma? there's no way to decrease that?

  • Unfortunately, scanning is a power consuming task, as it needs to turn on the radio for a significant amount of time, unlike advertising or being in a connection. This is why cellphones or other devices with larger batteries usually acts as the central device.

    I don't know how sensitive your devices need to be. If you can afford that the devices don't need to connect immediately, you can have a shorter scanning window. I am not sure whether you have seen this advertising blog post.

    As you can see there, the detection of an advertisement requires that you scan while the advertisement is sent. Unfortunately, you can't say that you only want advertisements from devices closer than 2 feet, but you can check the RSSI to get a rough distance. You need to test a bit to see what RSSI values that is equivalent to 2 feet. 

    I can't say what advertising and scanning intervals you should use, but keep in mind that the more the radio on the scanning device is on, the more battery it uses.

     

    Let us say that you advertise every 1s, then you could scan for 1 second every 10s or so. but I don't know if that is too long of a scan interval, if two devices passes by one another in less than 10s.

     

    BR,

    Edvin

     

Related