Is it possible to somehow determine via bluetooth at what distance (or direction) another bluetooth device is located? Ie, maybe through signal strength or something else ... I mean programmatically, for example, through an application on android. I read about android.bluetooth, but did not find anything interesting.

    2 answers 2

    It is theoretically possible, but in practice it will be necessary to run (literally).

    So, the sensor of the bluetooth in the phone is one, and it is non-directional. That is, he cannot determine the azimuth. You can learn the signal level (there is an example of a code ), but how to translate the level into meters for an unknown signal ... but not at all. Because the transmitters are from different phones of different power (you can, of course, determine the device at the mac address of the adapter and make a correction factor, but you don’t have enough configs on all devices). Secondly, the level itself can "jump."

    But if you really really want, you can do it. It is necessary to measure the level from several points and make a "triangulation". It can help a lot if there are several sensors in known places.

    Using gps to determine current coordinates is unlikely to work, since the accuracy of gps is usually 5-10 meters (and indoors is lower. Google is working on the bluepoint project, which allows determining the position in the room by wifi), and for bluetooth, which in phones, the maximum reach radius is also about 10-15 meters (yes, I know that some devices can take 100 meters, but as far as I know, this does not apply to phones).

    If the task is to “find a device” and not determine the coordinates, then this is much easier to do. The user is prompted to just go straight. The program monitors the signal level. While it rises - it means we are going right, if we started to go down - we move away. At this point, we propose to rotate 90 degrees to the right or left (and the accelerometer and gyroscope will help determine the distance traveled and the direction). As soon as the user passes a little, it will immediately become clear where the device is.

    Such options are possible:

    • the signal level increased, then decreased. After turning again increased and decreased. So the device is inside the corner. At two maxima you can hold perpendiculars and the intersection will give the position;
    • the signal level increased, then decreased. After turning decreases. So turned in the wrong direction. We propose to turn 180 degrees; :)
    • The signal level initially decreased - turn around 180 degrees and try from the very beginning.

    Let's summarize more mathematics and physics. It is known that the signal level falls inversely with the square of the distance. The signal level (rssi) is usually measured in decibels, and this is simply the logarithm multiplied by a constant. The logarithm of a square is just 2 times the logarithm of a distance. Therefore, the signal level will decrease according to the logarithm of the distance. Measuring the level in the process of walking and believing that it decreases by logarithm and circles (more or less), you can make a qualitative search.

    • Wow, thanks. It became more or less clear how this can be implemented :) - compl

    To use the BT parameters, it will be wrong in the root, the post above has a bunch of erroneous opinions (although I even put a plus). Example: taking two steps back or to the side of the signal source can, in theory, improve the signal, and all your calculations will be reduced to a bunch of errors, up to a turn in another direction. Use triangulation, really need to run, and if the distance is decent, and the zone has a lot of interference to move, the hour of running will give you absolutely dubious results, due to the fact that you need to move according to a specific algorithm depending on the signal strength, and here again the signal parameter very dubious figure, again a dead end. The author also writes that GPS will not work, I think just gps will be the most accurate written above, there are also more accurate navigation devices. But this is a completely different topic. I'll be brief. For conventional mobile devices, it is not possible with standard tools to determine a decent distance indicator, there are a lot of problems starting with a floating radio waves indicator, depending on the parameters of both devices, reception and transmission, and external factors, which are also very many, but there is another problem for you This is the SI that you need to create as you do not use any geolocation data. Having solved all these superficial problems one by one, you will meet a number of others, after which you will successfully approach the solution of your question. Although the topic is very interesting I put a plus sign.