Upon arriving at our Frankfurt location, I see from the monitor panel at the reception that Jane is in the office, so I’ll pop in to ask a question.
We’ve been able to do this for quite a while now with OwnTracks, but due to GPS location as reported by mobile phones being what it is, the accuracy is sometimes off by up to a thousand meters, and we wanted to be able allow you to pinpoint people more precisely. Instead of relying solely on the location your smart phone thinks you are at, small, and relatively inexpensive iBeacons can pinpoint you down to a few meters. OwnTracks for iOS has had support for iBeacons for a few releases now, and it works very reliably.
Pictured above is a blukii SmartBeacon /H which comes in many different form factors, battery or mains powered, small or large, etc.
Beacons use Bluetooth low energy to transmit a UUID (typically modifiable) together with user-defined major and minor numbers, and these allow us to identify, say, a particular room in a building or even a specific corner of a room. The major number can be used, say, to identify an office building, whereas you’d configure a beacon’s minor number to identify a room within that building. Alternatively, if you don’t want to bother with identifying rooms, you can e.g. set all beacons to have the same major and minor numbers.
Let’s assume the office we’re discussing has a few beacons. Let’s further assume we do not want to track people within a particular room; instead we just want to capture whether an employee is in this particular office building. We can configure all beacons with the same UUID, and we will ignore the major and minor numbers. (How a beacon gets it’s UUID, major, and minor set depends on the product.)
We define a UUID, say,
DEADBEEF-ABBA-CDEF-1001-000000000001 which we assign to all beacons, and configure them accordingly. (This is what the Blukii utility (Windows only) looks like.)
What we then do is configure a waypoint within the iOS OwnTracks app. The values for latitude/longitude are irrelevant. What is important is the UUID separated from the name of the beacon (I chose
*Main@WestWing here) by a colon. A beacon’s major and minor are optionally concatenated to that string, also colon-separated.
Instead of painstakingly configuring this on the device proper, I prepare a small file called
.otrw extension is important), with the following JSON payload:
I then either place that file on a Web server, or e-mail it as attachment to my colleagues who open that on their OwnTracks device, and presto: the device has the beacon monitoring regions configured.
From this point on, OwnTracks monitors all beacons with that particular UUID, and it will publish an
leave event whenever the device gets within range of a beacon or leaves it. Additionally, the device shows the event with a local iOS notification.
We publish these events as JSON via MQTT to the MQTT broker the device is connected to, and from there, you consume the message and do as you please.
For instance, send an e-mail when a particular person leaves the building, publish a list of people who remain in the building on a monitor (as above), etc.
To summarize: OwnTracks can monitor beacons by configuring it either with:
- a UUID only, in which case the app would report any beacon with that UUID, irrespective of its major/minor numbers.
- a UUID with a major number: the app would report iBeacons with the specified UUID and exactly that major number
- all three: the UUID, the major and minor numbers, in which case the app reports events on precisely that beacon.
The app recognizes the beacon typically within 10 seconds, which is a typical beacon-publishing frequency, and this is very good for presence detection.