Understanding Bluetooth LE UUIDs

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.

Read Using Bluetooth Low Energy (LE)

New Python Library

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.

New Nordic Semiconductor Wireless Q Magazine

Nordic Semiconductor, the manufacturer of the System on a Chip (SoC) in many beacons, has published the latest online issue of Wireless Quarter Magazine. It showcases the many uses of Nordic SoCs.

The latest issue of the magazine highlights the increasing use of IoT. Nordic Semiconductor has been known for enabling Bluetooth and cellular solutions and with their recent acquisition of Imagination Technologies this now extends to WiFi.

The magazine covers many usecases including:

  • Bluetooth connected prosthetics
  • CHIP smart home
  • Smart health

There’s also an informative article exploring the usefulness of patents.

Read about Beacon Proximity and Sensing for the Internet of Things (IoT)

Sensor beacons

Gateways

Understanding Bluetooth LE Reliability

We have previously written about Bluetooth LE on the Factory Floor and Why Bluetooth LE Scanning Doesn’t Always See Devices (the First Time).

There’s a new informative paper by Martin Woolley of the Bluetooth SIG on How Bluetooth® Technology Makes Wireless Communication Reliable. It describes in detail how radio collisions, multi-path propagation, time-dispersion, transmitter-receiver synchronisation, signal strength, receiver sensitivity and buffer overflow can collude to make radio communications unreliable.

The paper explains how Bluetooth modulation schemes, CRC checks, multiple channels, coded PHY, adaptive frequency hopping, flow control and the ATT protocol work to make Bluetooth LE reliable.

The paper also takes a look how Bluetooth Mesh has been designed to achieve reliable communication.

Why Bluetooth LE Scanning Doesn’t Always See Devices (the First Time)

Bluetooth devices such as beacons periodically advertise data according to a pre-defined format such as iBeacon or Eddystone. The advertising is very short, of the order of 1ms. Listening devices such as apps or gateways scan for a defined time, the scan window, periodically every scan interval. The scanning scan window is usually less than the scan interval to conserve power because scanning is power intensive.

While scanning nearly always sees a nearby device, there can be times when it isn’t seen due to physical and technical reasons. Radio signals can get blocked and reflected in ways that cause them not to be received. Also, if two Bluetooth devices happen to advertise at the same time then the received radio signal is corrupted. It’s also possible that because scans stop and start, the advertising happens when the scan isn’t running.

In practice the chance of non-detection happening is small. The chances of it happening again, the next scan, are very unlikely. If a beacon isn’t seen on the first scan it’s usually seen on the second (or third) attempt.

Bluetooth has some mitigations to help reduce the occurrence of the above mentioned situations. The advertising and scanning happens on multiple channels (frequencies) 37, 38 and 39 to reduce the affect of interference from other devices. Also, the advertising interval isn’t fixed and varies by a random amount, the advertising delay, for up to 10ms, to prevent two (or more) devices’ advertising continually colliding.

The consequence of scanning possibly not seeing beacons (the first time) is that solutions using apps or gateways must not rely on only one scan to make decisions on the absence of a beacon.

Advanced Bluetooth on Android

Martin Woolley of the Bluetooth SIG was a recent speaker at Droidcon EMEA where he spoke about Advanced Bluetooth for Android Developers (slides).

Android Bluetooth LE Stack

Martin covered scanning, GATT, how to maximise data rates, speed vs reliability and using different PHY for enhanced range or data rates. The second part of the talk covers Bluetooth Mesh and proxy nodes.

One thing not mentioned in the slides, to be careful of, is that connection via a proxy node is relatively slow because it’s limited by the GATT connection. Proxy nodes are good for controlling (sending small amounts of data into) a Bluetooth Mesh but poor if you want to use the connected Android device as a gateway for all outgoing data.

Martin also has a blog where you can also learn about his past talks and he will be part of the new Bluetooth Developer Meetup.

Read about Beacons and the Bluetooth Mesh

Bluetooth Developer Meetup

There’s a new (virtual) Bluetooth Developer Meetup group.

Developers will share their knowledge and tell their stories of working with everybody’s favourite low power wireless communication technology

The first event will be on 15th October 2020 at 17:30 UK time (UTC+1) and will include the following speakers:

  • Jacky Cheung, Google
  • Kevin Picchi, Samsung
  • Thea Aldrich, Foundries IO
  • Martin Woolley, Bluetooth SIG

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.