1

I don't know how to do it for multiple beacons. I would like a UDP server on Windows to be able to distinguish between beacons so that I can complete this project: Tools to determine exact location when using ibeacons

Getposition code:

float xa = beacon1.locationX;
float ya = beacon1.locationY;
float xb = beacon2.locationX;
float yb = beacon2.locationY;
float xc = beacon3.locationX;
float yc = beacon3.locationY;
float ra = b1;
float rb = b2;
float rc = b3;

float S = (pow(xc, 2.) - pow(xb, 2.) + pow(yc, 2.) - pow(yb, 2.) + pow(rb, 2.) - pow(rc, 2.)) / 2.0;
float T = (pow(xa, 2.) - pow(xb, 2.) + pow(ya, 2.) - pow(yb, 2.) + pow(rb, 2.) - pow(ra, 2.)) / 2.0;
float y = ((T * (xb - xc)) - (S * (xb - xa))) / (((ya - yb) * (xb - xc)) - ((yc - yb) * (xb - xa)));
float x = ((y * (ya - yb)) - T) / (xb - xa);

CGPoint point = CGPointMake(x, y);
return point;
}

UPDATE:

bc, address = sock.recvfrom(4096)  # buffer size
adres, sygnal = bc.split(b'|')  # split
x = adres.decode(encoding="utf-8") 

This is an answer for my question, thats how we can recognize our beacons.

MarekOS
  • 33
  • 4

1 Answers1

2

In the code shown on the Raspberry Pi, the following line of code filters for a unique Bluetooth MAC address. This will only ever give you the results of a single beacon transmitter:

if beacon.addr == 'd0:f0:18:44:0b:82':

If you remove the if statement, the Raspberry Pi code will execute for every device it sees (in essence all beacons) and send the info about every one to Windows.

On the Windows side, the code already receives the MAC address in the adres field. You can use this to distinguish between beacons.

A note of caution. Be very careful to read the comments and other answers in the question you mention: Tools to determine exact location when using ibeacons. The comments under the accepted answer suggest that the solution does not work reliably. (The author of the answer also suggests it will not work well.) Several of the other answers to the question (including one from me) also say that trilateration of bluetooth beacons is not practical in real world conditions. Feel free to experiment with this and find out how well it works yourself. However, if it is critical to you to make a working solution, understand that you will likely have to resort to other techniques.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • Hi, I tested this and it works very well. Any idea how to turn this now into a 3D location using 4 beacons? I could use someone to direct me slightly. – MarekOS Dec 06 '21 at 15:27
  • This is worthy of a different question posted on this site. Answering it is not my area of expertise. – davidgyoung Dec 07 '21 at 16:36