
According to the original idea, the article was supposed to be called “Easy way to leave to sleep”, but who will surprise you now? So, under the cut a small story awaits you about how our team introduced indoor navigation through iBeacon on the territory of RIF + KIB 2014, as well as about all the packs and other adventures we encountered along the way.
Foreword
In a nutshell, it’s worth talking about technology. iBeacon is a small bluetooth beacon that can transmit information about its identifiers (UUID, major, minor) to surrounding devices. A person with an installed application comes up to the beacon, the smartphone receives data about it and sends it to us to the server. We find this beacon in our database and send the user coordinates on the ground. Naturally, if the user is in sight of two or three beacons, we can determine his location more precisely.
All of the above is very convenient indoors - where GPS can not provide a sufficiently high accuracy for navigation.
Of course, this technology opens up a lot of amazing opportunities, and our team with great enthusiasm took up the development of a platform and a mobile SDK for working with beacons.
Part 1. Preparation
Having played enough with several test samples of beacons, having prepared the first versions of the configuration service and the iOS SDK, we felt the strength to do something more. It was the end of February, the RIF + CIB conference looked like an excellent option for the first major launch: it was two months before it, and this hoo, anything can be done in such a time frame, right?
')
It was necessary to have time:
- understand how many beacons you need, purchase and receive them;
- find or prepare some kind of tool that will allow you to batchly set up a whole bunch of beacons (give them the correct identifiers, indicate the power and frequency);
- develop an iOS application for conference participants;
- substantially complete the web platform;
- and a trifle - to come to the place and set the correct beacons at the correct points.
The test copies of the beacons that were at our disposal were far from being as good as those about which they now write so much on the net: they beat at a distance of 5-10 meters, and not at all at 50, while they all worked a little differently and not very stable. But their low cost and our optimism were decisive factors - it was decided to order them for the conference.
Having received from the organizers an approximate map of the exhibition, as well as a small piece of the architectural plan with indicated dimensions, we began to think over the optimal location of the beacons.
The problems began when it was discovered that the architectural plan, the drawn map of the event and the view of the same place on google maps resemble each other only in separate places. The contours, proportions and sizes of buildings were obviously different.
Get a more accurate map was not possible.
Of course, the best solution would be to go there about a month before the conference and independently figure out the scale, manually correct the map, think over the best points to place the beacons. But at that moment we decided to calculate the required number of beacons approximately and throw something “on top” in some way.
Another major difficulty was setting beacons. The fact is that for the devices we chose there was an iOS application that allows you to see all the available beacons and set up each one by typing them manually using the on-screen keyboard in the form of hexadecimal values. It was absolutely not suitable for setting up two hundred beacons. In this regard, one of our developers took up the creation of a tool that allows you to get the entire list of visible beacons, specify the necessary settings and relax, watching how the beacons get these settings and have a funny wink at the blue diode. It was March and everything went according to plan.
The preparation of the mobile application itself and the web interface for navigation control on the RIF went perfectly until the last moment.
Part 2. RIF + CIB
After our arrival in Moscow 2 days before the event, events developed rapidly, each few hours revealing new unforeseen circumstances.
Circumstance 1
It turned out that it is difficult to assemble beacons from parts, and when there are 200 of them it is even more difficult. Parts of the case do not fit together well; printed circuit boards do not quite fit the lid into which they need to be inserted.
In general, for a couple of hours we looked like inexperienced employees of an underground Chinese factory. But the deed was done: the batteries were inserted, the printed circuit boards were securely driven into the enclosures, and the front and back covers were connected as much as possible. Victory.
Circumstance 2
Contrary to our hopes, it turned out that the program for batch tuning of the heap of beacons works stably only if the heap size is <= 10 pcs. But we were not going to give up.
It was only necessary to think of a way to somehow get rid of the signal of the extra 190 beacons when setting up the next batch: everything got lost if the program cut more beacons than was required.
Remembering that the range of the beacons is not so great, we just carried the bag with them to the next room and ... were shocked to find that the current party worked much better than the one we had a month ago. The signal remained excellent anywhere in the apartment.
I did not want to remove the batteries: too much irreplaceable effort was invested in the assembly. One absolutely reliable shielding method was experimentally developed: a bag of beacons was placed in a thick-walled cauldron and closed with a lid, and the cauldron was placed on the bottom of a cast-iron bath.
Having run all night with a bunch of beacons in the bathroom and back, by 5 am we finished setting up.
Circumstance 3, climax
Despite minor technical difficulties, the installation of beacons on the territory of the future exhibition was very cheerful. We arranged them according to a previously prepared plan, and practically did not have to move away from it.
Having installed about 100 pieces, we decided to check the navigation. While the person with the bag of beacons ran off for several tens of meters from the hull (the cauldron and the shielding bath were not at hand), the other had to walk along the hull with the phone and follow the navigation in the application.
The result was terrifying. The application showed that the user is marking time all the time somewhere in the northern part of the building. This corresponded to an error of 5-10 meters and it was unacceptable.
A couple more experiments - the same result.
This panic is experienced by a student who pulled out an unfamiliar ticket on an important exam. So feel in the face of almost imminent failure. We settled in some empty room and began to think. One of the developers (
grohman )
turned circles around the hall, from time to time glancing at the application, until he noticed a simple thing that for some reason did not immediately occur to us. The coordinates of the location were calculated correctly, but the map itself was shifted south of the real coordinates, which gave such a distortion in the location map.
With the good old method “by eye” we selected an amendment for all coordinates transmitted to the application. Everything fell into place.
Circumstance 4
Soon we were replaced by another part of the team (
itruf ,
suprum ). Having sent us to rest, they were going to place the remaining beacons and finally to start everything. After an hour and a half later, they called with bad news: the location does not work again, and this time the distortions appear and disappear suddenly, the error amounts to several tens of meters. Being on our feet for almost two days, we stared at the monitor frantically, watching fantastic throwing “pins” of location on the map.
Analyzing tons of logs, we managed to find an amazing thing: in the list of beacons visible to the device, from time to time came across the beacon # 68, which in that place should not be visible. Soon the true suspicion crept in, and we asked the guys to go to the place where that beacon should be installed and see what happened to it. Naturally, he was not there.
Someone peeled off # 68 from the wall and walked with it in his pocket, from time to time creating a kind of “presence effect” for the system.
Turning off data processing from this beacon, we again received decent data on the location, but we were faced with the question of how to deal with such situations the next time.
The following solution was implemented: each beacon has “neighbors” - other beacons located at a distance <= N. When the user sends us data about visible beacons and signal level (rssi), we select the beacons with the largest rssi and check whether the other beacons are their neighbors. If we find a beacon, which obviously should not be a neighbor here, we exclude it from the calculation of the location. The location worked well again.
Total
Then there were some more urgent bug fixes, three days of the conference, a lot of interesting people and events. Despite all the passions in the last days of preparation, we were able to launch indoor navigation with the help of BLE beacons, demonstrated (yes, we were convinced ourselves) that it works. For ourselves, we were able to draw several conclusions:
- Testing "in miniature" will never replace testing in combat conditions. Check navigation on several beacons even in a spacious room - not enough to be sure that navigation will work with two hundred beacons per 1000 square meters
- saving time and effort on planning is a very bad saving option. If we paid more attention to the accuracy of the map from the very beginning, we would not have to adjust the coordinates manually on the last evening.
- to attach beacons to double-sided tape - not reliably
- several sleepless nights are not so big a payment for the opportunity to realize the first in the country so large-scale project of navigation on BLE beacons We got an interesting and unusual experience and we hope that we will soon tell you about new projects introducing indoor navigation and more.
In the comments we will be happy to answer questions about the implementation details.