Inversion is a great thing! Invent something one thing, and then take it and turn it inside out, you will get an equally interesting result. At first I did this with one thing, and only then I saw that in TRIZ (the theory of solving inventive problems) there is such a technique “inversion or inverse analogy”. Live and learn.
But this is all theory, and practice puts everything in its place ...
Bluetooth Low Energy beacons or iBeacon are no longer something out of the ordinary. They can be found at train stations, airports, museums and shopping centers. As a radio engineer, I participated in the design of lighthouses and, in particular, antennas for them. The point is, at first interesting, then it becomes boring. There is nothing to stand out, you will not invent anything particularly new. And then it dawned on me!
I took my direction finder ( one and two times ) and looked at it from the back. And what if to make it a beacon? Here we need to remind the reader that this direction finder consists of two antennas: one with a smooth radiation pattern, the other with a rapidly changing one.
This is a cut of the radiation pattern. In 3D, it looks like this:
The direction finder "induces focus" on the difference in the levels of these two antennas. If you are interested in detail, you can look at Github .
Here are small code snippets with the logic of the direction finder:
We get levels from both antennas. The resulting levels are required to average, and then calculate the difference. In fact, this is not a difference of signals, but their attitude. But if measured in decibels , there will be a difference.
public boolean handleInfo(WFPacket data) { if (data.apName.equals(ssid) && data.mac.equals(mac)) { int idx = data.antIdx; if (0 <= idx && idx <= 1) { mLevels.get(idx).addLast(data.power); while (mLevels.get(idx).size() > avgCount) { mLevels.get(idx).removeFirst(); } needRecalc = true; print(); } else { Log.d(TAG, "LevelCalculator.HandleInfo() Bad rcvIdx: " + data.antIdx); } } else { return false; } return needRecalc; }
public double getAvg() { if (needRecalc) { for (int idx = 0; idx < 2; idx++) { double sum = 0d; for (Double x : mLevels.get(idx)) { sum += x; } int count = mLevels.get(idx).size(); if (count != 0) { sum /= count; } avgLevels[idx] = sum; } avgDiff = Math.pow(10.0, (avgLevels[1] - avgLevels[0]) * 0.1 + 2.5); // needRecalc = false; } return avgDiff; }
Handling the "difference". If the levels on both antennas differ "strongly", then we are directed to the source with some accuracy (plus or minus bast). What is this "strongly" at the moment determined scientific method experimentally.
private void updateLevelDiff(double levelDiff) { long deltaTime = System.currentTimeMillis() - lastUpdateTime; int progress = (int) Math.floor(100.0 * levelDiff); // // if (deltaTime > TIME_PERIOD) { // if (progress < mThreshold) { // , addBearing(); numUpdates++; } lastUpdateTime = System.currentTimeMillis(); } // GUI }
And now we INVERT!
Let an iBeacon beacon with one number be radiated to one antenna and another with another. Then, on a mobile device, you can measure the levels of both beacons and determine from the difference how close it is to the focus of the beacon antennas. It turns out the positioning in the direction of arrival of the wave.
The standard Bluetooth version 5 even announced a similar method of high-precision positioning - Angle of Departure. They have not yet reached the exact description of this method, they promise in the next versions.
In the refined form, the work can be illustrated with rollers: once and twice .
The application sets the threshold for the difference in levels, by which it is determined that the mobile device is in an imaginary cone with an axis coinciding with the normal to the plane of the antenna.
The lighthouse itself looks like this:
But the renders of the viscera:
Handsome, is not it? Inside the antenna, as in the direction finder WiFi, and Bluetooth SoC nRF51822. But all was in vain ...
Further, the story goes to the facs, which is that it works on the Nexus 5 smartphone and finding another gadget that works at least that way was not very easy. No, they are, Samsung Galaxy S7, Lenovo Phab 2 Pro, and the list ends for now. More "good" gadgets found from friends and acquaintances failed. From the "bad" can be noted Samsung S4 mini.
Of course, the lighthouse was tested. It emits packets on two antennas in turn with a minimum interval. A small interval is needed so that the measurements relate to points in time that are slightly separated from each other. Otherwise it will not be possible to relate them to each other.
A log was recorded from a Bluetooth sniffer using the wonderful WireShark. Log analysis shows that everything is emitted correctly, time intervals and levels are normal. The oscilloscope also showed nothing unrecorded at the exit of the lighthouse.
However, on a large number of gadgets it works poorly. The problem is measurement loss. In the Android application was built diagnostics of receiving pairs of packages. Quality score was made percentage of paired packages. So, the indicator from 80 to 100 was observed only on some gadgets. On the rest of the tested sample of mobile devices, the indicator was from 20 to 60. In motion, the level ratio was not measured accurately. There was an attempt to compensate for this by increasing the radiation frequency of the packets, but this did not work. Something inside the Android interferes with normal measurements.
Sources of this outrage are available on Github .
There is little hope that the situation on iOS can be better. At least more homogeneous on the range of mobile devices.
There is also hope that there will be a specialist who will understand what the problem is and prompt a solution.
And now I am very sorry that this idea does not work.
Source: https://habr.com/ru/post/343136/
All Articles