📜 ⬆️ ⬇️

How lighthouses work: iBeacon Physics Technology



In our first publication, we presented a review and comparison of the whole range of iBeacon beacons available on the market. Today we will take a closer look at how the Bluetooth beacon works on the example of our European colleagues, and let's talk about how it can be used to calculate the location inside the building.

What is inside


Despite the global coverage of iBeacon technology in the media, business and developer communities, it seems that there is some level of misunderstanding about how it works. Now we will try to fix it and delve into the basics and explain what the beacons are and how they work.
')
How do beacons work? The principles of their work are quite simple. Under the silicone case is a small ARM computer connected to the Bluetooth module — they are powered by a battery. A small chip from Nordic Semiconductor contains firmware - this is part of the low-level software that guarantees the correct operation of the beacons. Although processor and memory computing power is limited, it is more than enough to process sensitive data and encrypt ID beacons (to increase security).

On the tapered part of the beacon there is a short wire that goes directly from the processor - this is an antenna. The broadcast antenna emits waves of a certain frequency and length: 2.4 GHz radio waves. If you disassemble the beacon, you will notice that the antenna does not resemble the antennas of old televisions and radio receivers. And it's not just about size. It has a curved shape and looks like a zigzag.

This is done for a reason. The electromagnetic field around the straight wire takes the form of a donut - the waves do not propagate with the same force in all directions, which leads to the formation of "empty" zones. The best solution is to change the shape of the antenna so that the electromagnetic field takes the form of an ideal sphere. However, in real conditions this cannot be achieved, therefore a lot of research is carried out for this purpose. There are a huge number of books on antenna theory, and we conducted our own experiments to make our antennas produce a powerful and stable field.



Source: MIT

For communication, beacons use Bluetooth Smart technology. This is the latest low-power Bluetooth standard designed for transferring small amounts of data. The maximum packet size for Bluetooth 4.2 is 257 bytes. This is not enough to transfer media content, so beacons transmit only their IDs (in the case of the iBeacon protocol, the ID is divided into three parts: UUID, Major, Minor) and information about the strength of the emitted signal — this parameter is necessary to calculate the distance to the smartphone.

Mathematics and physics


The transmission distance and stability of the beacon signal depend on two main factors: the transmission interval (frequency) and the strength of the broadcast. The beacon does not transmit signals all the time - it works impulsively. Frequency is the time elapsed between two consecutive data transfers. The higher the frequency, the more accurately the signal is determined.

This is done because smartphones also “look for” beacons, scanning the air with a certain frequency, and this frequency may depend on the state of the phone (locked, unlocked). The type of OS and device also matters. If the phone is active, it will scan with great frequency; if you put it in your pocket, after a few minutes it will start to save battery power and limit the number of Bluetooth scans.

For Estimote beacons, the time between pulses is 950 ms, but it can be changed in the range from 100 to 2000 ms. Standard frequency is not chosen by chance. On average, iOS scans the area for beacons 1 time per second. 950 ms is almost equal to this value. In a sound-proofed room, the sent packet may not reach the device (or something / someone will block the direct visibility of the smartphone and the beacon). To increase the stability of the connection, you can increase the frequency of shipments.

If you set the interval to 490 ms, two packets will be transmitted in one scan by the smartphone. If you set the interval to 330 ms, three packets will be transmitted in one scan; 240 ms is four packets and so on. If the first packet was not received by the device, there is a chance that it will accept the rest. It is important to remember that the increase in the number of packages sent leads to a decrease in battery life.



In addition to the frequency should take into account the strength of the broadcast. It describes the signal strength and is measured in dBm (decibel milliwatts). dBm is the absolute power level in decibels relative to the reference level of 1 mW. The working distance of the beacon directly depends on the broadcasting power. It is impossible to say at what distance the radio waves propagate, since there is no definite point in space where they simply stop. For example, a light bulb, it illuminates a certain area around itself, but the light goes much further, scattering. The same thing happens with radio waves.

The closer you are to the beacon, the more accurately the distance is calculated - this is due to the greater signal density in the vicinity of the source. As you move away, the signal becomes more diffuse and distorted until it becomes indistinguishable from background noise. To better understand the concept, imagine that the beacon is a radio receiver, and the strength of the broadcast is the volume level.

