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

Nrf52 slow scanning

Hi

I have made ble scanner using nrf52 and I have set uart baud rate 921600 and sending scanned beacon to other micro-controller for processing but It does not scanning all beacons.

I have around 100 beacons now and it takes around 10 seconds to scan all beacons(100) I have set beacon interval to 500ms.

Is nrf capable to scan all beacon that broadcasted?

I need to scan around 5000 beacons. is it possible to scan and send all beacons? if yes, then how much time it will take to scan and send 5000 beacons?

Parents
  • Hi

    Endnode has already covered the issues of having multiple advertisers in the same area, so I will focus only on your specific use case.

    Sending a single advertise packet with 20 bytes of data takes about 350us.

    If 5000 advertisers in perfect synchronization sent one packet after each other this would take 1.75 seconds in total.

    In other words, if the advertising interval is lower than this then there is no way to fit all the advertise packets, there simply isn't enough time available. In practice the advertising interval would have to be significantly larger, to reduce the chance of packet collisions.

    The chance of a collision between an advertiser and one particular other advertiser is approximately (2*L)/I, where L is the length of the packet and I is the interval of both advertisers.
    The chance of colliding with one (or more) among a number of advertisers: PL = 1 - ((1 - (2*L)/I)^N)

    With an interval of 1.75s this leads to a packet loss of 86% with 5000 nodes in the same area. Increase the interval to 10s, and packet loss drops to 30%, which might be acceptable.

    Still, it is hard to predict how long it will take to read all the beacons. Scanning for 10 seconds should allow you to read 70% of the available beacons, following the same example. If you read for 10 seconds more you get 70% of the remaining 30%, and so on, but to be guaranteed that every single device is read you need to scan for a long time ;)

    Best regards
    Torbjørn

Reply
  • Hi

    Endnode has already covered the issues of having multiple advertisers in the same area, so I will focus only on your specific use case.

    Sending a single advertise packet with 20 bytes of data takes about 350us.

    If 5000 advertisers in perfect synchronization sent one packet after each other this would take 1.75 seconds in total.

    In other words, if the advertising interval is lower than this then there is no way to fit all the advertise packets, there simply isn't enough time available. In practice the advertising interval would have to be significantly larger, to reduce the chance of packet collisions.

    The chance of a collision between an advertiser and one particular other advertiser is approximately (2*L)/I, where L is the length of the packet and I is the interval of both advertisers.
    The chance of colliding with one (or more) among a number of advertisers: PL = 1 - ((1 - (2*L)/I)^N)

    With an interval of 1.75s this leads to a packet loss of 86% with 5000 nodes in the same area. Increase the interval to 10s, and packet loss drops to 30%, which might be acceptable.

    Still, it is hard to predict how long it will take to read all the beacons. Scanning for 10 seconds should allow you to read 70% of the available beacons, following the same example. If you read for 10 seconds more you get 70% of the remaining 30%, and so on, but to be guaranteed that every single device is read you need to scan for a long time ;)

    Best regards
    Torbjørn

Children
Related