ABC of Electronics cosycom.com
ESP32 BASICS · LESSON 13

Bluetooth Basics: Classic and BLE

The difference between classic Bluetooth and BLE, and a first look at services and characteristics.

Bluetooth on the ESP32 comes in two distinct flavours that aren't interchangeable: classic Bluetooth, aimed at continuous audio and serial-style links, and Bluetooth Low Energy (BLE), aimed at short, infrequent exchanges of small amounts of data on very little power.

Classic Bluetooth vs BLE, at a glance
Classic BluetoothBLE
Typical useAudio, serial cable replacementSensors, wearables, short data bursts
Power useHigher, continuousVery low, especially when idle
Data modelStream of bytesServices made of characteristics

A first BLE characteristic

ble_basic.ino
#include 
#include 
#include 

#define SERVICE_UUID        "12345678-1234-1234-1234-1234567890ab"
#define CHARACTERISTIC_UUID "abcd1234-ab12-cd34-ef56-1234567890ab"

void setup() {
  BLEDevice::init("ESP32-Sensor");
  BLEServer* server = BLEDevice::createServer();
  BLEService* service = server->createService(SERVICE_UUID);
  BLECharacteristic* characteristic = service->createCharacteristic(
      CHARACTERISTIC_UUID,
      BLECharacteristic::PROPERTY_READ
  );
  characteristic->setValue("hello");
  service->start();
  server->getAdvertising()->start();
}

void loop() {
}
KEY IDEA
Think of a BLE "service" as a folder and its "characteristics" as the individual values inside it that a phone app can read or write.