Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To try Bluetooth Low Energy (BLE) with ESP-IDF, build Espressif’s NimBLE_GATT_Server example, flash it to a compatible ESP32-series development board, then use a phone to inspect its services, switch the board’s LED, and read or subscribe to sample heart-rate data. The heart-rate value is generated demonstration data—not a reading from a sensor.

What you will build

The example turns the development board into a BLE peripheral. A phone running nRF Connect for Mobile acts as the central and connects to the board. You can explore the board’s GATT services, write a characteristic to control the LED, and read or subscribe to the example’s heart-rate measurement characteristic.

This is a useful first project because it demonstrates the main BLE workflow without requiring a separate sensor: advertise, connect, discover data services, then exchange data through characteristics. Follow Espressif’s BLE introduction and getting-started guide for the example-specific walkthrough.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Understand the BLE pieces you will use

Application, host, and controller

Espressif describes BLE software as three layers: application, host, and controller. Your application calls the host’s APIs. The host implements protocols such as GAP, GATT/ATT, SMP, and L2CAP, and communicates with the controller through HCI. The controller handles lower-level radio and link functions, including the PHY and Link Layer. Depending on the hardware design, host and controller functions can be integrated on one chip or separated.

#1 Best Overall
ELEGOO 3PCS ESP-32 Dev Boards, ESP-WROOM-32, USB-C, WiFi Bluetooth 4.2
  • Dual-Core Performance Up to 240 MHz: Run sensor processing, wireless communication, automation logic and connected-device tasks on a 32-bit dual-core ESP32 platform designed for responsive embedded and IoT projects
  • Built-in Wi-Fi and Bluetooth 4.2: Connect to 2.4 GHz Wi-Fi networks or use Bluetooth Classic and BLE for wireless sensors, smart devices, remote controls, home automation and other connected projects
  • Flexible Power-Saving Modes: ESP32 power-management features support dynamic clock scaling and low-power operating modes, helping developers reduce energy use in compatible sensing, monitoring and connected-device applications, suitable for battery-powered Internet of Things (IoT) devices.
  • USB-C Programming with CP2102: Connect through USB-C for power, sketch uploads and serial monitoring, while GPIO, UART, SPI and I2C interfaces support sensors, displays, motor drivers and other modules (USB-C cable not included)
  • Over-the-Air Update Support: Configure OTA functionality through a compatible ESP-32 software framework to update deployed firmware over Wi-Fi without reconnecting the board by USB for every revision

GAP: discovery and connection

GAP defines how devices are discovered and connected, along with the roles they take. An advertiser broadcasts advertising data; a scanner listens for it. An initiator can request a connection to an advertiser that accepts connections. Once connected, the advertiser is the peripheral and the initiator is the central. BLE also supports connectionless broadcast and observer roles, but this tutorial’s phone-to-board exercise uses a connection.

GATT and ATT: services and data

ATT defines attributes and how a client or server accesses them. An attribute has a handle, a type, a value, and permissions. Types are identified by UUIDs: common Bluetooth SIG-assigned identifiers are 16-bit, while vendor-defined identifiers are commonly 128-bit.

Rank #2
ESP-WROOM-32 ESP32 ESP-32S Development Board 2.4GHz Dual-Mode WiFi + Bluetooth Dual Cores Microcontroller Processor Integrated with Antenna RF AMP Filter AP STA Compatible with Arduino IDE (3PCS)
  • 2.4GHz Dual Mode WiFi + Bluetooth Development Board
  • Support LWIP protocol, Freertos
  • SupportThree Modes: AP, STA, and AP+STA
  • Ultra-Low power consumption, Compatible with Arduino IDE
  • ESP32 is a safe, reliable, and scalable to a variety of applications

GATT builds on ATT and organizes data into services and characteristics. A GATT server stores and manages characteristics; a GATT client discovers and accesses them. In this example, the board is the server and the phone is the client. A client can read a characteristic, write to it, or subscribe to updates when the characteristic supports notifications or indications.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose a Bluetooth host stack

