Exercising Bluetooth LE GATT

Beacons send most of the time periodically advertising the same data. For setup, apps usually connect to them to set settings such as the advertising period, unique id and power level. The connection is performed using standard Bluetooth GATT.

Bluetooth LE devices connect to others via GATT. Devices such as fitness trackers and our social distancing beacons are regularly connected to, to download data. It’s also common to connect to sensor beacons to extract sensor data.

GATT is usually used via compiled code and it can be time consuming to test GATT devices and/or subsequently use the GATT interface in a flexible way. Should you need to do this, take a look at Bleak GATT client software capable of connecting to Bluetooth LE devices acting as GATT servers. It provides an asynchronous, cross-platform (Windows 10, Linux, Mac) Python API to connect and communicate with Bluetooth devices.

Understanding Bluetooth LE Advertising

There’s a new video of the Nordic Semiconductor webinar on Everything you need to know about Bluetooth LE advertising. It covers the basics of Bluetooth LE including advertising and data formats. It explains how to use the nRF Connect SDK API and provides a demo. It also shows how to use nRF Sniffer to examine Bluetooth LE data packets.

Bluetooth LE Advertising Channels

The presentation and Q&A are also available.

The video mentions advertising extensions. These are only in Bluetooth 5. Most current devices only support Bluetooth 4.2 legacy advertising. Growth in numbers Bluetooth 5 devices has been limited due to the non-compatibility with the majority of smartphones. It’s for this reason that devices that are Bluetooth 5 usually communicate using, backward compatible, legacy advertising. Extended advertising is also an optional feature of Bluetooth 5.

Developing for Bluetooth LE

If you are developing code for Bluetooth LE, a great place to start is the GitHub bluetooth-low-energy topic.

GitHub currently lists 877 public repositories that cover every operating system. This includes programming with Java, Javascript, C, Python, C++, Swift, Kotlin, C# and Objective-C.

In many cases it’s best to use the repositories to see how to do things rather than use the libraries themselves. Most, but not all, libraries are thin layers over operating system APIs. Most libraries don’t get updated and it’s otherwise easy to later get trapped into dependencies you don’t need, particular ways of working or old ways of using the underlying OS.

App cross platform frameworks are another source of problems when programming Bluetooth LE. They also aren’t updated often nor provide optimal Bluetooth APIs. If you wish to ease Bluetooth LE development and retain flexibility for future changes then use the native programming languages and libraries.

The Bluetooth Industry Report

When using a technology such as Bluetooth LE, it’s wise to look wider and keep up to date with the latest industry news. Mohammad Afaneh of Novelbits has a weekly Bluetooth Industry Report with news on new products, solutions and articles.

Novelbits also provide courses and technical services. Their blog has Introductions to Bluetooth Low Energy, Bluetooth Mesh and analysis of specific devices.

Bluetooth Standards Pros and Cons

Here at BeaconZone we create solutions based on products that use Bluetooth LE. The Bluetooth standards are created and maintained by the Bluetooth SIG. This post briefly explores the advantages and disadvantages of such standards and the opportunities and risks of going off-piste using 3rd party wireless standards.

The main advantage of the Bluetooth LE standard is interoperability. We can use beacons, sensor beacons, smartphones, gateways, single board computers such as the Raspberry Pi, laptops and desktops in solutions and be sure they can communicate using Bluetooth LE. More specifically, we can use the Bluetooth APIs on these platforms and they speak a common language and ‘just work’. Bluetooth has also recently introduced standards on top of the Bluetooth LE standard that provide for mesh networking and angle based location.

The Bluetooth LE standard has caused the ecosystem of System on a Chip (SoC) vendors such as Texas Instruments, Nordic Semiconductor and Dialog Semiconductor to create inexpensive sub-systems and SDKs that simplify implementing new products based on the standards. This, in turn, has created a large variety of devices that can talk to each other even though they use hardware from different vendors. The variety of devices has increased competition, keeping device prices down.

The problem with standards is that they evolve very slowly and might not be optimal for specific situations. This creates an opportunity for 3rd parties to create alternative wireless solutions such as Ultra Wideband (UWB) devices, custom mesh networking and custom location schemes that can provide better performance in aspects such as accuracy, physical range and battery life. These custom products cost more because they are more involved to create/manufacture and their unique features can command a higher price. However, there’s the risk that if/when the companies producing these products go out of business, your solution will become end-of-life with no second sourcing. This is a particular risk when the product involves some sort of software as a service (SAAS), irrespective of standards.

Choosing a wireless technology for your solution involves a trade off between performance, cost and risk. It’s wise to first seek a standards-based and stand-alone (not SAAS) approach and only deviate if you find what you need to do isn’t served by available solutions.

Making More Sense of Bluetooth Advertising Scans

When working with Bluetooth beacons and/or gateways and looking at raw Bluetooth data it can often become confusing which device is which. When setting up beacons using manufacturers’ apps, it’s a common occurrence for our customers to mistakenly connect to smartphones or fitness trackers rather than a beacon and wonder why the connection doesn’t work.

RaMBLE is a useful Android app that helps decode the Bluetooth devices around you. It attempts to classify devices so you can identify them:

The scanning runs in background and also logs advertising so that the data can be exported for analysis.

Concurrent Transmission (CT) Bluetooth

There’s new research BlueFlood: Concurrent Transmissions for Multi-Hop
Bluetooth 5 — Modeling and Evaluation
(pdf) that looks into using concurrent transmissions (CT) with Bluetooth.

Today’s Bluetooth devices use advertising, GATT connection and mesh. Advertising occurs over three channels to reduce the affects of wireless interference. When more than one device advertises at the same time, the data is lost. However, advertising takes of the order of 1ms so the chance of collision is usually small.

In contrast, BlueFlood uses concurrent transmissions (CT) that purposely synchronise transmissions such that if colliding packets are tightly synchronised and have the same contents, the resulting signal might be distorted, but highly probable that they do not destruct each other. This is used with the Glossy flooding protocol and 40 rather than 3 advertising channels.

CT-based protocols achieve enormous performance gains in terms of end-to-end reliability, latency and energy consumption even under harsh interference conditions

Concurrent transmissions are challenging using Bluetooth because transmissions need to be synchronised down to 250ns. Nevertheless, the researchers show this is possible using standard Bluetooth PHY and commercial Nordic SoCs. They achieved an end-to-end loss rate below 1% and managed to receive the signals on a standard smartphone. While the mechanism was fragile it was found to be viable.