When choosing the scan length for your Bluetooth device you are balancing the power usage and accuracy. If the scan is too short you may miss nearby tags but if it is too long you are wasting power.
Finding the Balance
The first thing you must consider is how often your Bluetooth tags advertise their data. This is called the "advertisement interval" and can typically be configured or found in the device's datasheet. You should ensure that the Bluetooth scan length is at a minimum the size of the longest advertising interval used by your devices. You may require a longer scan time than the longest advertising interval as interference from other devices could mean tags are missed.
The next thing you must consider is whether you are using multiple scanning technologies (see here). If you are using both long range and standard Bluetooth then you should at least double the scan period.
We have three different tag types:
- A Guppy which has an advertising interval of every 1 second
- An Eddystone tag which has an advertising interval of every 5 seconds
- An iBeacon which advertises every 100 milliseconds
Clearly the longest advertisement period is 5 seconds. We want to reduce the chance of missed data so should set the scan period as a multiple of 5 seconds. We test a scan period of 5, 10, 15 and 20 seconds, and find 5 and 10 seconds occasionally miss these Eddystone tags but 15 and 20 seconds work consistently. We therefore set the tag scan time to 15 seconds to reduce power consumption.