If you increase the volume, you can hear the music from a distance, and, coming closer, you will hear it more and more clearly. But if the volume is very low, it may be difficult to recognize the melody, even if you put your ear directly on the speaker. However, knowledge of the exact volume level in decibels does not make it possible to perfectly determine the distance at which sound will be heard. Too many factors affect this: from obstacles (physical matter through which waves must penetrate) to the characteristics of hearing.



Distance calculation


You already know that the smartphone will be able to calculate the approximate distance to the beacon after “hearing” it. To do this, the phone reads the so-called RSSI (Received Signal Strength Indicator) - the power indicator of the received signal, and then compares it with the signal level measured at 1 meter from the transmitter, which is delivered as part of the transmitted data packet. So the smartphone calculates the approximate distance to the beacon. A distance of 1 meter was chosen specifically: as mentioned above, it is much easier to obtain accurate values ​​at close distances due to the higher signal density.

We have written the rules by which the distances to the beacons are calculated, but, as usual, in practice everything is not so simple. Let's go back to the radio example: Imagine that you put the radio not in the room, but in the middle of a noisy train station. The radio plays at full volume, and you can easily hear it when you are nearby, but you can’t determine its exact location - people are scurrying back and forth. In addition to people, arriving and departing trains make noise, the dispatcher announces landings - all this distorts the sound, so you cannot say with certainty how far you are from the receiver.

It is impossible to calculate the exact location of the beacon only on the basis of the received radio waves. Here you do not interfere with the train and dispatcher, and the multiplicity of routes of wave propagation, diffraction, absorption and interference. Remember, we said that it is impossible to design an antenna that propagates a signal in all directions with the same force? Because of this, the mutual orientation of the lighthouse and the smartphone in space can affect the approximation: the RSSI readings vary greatly.

If the beacon is located at a distance of 10 meters from your smartphone, the application can show the number 8, then guess and assume a distance of 10 meters, then report about 12 meters, go back to 7 again and again to 10 ... well, you understand. If you turn the phone, the system may decide that you are 2 meters closer to the beacon.

We have analyzed the principles of operation of the iBeacon technology on the example of the description of the action of Estimote beacons. And now we want to tell you more about how indoor navigation works using technologies developed in Navigine .

Indoor navigation: Navigine comment


Location services for iOS are governed by the Core Location framework, of which iBeacon is a part. The iBeacon standard was not designed to calculate the exact distance to the beacon and operates only with zones. There are four types of zones: close proximity (very close to the beacon), close (1-3 meters from the beacon), far (an area where the signal fluctuates too much, and it is impossible to determine the distance more accurately) and it is not known. The Core Location Framework allows you to activate the desired events in each zone.

For small rooms, such as a cafe or restaurant, this will be enough, but what if you want to get the exact location on an area of ​​thousands of square meters, for example, in a warehouse, an industrial enterprise or a shopping center?

So, the question remains: is it possible to build a reliable indoor navigation service using iBeacon-beacons? In short, yes, you can. In more detail, it is for this reason that any hardware infrastructure is only part of the navigation systems. Taking as a basis the simple and cheap iBeacon infrastructure, our knowledge and approaches to indoor navigation (which we talked about in short here , and will soon tell you more), we at Navigine developed a service that allows us to determine the position inside the room in the absence of satellite signals.

The service is based on our integrated inertial navigation algorithms with a wide range of additional (corrective) information based on optimal estimation methods using Bayesian type filters.

To maximize the scope, we process the following set of additional information:


As a result of the work of the navigation algorithms, the output is a point on the map in the mobile application. In the ideal case, the positioning accuracy will be 1 meter (1 σ).

Just a year ago, testing indoor navigation based on iBeacon-beacons required a long and boring process of removing a radio card. Now enough to note where the beacons were installed on the map. We have an iOS / Android SDK, which you can test by registering on the site , plus some of the algorithms are available on GitHub ( our repository ). Fork on health.

Source: https://habr.com/ru/post/269735/


All Articles