When connecting to Bluetooth devices such as beacons via GATT, APIs are used to connect to specific Bluetooth Services and Bluetooth Characteristics. Services and Characteristics are identified by 128-bit UUID values written as 00000000-0000-1000-0000-000000000000 where each digit is a hexadecimal number. For example, an app might connect to a Service with id D35B1000-E01C-9FAC-BA8D-7CE20BDBA0C6 and then read and write to a Characteristic with id D35B1001-E01C-9FAC-BA8D-7CE20BDBA0C6.
In practice, an interface usually uses similar UUIDs that only change in the xxxx part of the UUID: D35Bxxxx-E01C-9FAC-BA8D-7CE20BDBA0C6. There’s usually a base UUID such as D35B0000-E01C-9FAC-BA8D-7CE20BDBA0C6 and only 16-bits values are provided in the interface documented description.
Here’s an example from the Meeblue beacon documentation:
The Meeblue base UUID is D35B0000-E01C-9FAC-BA8D-7CE20BDBA0C6. When it’s said the UUID is 0x1000, the actual UUID is D35B1000-E01C-9FAC-BA8D-7CE20BDBA0C6.
When we started BeaconZone, our aim was to encourage new scenarios beyond the over-hyped and under-successful retail marketing scenarios.
One of the issues with retail marketing with beacons is that it requires opt-in through the installation of an app. This is a large barrier if you are considering users who are ambivalent about using specific apps and beacons. The only way it’s usually viable is if you are a large brand who already has an app on customers’ smartphones.
The more interesting and successful uses of beacons involve scenarios that are ‘want-in’ or B2B rather thanconsumer ‘opt-in’. Here are just a few examples of where our beacons are being used:
Policing. There’s a move to what’s called evidence-based policing requiring proof of which police have visited which locations. Trials are taking place to replace paper based reporting with beacon-based automation.
Tours. Beacons have been purchased for use on guided walks and with museum information kiosks.
The Elderly. Several of our our customers are using beacons to keep track of elderly people in care homes and hospitals.
Smart Offices. Several of our customers are using beacons to enable the whereabouts of workers and equipment in smart offices including read time monitoring of room occupancy. We also have clients using beacons with checkin/out type applications.
Asset Tracking. We have two large-instrument manufacturer are using beacons for tracking assets. We also have a customer using beacons and gateways to track bicycles. Our beacons are also being used extensively at many sites that track location using Motorola TRBOnet two-way radio.
Events. Our long range beacons are being used outside for tracking BMX bike trials and power efficient beacons inside large arena events.
Gaming. Ingress players use our beacons.
Automotive. A large UK car manufacturer is using our beacons. Another customer, an undertaker, is using beacons with a car driving monitor app to log the time spent driving.
Security. Our beacons are being used in security systems at several sites including lone worker SOS scenarios.
Utilities. One of the largest UK water authorities is investigating the use of sensor beacons.
Insurance. We have customers using beacons for in-car presence detection.
Health. Our beacons are being used in apps/systems that help visibly impaired people find their way around buildings. Sensor beacons are being used in hospitals to monitor the temperature of refrigerated medicines.
Research. Our beacons have also been purchased by Google, Mozilla and many UK universities for use on their research projects.
Beacons have a multitude of further real uses waiting to be explored and exploited.
Most use of Bluetooth LE and beacons only looks at the transmitted advertising containing identification and sensor information. More advanced use requires connection to the device using GATT to write, read and be notified of changes in values (Bluetooth Service Characteristics). The most common use for connecting is to set configurable settings as in the case of device manufacturer smartphone apps.
Some solutions need to manipulate Bluetooth Service Characteristics programmatically. Barry Byford has a new Pyton library BLE-GATT for Linux based devices. It’s based on the BlueZ D-Bus API, features a small number of dependencies and can be easily installed without sudo privileges.
We recently came across TracerPlus, a system that allows you to scan and collect Eddystone and iBeacon data into forms on iOS and Android.
A desktop application builder is used to design the forms:
The system can be used to efficiently take inventory and capture additional data from beacons for example, unique identifiers for items, battery life, temperature and URL information.
TracerPlus provides semi-custom mobile applications at a fraction of the cost of custom software.
Solutions usually detect and store contact events between Bluetooth devices that has poor interoperability when applied to smartphones. Adoption rates are also low due to privacy concerns and resultant systems depend on subsequent manual contact tracing.
Instead, a new architecture is used that comprises standard beacons carried by users and detectors placed in strategic locations where infection clusters are most likely to originate. [This is similar to the architecture used for IoT sensing using gateways.]
The system helps control disease spread at lower adoption rates. It also provides significantly higher sensitivity and specificity than existing app-based systems.
It provides details on Bluetooth communication options and covers GAP, GATT and advertising. It shows how to work with Bluetooth Service Characteristics and use standard Bluetooth LE Profiles.
“Where Can I Find a Beacon Solution that Does xyz?”
Where xyz could be one of many things. Unfortunately, we don’t have a full knowledge of what’s out there, particularly because it’s continually changing.
We maintain a BeaconZone Solutions Directory where we list solutions we have found in the categories of marketing/retail, industry/logistics, buildings/staff, visitor spaces, transportation, education and personal.
Reading and writing to a characteristic’s value and/or monitoring characteristic value change via a Notify
Each of these stages is asynchronous because each takes a relatively long time in computing terms. This means the code needs to call something but continue running to remain responsive to other events and later process the result of a stage via a callback from the Bluetooth library. The connection isn’t reliable because it’s wireless. Different kinds of failure, also notified via callbacks, require the code to go back one or more stages depending on the severity of the error.
All this gets very messy, confusing and difficult to understand in the resultant code. Reactive (Rx) programming attempts to solve such asynchronous complexity problems by using the Observable Pattern to broadcast and subscribe to values and other events from an Observable stream.
There are Reactive implementations such as RxSwift on iOS and RxJava on Android. There are also Bluetooth specific libraries such as RxBluetoothKit for iOS/OSX and RxAndroidBle that make asynchronous Bluetooth code in Swift/Java much easier to understand and maintain.
Reactive programming used to be very popular not just for asynchronous programming but also for general Android programming. It has fallen out use for general programming mainly due to Kotlin which is now the ‘latest thing’.
Naive developers have a tendency to want to use the ‘latest thing’ or ‘clever techniques’ while experienced developers choose the right tool for the job. A common error is to over-use and combine design patterns, such as observables, in simple scenarios, which hinders rather than simplifies understanding.
The nature and relative complexity of your project should determine whether it’s worth using Reactive code. It’s not necessary an ‘all or nothing’ decision. It’s possible to choose to use observable pattern techniques only in parts of code with extreme asynchronous complexity rather than in all the code.
This research looked into optimising the location of sensors as opposed to the more usual methods of filtering signals to improve accuracy. The aim was to reduce deployment costs by deploying more sensors in critical areas that were identified as needing greater positioning accuracy.
The critical-grid coverage scheme and NSGA-II algorithm were used to optimise the placement of iBeacon nodes in underground parking lots.
Cybele bridges Bluetooth Low Energy devices to MQTT on Linux devices. MQ Telemetry Transport Protocol (MQTT), invented by IBM, is an ISO standard that uses lightweight publish/subscribe messaging to send data to a server.
Cybele is written uses Node.js and BlueZ. It’s written in Javascript and available at GitHub.