Return to Pattern Library
BLE
Advertise over BLE and serve a GATT read
Requires the Temboo extension.
Platform

ESP32

Open in VS Code
Initialize the BLE stack, advertise a device name, and expose a simple GATT service/characteristic that a central (phone/laptop) can discover and read.
Applies when
Use this pattern when bringing up BLE connectivity for the first time on an ESP32 target, before layering on custom services, notifications, or security/pairing.
Show pattern details
Hide pattern details
Intent
Implement firmware that initializes the BLE stack (NimBLE or Bluedroid), starts advertising under a recognizable device name, and exposes a minimal GATT service with one readable characteristic, confirming BLE stack bring-up and basic peripheral role functionality on the target.
Expectation
A BLE scanner app (e.g. nRF Connect, LightBlue) on a phone or laptop discovers the advertised device by name, connects successfully, and can read the exposed characteristic value without errors or disconnects.
Success criteria
Device appears in a BLE scan within 10 seconds of firmware boot, a scanner app successfully connects, and the exposed characteristic read returns the expected value with no stack errors or crashes logged.
How it is verified
Use a BLE scanner app to confirm the device is discoverable, connect to it, and read the exposed characteristic. Cross-check serial logs for connection/disconnection events and any stack errors. Confirm the device readvertises correctly after a disconnect.