ESP-IDF documents two host stacks. For a BLE-only first project, NimBLE is a natural fit; choose Bluedroid when the project also needs Classic Bluetooth. Confirm that your target chip and the example configuration support the stack you intend to use.

Rank #3
ESP-WROOM-32 ESP32 ESP-32S Development Board 2.4GHz Dual-Mode WiFi + Bluetooth Dual Cores Microcontroller Processor Integrated with Antenna RF AMP Filter AP STA Compatible with Arduino IDE (1 PCS)
  • 2.4GHz Dual Mode WiFi + Bluetooth Development Board
  • Support LWIP protocol, Freertos;ESP32 is a safe, reliable, and scalable to a variety of applications
  • SupportThree Modes: AP, STA, and AP+STA
  • Ultra-Low power consumption, Compatible with Arduino IDE
  • 1PCS 30Pin ESP32 Development Board 2.4GHz WiFi Dual Cores Microcontroller Integrated with Antenna RF Low Noise Amplifiers Filters
Stack Bluetooth scope Footprint note When it fits
ESP-NimBLE BLE only Espressif says it requires less heap and flash than Bluedroid; the cited overview does not give a numerical footprint. A BLE-focused project such as this tutorial.
ESP-Bluedroid Classic Bluetooth and BLE The cited overview does not provide a comparative numerical footprint. A project that needs Classic Bluetooth as well as BLE.

See Espressif’s Bluetooth overview and chip support information and the Bluetooth API index for current stack documentation and examples. Bluetooth controller, Bluedroid, and NimBLE support differs among ESP32-series chips, so check the matrix for your exact chip and verify the example’s configuration. ESP-IDF’s overview specifically describes ESP32 as supporting Dual-Mode Bluetooth 4.2 and being certified for Dual-Mode Bluetooth 4.2 and Bluetooth LE 5.0; those statements apply to ESP32, not automatically to every ESP32-series chip.

What you need

  • An ESP32-series development board whose chip is supported by the example. Espressif does not prescribe a particular board model.
  • An ESP-IDF development environment for the release you plan to use.
  • A phone with nRF Connect for Mobile installed.
  • A USB connection suitable for your board, for flashing and viewing serial output.

The commands below use the example path shown in Espressif’s guide. Replace <ESP-IDF Path> with your ESP-IDF installation path and <chip-name> with the target name for your board.

Rank #4
Seeed Studio XIAO ESP32C3 - Tiny MCU Board with Wi-Fi and BLE for IoT Controlling Scenarios. Microcontroller with Battery Charge, Power Efficient, and Rich Interface for Tiny Machine Learning. …
  • 【ESP32-C3 RISC-V Development Board】​​ Built with the ESP32-C3 32-bit RISC-V chip (160MHz), featuring Arduino/CircuitPython support and multiple development ports. Ideal for IoT and edge AI projects.
  • 【Outstanding RF & Long-Range Connectivity】​​ Equipped with U.FL antenna for stable Wi-Fi/BLE5.0 communication over 100m. Complete RF performance ensures reliable IoT connectivity.
  • 【Ultra-Low Power & Battery-Friendly】​​ 4 working modes, including deep sleep at 44μA. Onboard battery charge IC supports Li-ion/LiPo, perfect for wearables and wireless IoT.
  • 【Thumb-Sized & Production-Ready】​​ Compact 21x17.5mm design with SMD/Breadboard-friendly layout. Single-sided component mounting ensures sleek integration into wearables.
  • 【Rich I/O & Edge Computing】​​ 11 digital I/O (PWM) + 4 analog I/O (ADC), plus UART/IIC/SPI/IIS ports. Optimized for TinyML and edge AI applications.

Build and flash the NimBLE GATT server

  1. Open the example directory: in a terminal with the ESP-IDF environment available, change to <ESP-IDF Path>/examples/bluetooth/ble_get_started/nimble/NimBLE_GATT_Server.
  2. Set the target: run idf.py set-target <chip-name>, using the target supported by your board.
  3. Connect and flash: connect the board to the computer and run idf.py flash monitor. The command builds and flashes the application, then opens its serial monitor.

