Blog

Bluetooth LE Developer Study Guide V5.1

By April 9, 2019 No Comments

Written by Martin Woolley, Developer Relations Manager, Bluetooth Special Interest Group, Inc. and active Zephyr community member

Introduction

The Bluetooth Special Interest Group (SIG) is the technical standards body behind Bluetooth technology. We’re responsible for facilitating the production of the engineering specifications that define how this ubiquitous wireless communications technology works and for the evolution of the technology, working with some of the world’s leading experts from organisations that are members of the SIG. And so far, over 35,000 companies have joined the SIG to back Bluetooth and influence the future direction that it takes.

Bluetooth and Developers

Developers play an essential role in the success of Bluetooth. Stack developers implement Bluetooth. Applications developers use Bluetooth, often in surprising and creative ways. I’m a member of the SIG’s Developer Relations team, looking after the EMEA region. The team’s responsible for informing, supporting and educating developer communities of all sorts; mobile application developers, web developers and embedded software engineers amongst them.

We’re developers and technical architects ourselves, too. And so, we know, that sometimes going hands-on is the only way to really tackle a new and tasty technical subject. To that end, we’ve created a collection of educational resources known as study guides to help developers learn about Bluetooth from a variety of perspectives and to provide the opportunity to reinforce the theory with some practical work in the form of step by step development projects.

Zephyr and Bluetooth

The Zephyr RTOS has excellent support for Bluetooth, including Bluetooth Low Energy (LE) and Bluetooth mesh.  Last year, I selected Zephyr to be the platform to base our Bluetooth Mesh Developer Study Guide on.

Our most popular download though, is the Bluetooth LE Developer Study Guide (BLEDSG).  This resource teaches the theory relating to Bluetooth LE when used for one to one connected communication between two devices. This involves aspects of the Bluetooth stack known as GATT (Generic Attribute Profile) and GAP (Generic Access Profile) and is the most common way in which Bluetooth LE is used.

But theory isn’t everything and this study guide gives developers a range of projects they can really get their teeth into, whether they’re a smartphone developer or an embedded software engineer. There’s even some simple electronics involved, and your first task is to put together a simple circuit involving three LEDs, a piezo buzzer, a serial LCD display and a thermistor. You can then opt to develop the code for a peripheral device which allows the circuit to be controlled over Bluetooth using a smartphone. And yes, you can develop the smartphone application too if you want to, with projects available for Android and iOS developers as well as one which shows how to use Apache Cordova to create a platform agnostic application.

The included theory primer will teach you key terminology and concepts, including the structure of the GATT attribute table, with its hierarchy of services, characteristics and descriptors which represent and allow control of the device’s various capabilities. The development projects will give you practice implementing this structure and teach you how to use APIs to allow reading and writing characteristic values and to leverage capabilities such as Bluetooth notifications and indications. If you develop one of the smartphone projects, you will also learn how to use the RSSI (received signal strength indicator) to estimate how near or far the smartphone is from the Bluetooth peripheral device it is connected to.

The BLEDSG Zephyr Project

Bluetooth LE Developer Study Guide 5.1

The latest release of the BLEDSG, version 5.1 adds a new hands-on project which uses a BBC micro: bit with Zephyr. Following the detailed instructions in the associated project guide, you will use Zephyr to implement a custom Bluetooth profile which allows the distance of the peripheral device from a connected smartphone to be tracked, uses LEDs and the buzzer to indicate when the connection has been lost (the GATT Link Loss service) and allows you to request that it generate a visual and audible alert (an implementation of the GATT Immediate Alert service), useful if you’ve misplaced the device! The electronics incorporates a thermistor, so you can also track the temperature of the device using a standard Bluetooth GATT service known as the Health Thermometer service.

Skeleton code for Zephyr RTOS is provided as a starting point

Over to you!

The Bluetooth SIG’s BLEDSG is the perfect way to learn about Bluetooth LE, GATT and GAP and Zephyr is an excellent platform for gaining hands-on experience in the process. It so happens it’s a lot of fun as well. Download the Bluetooth LE Developer Study Guide today and get coding with Zephyr and Bluetooth!