Bluetooth
These samples demonstrate the use of Bluetooth in Zephyr.
To build any of the Bluetooth samples, follow the same steps as building any other Zephyr application. Refer to Application Development for more information.
Many Bluetooth samples can be run on QEMU or native_sim with support for external Bluetooth Controllers. Refer to the Hardware setup section for further details.
Several of the bluetooth samples will build a Zephyr-based Controller that can
then be used with any external Host (including Zephyr running natively or with
QEMU or native_sim
), those are named accordingly with an “HCI” prefix in the
documentation and are prefixed with hci_
in their folder names.
Note
If you want to run any bluetooth sample on the nRF5340 device (build using
-DBOARD=nrf5340dk/nrf5340/cpuapp
or
-DBOARD=nrf5340dk/nrf5340/cpuapp/ns
) you must also build
and program the corresponding sample for the nRF5340 network core
HCI IPC which implements the Bluetooth
Low Energy controller.
Note
The mutually-shared encryption key created during host-device paring may get old after many test iterations. If this happens, subsequent host-device connections will fail. You can force a re-paring and new key to be created by removing the device from the associated devices list on the host.
- Basic Audio Profile (BAP) Broadcast Audio AssistantUse BAP Broadcast Assistant functionality.
- Basic Audio Profile (BAP) Broadcast Audio SinkUse BAP Broadcast Sink functionality.
- Basic Audio Profile (BAP) Broadcast Audio SourceUse BAP Broadcast Source functionality.
- Basic Audio Profile (BAP) Unicast Audio ClientUse BAP Unicast Client functionality.
- Basic Audio Profile (BAP) Unicast Audio ServerUse BAP Unicast Server functionality.
- BeaconAdvertise an Eddystone URL using GAP Broadcaster role.
- BroadcasterPeriodically send out advertising packets with a manufacturer data element.
- BTHome sensor templateImplement a BTHome sensor.
- CentralImplement basic Bluetooth LE Central role functionality (scanning and connecting).
- Central / GATT WriteScan for a Bluetooth LE device, connect to it and write a value to a characteristic.
- Central MultilinkScan, connect and establish connection to up to 62 peripherals.
- Central OTCConnect to a Bluetooth LE peripheral that supports the Object Transfer Service (OTS)
- Central Periodic Advertising Sync Transfer (PAST)Use the Periodic Advertising Sync Transfer (PAST) feature as the sender.
- Common Audio Profile (CAP) AcceptorAdvertise audio availability to CAP Initiators using the CAP Acceptor role.
- Common Audio Profile (CAP) InitiatorConnect to CAP Acceptors and setup unicast audio streaming or broadcast audio streams.
- Cycling Speed and Cadence (CSC) PeripheralExpose a Cycling Speed and Cadence (CSC) GATT Service.
- Direct AdvertisingAdvertise directly to a bonded central device.
- Direction Finding CentralConnect to a Bluetooth LE Direction Finding peripheral and request Constant Tone Extension.
- Direction Finding Periodic Advertising BeaconImplement Bluetooth LE Direction Finding CTE Broadcaster functionality.
- Direction Finding Periodic Advertising LocatorImplement Bluetooth LE Direction Finding CTE Locator functionality.
- Direction Finding PeripheralImplement Bluetooth LE Direction Finding peripheral transmitting CTE in connected mode.
- DIS PeripheralExpose device information using the Device Information Service (DIS).
- EddystoneExport an Eddystone Configuration Service as a Bluetooth LE GATT service.
- Encrypted AdvertisingUse the Bluetooth LE encrypted advertising feature.
- ESP PeripheralExpose environmental information using the Environmental Sensing Profile (ESP).
- Extended AdvertisingUse the Bluetooth LE extended advertising feature.
- Hands-freeUse the Hands-Free Profile (HFP) APIs.
- Hands-free Audio Gateway (AG)Use the Hands-Free Profile Audio Gateway (AG) APIs.
- HCI 3-wire (H:5)Expose a Bluetooth controller to another device or CPU over H5:HCI transport.
- HCI H4 over USBTurn a Zephyr board into a USB H4 Bluetooth dongle (Linux/BlueZ only).
- HCI IPCExpose a Bluetooth controller to another device or CPU using the IPC subsystem.
- HCI Power ControlDynamically control the Tx power of a Bluetooth LE Controller using HCI vendor-specific commands.
- HCI SPIExpose a Bluetooth controller to another device or CPU over SPI.
- HCI UARTExpose a Bluetooth controller to another device or CPU over UART.
- HCI UART asyncExpose a Bluetooth controller to another device or CPU over asynchronous UART.
- HCI USBTurn a Zephyr board into a USB Bluetooth dongle (compatible with all operating systems).
- HCI Vendor-Specific Scan RequestUse vendor-specific HCI commands to enable Scan Request events when using legacy advertising.
- Health Thermometer (Central)Connect to a Bluetooth LE health thermometer sensor and read temperature measurements.
- Health Thermometer (Peripheral)Expose a Health Thermometer (HT) GATT Service generating dummy temperature values.
- Hearing Access Profile (HAP) Hearing Aid (HA)Advertise and await connection from a Hearing Aid Unicast Client or Remote Controller.
- Heart-rate Monitor (Central)Connect to a Bluetooth LE heart-rate monitor and read heart-rate measurements.
- Heart-rate Monitor (Peripheral)Expose a Heart Rate (HR) GATT Service generating dummy heart-rate values.
- HID PeripheralImplement a Bluetooth HID peripheral (generic mouse)
- iBeaconAdvertise an Apple iBeacon using GAP Broadcaster role.
- ISO (Central)Transfer isochronous data to a peer device using an isochronous channel as a central.
- ISO (Peripheral)Implement a Bluetooth LE Peripheral that uses isochronous channels.
- Isochronous BroadcasterUse the Bluetooth Low Energy Isochronous Broadcaster functionality.
- Isochronous Broadcaster BenchmarkMeasure packet loss and sync loss of an ISO broadcaster against one or more receivers.
- Isochronous Connected Channels BenchmarkMeasure packet loss and sync loss in connected ISO channels.
- MeshUse basic Bluetooth LE Mesh functionality.
- Mesh DemoImplement a Bluetooth Mesh demo application.
- Mesh ProvisionerProvision a node and configure it using the Bluetooth Mesh APIs.
- MTU UpdateConfigure and exchange MTU between two devices.
- Multiple BroadcasterAdvertise multiple advertising sets.
- ObserverScan for Bluetooth devices nearby and print their information.
- Periodic AdvertisingUse Bluetooth LE Periodic Advertising functionality.
- Periodic Advertising Connection Procedure (Initiator)Initiate a connection to a device using the Periodic Advertising Connection Procedure.
- Periodic Advertising Connection Procedure (Responder)Respond to periodic advertising and establish a connection.
- Periodic Advertising SynchronizationUse Bluetooth LE Periodic Advertising Synchronization functionality.
- Periodic Advertising Synchronization Transfer PeripheralUse the Periodic Advertising Sync Transfer (PAST) feature as the receiver.
- Periodic Advertising with Responses (PAwR) AdvertiserUse Bluetooth LE Periodic Advertising with Responses (PAwR) Advertiser functionality.
- Periodic Advertising with Responses (PAwR) SynchronizationImplement Bluetooth LE Periodic Advertising with Responses Synchronization.
- PeripheralImplement basic Bluetooth LE Peripheral role functionality (advertising and exposing GATT services).
- Peripheral Accept ListAdvertise and accept connections only from devices on an accept list.
- Peripheral GATT WriteWrite a value to a characteristic using GATT Write Without Response.
- Peripheral IdentityUse multiple identities to allow connections from multiple central devices.
- Peripheral NUSImplement a simple echo server using the Nordic UART Service (NUS).
- Peripheral Object Transfer Service (OTS)Expose an Object Transfer Service (OTS) GATT Service.
- Peripheral SC-onlyEnable "Secure Connections Only" mode for a Bluetooth LE peripheral.
- Public Broadcast Profile (PBP) Public Broadcast SinkUse PBP Public Broadcast Sink functionality.
- Public Broadcast Profile (PBP) Public Broadcast SourceUse PBP Public Broadcast Source functionality.
- Scan & AdvertiseCombine Bluetooth LE Broadcaster & Observer roles to advertise and scan for devices simultaneously.
- ST Bluetooth LE Sensor DemoExport vendor-specific GATT services over BLE.
- Synchronized ReceiverUse Bluetooth LE Synchronized Receiver functionality.
- Telephone and Media Audio Profile (TMAP) Broadcast Media Receiver (BMR)Implement the TMAP Broadcast Media Receiver (BMR) role.
- Telephone and Media Audio Profile (TMAP) Broadcast Media Sender (BMS)Implement the LE Audio TMAP Broadcast Media Sender (BMS) role.
- Telephone and Media Audio Profile (TMAP) CentralImplement the TMAP Call Gateway (CG) and Unicast Media Sender (UMS) roles.
- Telephone and Media Audio Profile (TMAP) PeripheralImplement the TMAP Call Terminal (CT) and Unicast Media Receiver (UMR) roles.