Because ESP-IDF documentation and supported-chip configurations can change between releases, use the instructions and configuration for the ESP-IDF version and chip target actually selected.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Connect from your phone and inspect the services

  1. Open nRF Connect for Mobile and start a scan.
  2. Find the device named NimBLE_GATT and connect to it.
  3. Inspect its discovered services. The walkthrough identifies GAP and GATT as foundational services, along with Heart Rate Service and Automation IO Service.

The Heart Rate Service UUID is 0x180D, and the Heart Rate Measurement characteristic UUID is 0x2A37. The LED characteristic uses a vendor-specific 128-bit UUID, so it will not have the same standardized identifier.

Best Value
ideaspark® ESP32 Development Board Integrated 1.14 inch ST7789 135x240 TFT LCD Display,WiFi+BL Wireless Module,CH340 Driver USB Type-C for Arduino Micropython (ESP32 1.14 inch LCD(Solder PIN))
  • The ESP32 1.14'' LCD board has all the features of the traditional ESP32 Devkit V1 module,with the same exact peripheral ports,offers seamless integration with a 1.14-inch LCD display, eliminating the need for frustrating wires and breadboards.Display features a high-resolution 135x240 full color with ST7789 driver and is compatible with I2C interfaces. Plus,It uses Type-c usb cable to connect. Say goodbye to messy setups and hello to hassle-free electronics with the ESP32 board
  • Board is based on ESP32-WROOM-32 module integrated with Antenna switches, RF Balun, power amplifiers, low-noise amplifiers, filters, and management modules, and the entire solution occupies the least area of PCB. 2.4 GHz Wi-Fi plus BLE dual-mode chip, TSMC Ultra-low power consumption 40nm technology, power dissipation performance and RF performance is the best, safe and reliable, easy to extend to a variety of applications
  • Board uses SPI to connect LCD: D23/GPIO23->MOSI, D18/GPIO18->SCLK, D15/GPIO15->CS, D2/GPIO2->DC, D4/GPIO4->RST,D32/GPIO32->BLK.With this board,it's easy to display a variety of information and data
  • To install the new version driver for CH340,simply search for the keywords "CH340 Driver" on Google.com or Bing.com and follow the installation instructions provided.Recommended for Win10 Operating System
  • This board is an outstanding option for various Internet of Things (IoT) projects. It can be used to display network connection status,monitor information, power levels, and other relevant data. Additionally, it's suitable for building Internet Weather Stations, Graphic Plotter, Data Monitor, and Other similar applications
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Control the LED with a characteristic write

  1. In the connected device’s service list, open Automation IO.
  2. Open the LED characteristic and choose the write action.
  3. Select the ON or OFF value offered by the example, then send the write.
  4. Check the board’s LED for the change. If the board has no user LED, use the corresponding indication in the serial log instead.

This action illustrates a client writing a value to a server characteristic: the phone sends the selected value and the board’s example handles it.

Read or subscribe to the heart-rate example

Open the Heart Rate Measurement characteristic and either read its current value or enable updates by subscribing. Espressif’s example generates values fluctuating between 60 and 80 and updates them about once per second. These values are demonstration data, not a sensor measurement or a reliable health reading.

The Client Characteristic Configuration Descriptor (CCCD), UUID 0x2902, records whether notifications or indications are enabled. Subscribing in the phone app configures the client to receive the supported updates; it does not turn the generated value into a real sensor reading.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If the example does not behave as expected

  • The device does not appear during scanning: confirm that flashing completed, the board is running the example, and the phone is scanning nearby. Check serial output in the monitor for startup or configuration errors.
  • The build or target configuration fails: verify that <chip-name> matches the board’s chip and that the selected ESP-IDF release supports the example and stack for that target.
  • The LED does not visibly change: some boards have no user LED. Check the serial log for the example’s corresponding indication.
  • The heart-rate value appears implausible: it is intentionally generated sample data, not a physiological reading.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.