Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Triangulate example for iBeacons

I am looking into the possibility to use multiple iBeacons to do a 'rough' indoor position location. The application is a kind of 'museum' setting, and it would be easier to be able to form a grid with locations for the different objects then individual beacons (although that might not be impossible too).

Are there examples, experiences, with using multiple beacons to triangulate into some kind of location, or some logic to help me on the way to write it myself?

like image 869
Luuk D. Jansen Avatar asked Dec 02 '13 16:12

Luuk D. Jansen


People also ask

How do I find iBeacons?

To identify each iBeacon, an iBeacon is identified using three numbers: Proximity UUID (16-bytes), Major (2 bytes), and Minor (2 bytes) (see Figure 1). Figure 1: Three numbers are used to identify an iBeacon . The assignment of these three numbers is totally up to the implementers.

Which communication protocol is used by iBeacons?

iBeacon is just a Bluetooth protocol whereas beacon is a common name for a device that transmits iBeacon or Eddystone protocols. iBeacon does not collect any data - it is a protocol received by mobile apps that can with a user consent track certain information.

What is Bluetooth triangulation?

2-Dimensional triangulation 2-D triangulation uses relative location information to measure the location of a desired user. 2-D triangulation is a key technology in 2-D positioning system because it calculates the location based on (x, y) coordinates which are the important factor in 2-D positioning system.

How do I set up iBeacons?

Go to Settings in the app menu. Tap on iBeacons. Select your iBeacon (If there is more than one in the area, you can identify yours using the 4-digit code on its side) If you have more than one vehicle in the app, choose the one you'll use the iBeacon for from the dropdown menu.


1 Answers

I have been making some experiments to get a precise position using three beacons.

Results of trilateration

Unluckily, the results were very disappointing in terms of quality. There were mainly two issues:

  1. In non-controlled environments, where you can find metals, and other objects that affect the signal, the received signal strength of the beacons changes so often that it seems impossible to get error range below 5 meters.
  2. Depending on the way that the user is handling the receiver device, the readings can change a lot as well. If the user puts his/her hand over the bluetooth antenna, then the algorithm will have low signals as input, and thus the beacons will supposed to be very far from the device. See this image to see the precise location of the Bluetooth antenna.

Possible solutions

After talking with an Apple engineer who actively discouraged me to go down this way, the option I feel more inclined to use right now is brute force. Try to set up a beacon every X meters (X being the maximum error tolerated in the system) so we can track on this beacons grid the position of a given device by calculating which beacon on the grid is the closest to the device and assuming that the device is on the same position.

Trilateration algorithm

However, for the sake of completeness, I share below the core function of the trilateration algorithm. It's based on the paragraph 3 ("Three distances known") of this article.

- (CGPoint)getCoordinateWithBeaconA:(CGPoint)a beaconB:(CGPoint)b beaconC:(CGPoint)c distanceA:(CGFloat)dA distanceB:(CGFloat)dB distanceC:(CGFloat)dC {     CGFloat W, Z, x, y, y2;     W = dA*dA - dB*dB - a.x*a.x - a.y*a.y + b.x*b.x + b.y*b.y;     Z = dB*dB - dC*dC - b.x*b.x - b.y*b.y + c.x*c.x + c.y*c.y;      x = (W*(c.y-b.y) - Z*(b.y-a.y)) / (2 * ((b.x-a.x)*(c.y-b.y) - (c.x-b.x)*(b.y-a.y)));     y = (W - 2*x*(b.x-a.x)) / (2*(b.y-a.y));     //y2 is a second measure of y to mitigate errors     y2 = (Z - 2*x*(c.x-b.x)) / (2*(c.y-b.y));      y = (y + y2) / 2;     return CGPointMake(x, y); } 
like image 111
Javier Chávarri Avatar answered Sep 23 '22 23:09

Javier Chávarri