Beacon Detection in Swift - swift

I am building an app in swift that helps me detect beacons and display their RSSI values. I was using the native CoreLocations library from apple to detect beacons but noticed that the rate of detection is set to 1 second and it cannot be changed. Is there a way to reduce the detection interval to say 100-500ms so that I can get more RSSI values?

You can also use CoreBluetooth APIs to detect beacons, which give you a separate RSSI measurement for each packet detected. For a beacon advertising at 10 times per second, this would give you an RSSI update approximately every 100ms.
There are two big catches to using CoreBluetooth:
It cannot detect iBeacon because Apple blocks it. CoreBluetooth can detect AltBeacon and Eddystone.
The API is harder to use with beacons — you have to parse out the identifiers from the packets manually.
Also, be aware that the RSSI value returned by CoreLocation once per second is actually an average based on all packets received over the previous second, so it is more stable than individual samples taken at a higher frequency. Depending on what you want the samples for, you may find the higher variation is a problem.
Finally, be aware that the max rate at which you get samples with CoreBluetooth depends on the beacon transmission rate. Some beacons advertise only once per second. If you are working with such a beacon, you will not get any more samples with CoreBluetooth.

Related

Detect which room you are in with BLE Beacons

We are trying to set in place a system of indoor localization based on BLE Beacons. The precize location of the client does not really matter, the valuable information is the room he is in.
The building to be equipped has large concrete walls. We thought that using one beacon per room, we could detect the closer beacon to the guest.
Are concrete wall able to stop most of the BLE signal? We tried some tests, but we are searching for serious studies.
Any wall will reduce BLE signals by some amount. A signal of -50 dBm on one side might be -60 dBm on the other side, a reduction of 10 dB. Because decibels are logarithmic, every 10 dB reduction in the signal level represents a loss of 90 percent of the power in the signal. So while it is typically true that a concrete wall will "stop most of the BLE signal", it doesn't really matter because there may still be enough signal on the other side of the wall to detect the beacon.
How much of a reduction in signal level there is depends on thickness of the wall and other materials in it (metal will increase the attenuation.) Of course, windows, doors and other breaks in walls provide other paths for the signals to travel and complicate the issue.
Since you are unlikely to create a system where signals from beacons in one room will never be detected in an adjacent room, your best bet is to use other algorithms. For example, you may detect all visible beacons in a time interval, determine which has the highest signal strength, and if above a certain threshold, use this as an indicator of which room you are in.

Estimote: Change update interval to 5 Hz

I'm using the Estimote SDK (3.6.0) for the communication with my beacons. Now I have read somewhere, that it is possible to get the advertisement package of the beacons with 5 Hz. Is this only possible with Estimote beacons or does this work with beacons of other vendors too?
Where can I change this update interval in the source code?
Thanks.
Each beacon vendor usually provides some means to adjust their beacons' settings. Most often, that's in form of an app that you can download from the App Store or Google Play Store. In this particular case (Estimote), that'll be an app is simply called "Estimote." For more details, you should consult the vendor's documentation or inquire with their support team (:
One final thought: with Estimote Beacons, you operate on advertising interval of the beacon (i.e., the time between packets being broadcast) instead of frequency. Since one is just an inverse of the other, 5 Hz frequency (= 5 times a second) is equivalent to a 200 ms interval.

iBeacon: Get advertisement package faster

In my app I get the information of the beacons with CoreLocation and and the LocationManager.
I've set the advertising interval of the beacons to 200ms.
Is it possible to call the didRangeBeacons delegate method faster, so that i get the values of the advertising package according to the advertising interval of the beacon?
No, you cannot alter the frequency of the didRangeBeacons:inRegion callback, which is 1 Hz regardless of the beacon advertising frequency.
You can get callbacks for each beacon advertisement (every 200 ms in your case) using CoreBluetooth APIs, but there are a couple of restrictions:
It will not work with iBeacon transmissions as iOS blocks access to iBeacon advertisement data in CoreBluetooth. You can use AltBeacons, which are iBeacon compatible, and get the more frequent updates with those. You can buy beacons that send out both iBeacon and AltBeacon transmissions.
It will only work in the foreground. You cannot get Bluetooth LE manufacturer advertisements in the background on iOS.
Full disclosure: I am Chief Engineer at Radius Networks which sponsors the open source AltBeacon standard.

Controlling GPS sampling on iPhone

I have two questions regarding GPS sampling on iPhone:
1.Is it possible to use CLLocationManager (or any other method) for location readings based on GPS alone without WiFi or Cellular network affecting it?
2.Given a stationary device, is it possible to control the sampling rate? Can I use CLLocationManager to get nonstop location readings from GPS in nanoseconds resolution? If not, what's the best resolution I can get?
regarding number 1, apparently, you cannot directly control gps data. having said that: if you have speed > 0 AND high accuracy, then you can infer that your data has a high probability of having come from a gps reading.
as far as i know, gps fixing is not measured in nanoseconds, but rather in seconds. what you mean exactly by resolution (reading frequency?) is a bit unclear. but, if it is frequency, most navigational software (google, for example) refreshes location every second or so.
hi frequency position updating is very costly in terms of storage cost (server side), query times (server side), battery use (iphone) and heats the phone up bigtime. i would be going in the opposite direction, especially for stationary devices (sending a heartbeat every 5 minutes or so is usually more than enough).
reference on CLLocationManager

Is iPhone Proximity detection possible with Bluetooth?

Would it be possible to fill a building with 20 - 30 bluetooth devices that act as proximity detectors and write an app that can calculate location in the building based on distance from the current detected sensors.
I've looked at the GameKit API, but I don't see anything about calculating distance from devices.
Can someone point me in the direction of an Apple API, or a 3rd party API that can be used for this kind of application.
We don't get the low level BlueTooth or WiFi control that would be required to do this. So unless you jailbreak you can't.
Low level Bluetooth can provide RSSI and Trasmit power level at the maximum for any kind of proximity indications.
As I understand it is extremely difficult to calculate the distance from these reliably.
Location services is surprisingly good at estimating location even in a residential area with only secured wireless APs detectable. But how you would add your APs into that DB, I don't know.