Working with GATT on Android

Most of the time, beacons transmit and the receiving software such as apps on iOS and Android or applications on single board computers (SBC) only read the advertising data. There’s no connection to the beacon. However, for programmatic setup of beacon parameters or accessing some sensor data, applications might need to connect via what’s known as Bluetooth GATT.

There’s an article on How to Work Properly With BT LE On Android. It provides some useful pointers such as not performing scanning and GATT connection simultaneously, avoiding auto-connect and not blocking GATT callbacks.

GATT can be unreliable on Android. While scanning for advertising data usually works very well, we have found that GATT connections fail all the time on about 5% of devices. This is due to poorly implemented OS Bluetooth software. This means beacon manufacturer-supplied configuration apps sometimes can’t connect. The only solution is to use a different phone (or the iOS version of the app on iPhone).

3 Things to Consider when Planning a Bluetooth Beacon Deployment

Location

The primary consideration when siting beacons is the location. Beacons work best when there’s a line of sight. If the beacons are static and received by devices such as smartphones then the best position is higher up where they won’t be blocked. If the beacons are moving, the receiver, for example a gateway, is best placed overhead. When thinking about the location of static beacons, also consider camouflaging them or placing them out of reach so that they don’t become victim to theft.

Attachment

Think about how you will attach the beacons. Many beacons come with a strong double sided 3M-branded tape. While this can work, the glue or underlying surface can fail in the long term due to the affects of heat and moisture. Also, it can be difficult to remove or replace a beacon in the shorter term without damaging the surface decoration.

i3 has lugs for screw fixing

Tidier methods include screwing to the surface or plastic tie fixing that can be more suitable for attaching to some types of structure.

Maintenance

Although batteries can last years, think about how how battery levels will be measured and the physical and IT processes needed to replace a beacon.

FSC-BP103 Advertises Battery Level

The ease of physical maintenance is also related to beacon location and how they have been attached.

‘Wearable’ Category and Lanyards

Since the Covid pandemic, when many organisations needed to determine room occupancy, it has become more acceptable to use beacons for tracking people. For example, health is just one industry where tracking remains vital, for example tracking vulnerable patients and determining the location of care providers.

lanyard_smaller

There’s an increasingly number of scenarios where beacons are being worn. In order to facilitate this we have a wearable category and also stock lanyards.

Beacons Don’t Transmit Content

It’s often mentioned by the press and even some platform providers that beacons can transmit content, for example text, images or other multimedia content to smartphones. People contacting us expect this to happen (without an app) and we end up spending a lot of time explaining how it really works.

Beacons don’t send content to phones and instead they send an id (or URL) that an app uses to get content from a server. This doesn’t work without an app.

Related to this, some researchers have looked into the possibility of sending images from beacons.

Creating an iBeacon Using Zephyr

There’s a new article at the Linux Foundation on Developing Bluetooth Low Energy applications with Zephyr RTOS: Dissecting an iBeacon example.

This article is more useful than it might first seem. Zephyr isn’t just another Linux operating system (OS) but is the chosen OS for developing Nordic Semiconductor’s latest system on a chip devices (SOCs) that form the basis of the majority of shipping Bluetooth beacons. Previously, Nordic Semiconductor had their own OS delivered through nRF5 SDKs but development is being moved to the Zephyr-based nRF Connect SDK.

iBeacon advertising

The iBeacon article explains how to broadcast an iBeacon advertisement and what to change to alter the various Bluetooth advertising parameters.

View iBeacons

Indoor Positioning Using iBeacon and ESP32

Bluetooth beacons advertising iBeacon can be used to perform indoor locating using trilateration. Trilateration is where three receivers are used to measure signal strength (RSSI) to calculate the position.

It’s possible to use ESP32 single board computers as Bluetooth receivers. The GitHub project iBeacon-indoor-positioning-demo has an example open source implementation. There’s also an accompanying blog post.

The implementation uses MQTT to send the data to a React app on a server where it’s displayed on a floorplan.

