Demystifying Bluetooth Low Energy with Zephyr
Marvin Ouma
27/08/2024
What is Bluetooth Low Energy?
Wireless technology standard\, designed from ground up.
Ultra Low Power.
Small bursts of data transmission.
Fast connection and teardown
Low cost.
Works on free 2.4 Ghz band.
Ideal for sensors/ IoT.
BLE Protocol: https://software-dl.ti.com/lprf/simplelink_cc2640r2_sdk/1.00.00.22/exports/docs/blestack/html/ble-stack/index.html
Stack Architecture
- Two main sections:
- Controller
- Host
Generic Access Profile (GAP)
- Controls connection and advertising processes.
- Makes a device visible to the world
- Determines how two devices can/cannot interact.
- Defines the role of a device.
- Connection-oriented roles
- Central (.e.g. Mobile phone)
- Peripheral (e.g. sensor device)
- Connection-less roles
- Broadcaster (sends out BLE advertisements)
- Observer (scans for BLE advertisements)
- Connection-oriented roles
- Each role comes with its own build-time configuration option in Zephyr.
Generic Attribute Profile (GATT)
Defines how two BLE devices transfer data back and forth using concepts like Services and Characteristics.
GATT works only after a dedicated connection between two devices has been established.
Connections are exclusive\, i.e. a peripheral can only connect to one central device.
Communication is two-way.
Zephyr Comes In
- Zephyr comes with a fully integrated Bluetooth Low Energy (BLE) stack.
- Supports various BLE roles\, including Central\, Peripheral\, Broadcaster\, and Observer.
- Modular design allows for easy customization and extension.
- Core Components:
- Host Controller Interface (HCI) : Provides a communication interface between the BLE host and the controller.
- BLE Controller : Handles low-level BLE tasks like link layer management and packet handling.
- BLE Host : Manages higher-level BLE functions such as the Logical Link Control and Adaptation Protocol (L2CAP)\, Attribute Protocol (ATT)\, and Security Manager Protocol (SMP).
Whats next
Zephyr has great examples\, in this case we will be looking at the peripheral example.
Most of the Zephyr BLE devices that are built will most likely be peripheral-role devices.
Use a BLE scanner app for BLE connectivity testing.