How to Broadcast Multiple Ibeacon Signals from Only One Bluetooth? and How

Bluetooth LE / iBeacons - one radio, multiple broadcasts?

Yes, you can do this. On iOS devices, I have only been able to switch identifiers once per second, making it only practical to simulate transmitting two iBeacons simultaneously without getting CoreLocation exitedRegion callbacks.

See: Can I broadcast multiple ibeacon signals from only one bluetooth? and how

Other BLE capable devices may allow faster switching.

How to set iBeacon to broadcast a local notification only once for a single device?

You need to keep track of the times each beacon was detected in your didRangeBeaconsInRegion method and ignore certain beacons using a software filter if they have been seen recently.

An example of how to do this is shown here. The core of that is:

  - (void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLRegion *)region
{
for (CLBeacon *beacon in beacons) {
Boolean shouldSendNotification = NO;
NSDate *now = [NSDate date];
NSString *beaconKey = [NSString stringWithFormat:@"%@_%ld_%ld", [beacon.proximityUUID UUIDString], (long) beacon.major, (long) beacon.minor];
NSLog(@"Ranged UUID: %@ Major:%ld Minor:%ld RSSI:%ld", [beacon.proximityUUID UUIDString], (long)beacon.major, (long)beacon.minor, (long)beacon.rssi);

if ([beaconLastSeen objectForKey:beaconKey] == Nil) {
NSLog(@"This beacon has never been seen before");
shouldSendNotification = YES;
}
else {
NSDate *lastSeen = [beaconLastSeen objectForKey:beaconKey];
NSTimeInterval secondsSinceLastSeen = [now timeIntervalSinceDate:lastSeen];
NSLog(@"This beacon was last seen at %@, which was %.0f seconds ago", lastSeen, secondsSinceLastSeen);
if (secondsSinceLastSeen < 3600*24 /* one day in seconds */) {
shouldSendNotification = YES;
}
}

if (shouldSendNotification) {
[self sendLocalNotification];
}
}
}

Sending only one iBeacon Packet

Yes, you can use iBeacon technology to send information back and forth between two iOS devices without pairing. If you have two devices, Device A and Device B, you set both of them up to range for beacons with a common ProximityUUID, say, E2C56DB5-DFFB-48D2-B060-D0F5A71096E0. And then you can exchange information in the two byte major and minor fields.

What you can't do is control the transmitter enough to send only a single iBeacon advertisement. The transmitter in iOS sends out 10 advertisement packets per second, so the best you could do is start the transmitter then stop it on a timer about 100ms later. (You probably shouldn't do this, because there is no guarantee that a single iBeacon advertising packet will be received successfully by the other device -- it may be lost due to a CRC error in the radio noise. You are probably better off letting the packet continue to transmit until you can confirm from a response from the other device that it was received.)

You can see an example of starting and stopping a transmitter on a timer in my answer here.

Of course, there may be easier and more robust ways of accomplishing what you want with built-in Bluetooth data exchange mechanisms. But that doesn't change the fact that what you propose is certainly possible.

How does an iBeacon/sender/receiver handle collisions?

There are no hard limits, but you will begin to see reduced performance when you have hundreds of beacons transmitting in the same radio range.

There are two limits you will run into with beacon density:

  1. Radio collisions. Bluetooth chipsets avoid collisions in their advertisements by slightly randomizing when packets are broadcast and waiting to transmit when another signal is detected on the same channel. At high densities (100s of transmitters in range), this will start to reduce the number of packets that get sent out making beacon receivers get fewer packets. At first, this means fewer samples for distance estimates yielding poorer distance estimates. Ultimately, it causes delays in detections. See: https://electronics.stackexchange.com/questions/21991/how-many-active-bluetooth-devices-can-i-reliably-detect-in-a-single-space

  2. Receiver processing limits. Different receivers will start dropping Bluetooth packets when they cannot keep up due to processing limits. As @heypiotr notes, faster processors (both in the Bluetooth chipset and the mobile device main CPU) can successfully get more packets and track more beacons. An iPhone 4S device can track around 100 beacons before some get dropped. Newer devices can track more.

BLE Advertisement switch interval & advertising interval

The fastest I have been able to reliably switch between two BLE advertisements on iOS is 1 second. See my answer and sample code here.

The standard iOS iBeacon advertising frequency is 30 Hz, but in my experience, you only need to transmit an iBeacon advertisement every 900ms for fastest detection. More frequent advertisements are still useful for more accurate distance measurements, as iOS uses samples of RSSI from the iBeacon advertisements to make this estimate every second when ranging.



Related Topics



Leave a reply



Submit