In practice, you might want to consider creating a more robust solution that uses Bluetooth gateways rather than ESP32 devices. There’s also the Bluetooth AoA Direction Finding standard that’s more accurate than using RSSI.

Fixing Poor Bluetooth Beacon Radio Signals

In most cases beacons ‘just work’ but it’s sometimes the case that beacon detection is erratic. A beacon might be detected but not all the time. Problems can be due to the strength and/or quality of the received signal. The first step is to quantify the signal strength so you can measure it at various distances and beacon positions. The post on Testing if a Beacon is Working explains how to use an app such as nRF Connect to measure signal strength (RSSI) using a smartphone.

nRFConnect detecting beacons

If you are not getting a large enough signal at longer distances then try increasing the transmit power. This is labelled ‘Tx power’ in most setup apps. Make sure it is at least 0dBm and increase it to +4dBm for a longer range. Note that changing from 0dBM to +4dBm will reduce battery life by over a half. Another option is to use a beacon with a longer range.

Minew setup tx power

Another reason for poor detection is blocking of the line of sight. The degree of blocking depends on the blocking material. The post on What Can Block Beacon Signals? provides more information.

If beacon detection is erratic irrespective of the distance you need to look into the relationship between how often the beacon is advertising vs how often the receiver is listening. The post on Why Bluetooth LE Scanning Doesn’t Always See Devices (the First Time) provides a detailed explanation. This kind of problem can often be solved by decreasing the advertising period. This is sometimes labelled ‘Advertising interval’ as in the above example screenshot. Again, reducing this by, for example, a half will halve the battery life. It needs to be 600ms or less if iOS is to reliably detect beacons.

It’s rare but there’s also the possibility of too many Bluetooth signals advertising at the same time. You can learn more in the articles on Managing Bluetooth LE Advertising Congestion and The Affect of the Number of Beacons on the Detection Time.

Beacons and Driving

We are seeing more and more customers using beacons in driving-related scenarios. Most are using beacons to trigger when the user gets into or out of a vehicle. For example, driversnote tracks your trips ready for your mileage claim. However, apps such as this are for personal use and there’s a larger market and opportunity in company/fleet management. For example, mileagecount has an automated mileage capture system based on beacons.

The key thing here is that beacons are being used to trigger something, mileage capture in this case. It’s automated, unobtrusive and doesn’t necessarily produce app notifications. There’s a very large number of similar usecases in other industries waiting to be explored.

Aventri Event Apps Use iBeacon

Aventri is an all-in-one event platform that allows enterprise companies to run engaging in-person, virtual and hybrid events.

Their mobile event app can detect beacons placed at strategic locations across the event, for example, at each booth. The iBeacon can cause the app to show an automated message when a visitor is in range of a booth. It also allows you to silently measure foot traffic at the event.

Read about Beacons in Events and Visitor Spaces

View iBeacons

Rechargeable Bluetooth Beacons

Bluetooth beacons can last a long time on battery power, up to 5 years in some cases. However, long battery lifetimes require larger batteries that are more bulky and result in devices that are less suitable to wear.

The smallest beacons, most suitable for wearing, have small CR2032 coin cell batteries that can only typically last of the order of a few months. The solution is to use rechargeable beacons. They all charge via some sort of USB, either plugin, via a clip or magnetic connector.

The iB001W, supporting iBeacon and Eddystone, comes with a small charging cradle that plugs into the beacon.

The H1 Wristband is waterproof and has an acceleration sensor that supports motion triggered broadcast to save battery life. It charges via a clip.

The F1 is waterproof and has an acceleration sensor for motion triggered broadcast and also has a SOS button. It charges via a magnetic connection cable.

The B10 has an acceleration sensor but additionally makes this information available via advertising. It also has an SOS button and charges via a magnetic connector.

The waterproof W2-P5202D3 is a fitness tracker style device that advertises iBeacon, Eddystone and acceleration.

View Rechargeable Beacons