How Bluetooth gateways use triangulation algorithms to enable indoor asset management and tracking?

Principle

Three-point positioning, as the name implies, requires three points. These three points are generally base stations. Whose position is being determined? Generally, the position of the client or terminal. By measuring the distance between the terminal and the base station (there may be errors in this measurement process, so let’s assume there are no errors), use it as the radius of the three circles, draw a picture, and finally find the intersection of the three circles. The intersection is the terminal position, achieving the positioning effect. As shown in the figure. Point O in the figure is what we are looking for.

bluetooth gateway

Next, consider the case of measurement error. The following situation is easy to occur in the actual measurement process. In this case, the intersection is an area. As shown in the figure, the intersection of the three circles is the BCE area.

triangulation algorithms

How to solve this problem? Let’s first consider the case of two circles. Here we first find the coordinates of point C.

bluetooth asset tracking

Two circles (center is the base station location, radius is our measurement data, i.e. the distance from the terminal to the base station) intersect at points A and B, connect AB, PQ, AQ, AP, AB and PQ intersect at point C, the distance PQ of the center of the circle is known after the base station is arranged, the center of the circle and the radius are known, the coordinates of points A and B can be obtained by simultaneous equations, and then PA and AQ can be obtained according to the Euclidean distance. According to the Pythagorean theorem:

Three-point positioning

beacon bluetooth

 

Obtaining coordinates based on proportional relationships

ibeacon gateway

Calculating the three circles in pairs can get three points. Then we can take the average of the coordinates of these three points as the coordinates of the terminal.

In addition, there may be a situation where the following circles do not intersect.

eddystone

How to solve this problem? Let’s first consider the case of two circles. As shown in the figure. Now we find the point O.

ble tag

 

The simple method is to calculate directly based on the proportional radius.

wifi gateway

Similarly, we will eventually get three points, and take the mean of the coordinates of these three points as the coordinates of the terminal.

 

 

Code

struct Point

{

int x; //x coordinate

int y; //y coordinate

Point() :x(0), y(0) {};

};

 

//Three-point positioning method

//dis: radius

//points: center of circle

Point threePoints(float *dis, Point *ps)

{

Point p;

if (dis == NULL || ps== NULL)

return p;

 

for (int i = 0; i < 3; ++i)

{

//Check if there is a problem with the distance

if (dis[i] < 0)

return Point();

 

for (int j = i + 1; j < 3; ++j)

{

//Distance of center of circle PQ

float p2p = (float)sqrt((ps[i].x – ps[j].x)*(ps[i].x – ps[j].x) +

(ps[i].y – ps[j].y)*(ps[i].y – ps[j].y));

//Judge whether the two circles intersect

if (dis[i] + dis[j] <= p2p)

{

//If they do not intersect, calculate according to the proportion

p.x += ps[i].x + (ps[j].x – ps[i].x)*dis[i] / (dis[i] + dis[j]);

p.y += ps[i].y + (ps[j].y – ps[i].y)*dis[i] / (dis[i] + dis[j]);

}

else

{

//If they intersect, apply the formula

//PC

float dr = p2p / 2 + (dis[i] * dis[i] – dis[j] * dis[j]) / (2 * p2p);

//x = xp + (xq-xp) * PC / PQ

p.x += ps[i].x + (ps[j].x – ps[i].x)*dr / p2p;

//y = yp + (yq-yp) * PC / PQ

p.y += ps[i].y + (ps[j].y – ps[i].y)*dr / p2p;

}

}

}

 

//Three circles are divided into two groups, and finally three points are obtained. Find their average

p.x /= 3;

p.y /= 3;

 

return p;

}

 

HoneyComm Bluetooth Gateway can be applied into hospital, elderly home, school, prison, office, factory and parking lot etc.

bluetooth gatewayoutdoor ble gateway

About Us

We have established in 2014, ByteRFly is our Original Brand. We are a leading supplier of wireless modules and Smart IoT solutions provider with a 20yrs technical-experienced engineering team.

Latest Posts

GET A FREE QUOTE NOW!

Contact Form Demo (#3)
Scroll to Top

GET A FREE QUOTE NOW!

Contact Form Demo (#3)