← How-Tos
electronics 1 days ago ◑ 2 views ◯ 4 min read

Bluetooth Classic SPP on ESP32: Serial Port Profile for Pairing with Legacy Serial Devices

esp32bluetooth classicsppserialwirelessbluedroid

Almost every ESP32 Bluetooth tutorial on this site, and nearly everywhere else, is about BLE: advertising, GATT services, custom characteristics. That's the right default for new designs, but it leaves a gap for a specific and still-common job: talking to a device, an app, or a piece of test equipment that only understands classic Bluetooth Serial Port Profile (SPP) — the "it just shows up as a COM port" Bluetooth that HC-05 and HC-06 modules have offered for over a decade. If you're replacing an aging HC-05 in an existing design, pairing with a legacy Android app that expects RFCOMM, or bridging a Bluetooth OBD-II dongle into a project, SPP is still the fastest path, and the original ESP32 can do it natively with no extra module.

Classic Bluetooth vs BLE: Know Which Chip You Have

This is the detail that catches people out, because it isn't obvious from "ESP32" alone. Classic Bluetooth (BR/EDR, which is what SPP runs over) is only available on the original ESP32 (the WROOM/WROVER modules built around the ESP32 D0WDQ6 chip) and the ESP32 Original dual-core line. The newer single-radio variants — ESP32-S2 (no Bluetooth at all), ESP32-S3, ESP32-C3, and ESP32-C6 — implement BLE only. There is no software workaround for this; it's a hardware radio limitation. If your board is an S3, C3, or C6 and you need Classic SPP, you need either an original ESP32, or an external classic-Bluetooth module (an HC-05 on UART, bridged) talking to your newer chip.

Setting Up BluetoothSerial

On a genuine dual-mode ESP32, the Arduino core ships the BluetoothSerial library, which wraps the ESP-IDF Bluedroid stack and presents an interface that behaves almost exactly like Serial — this is the whole appeal. A minimal SPP server looks like this:

#include "BluetoothSerial.h"
BluetoothSerial SerialBT;

void setup() {
  Serial.begin(115200);
  SerialBT.begin("ESP32-Project"); // Bluetooth device name
  Serial.println("SPP ready, pair and connect");
}

void loop() {
  if (SerialBT.available()) {
    SerialBT.write(SerialBT.read()); // echo
  }
}

Pair from a phone's Bluetooth settings (or a terminal app like Serial Bluetooth Terminal on Android) the same way you'd pair an HC-05, and once connected, anything written to SerialBT shows up on the paired side and vice versa. No GATT services, no characteristic UUIDs to define, no BLE central/peripheral role confusion — this is the appeal of SPP for quick, no-nonsense bidirectional links.

Pairing PIN and Security

By default BluetoothSerial pairs with "Just Works" (no PIN) on most modern phones, but if you need a fixed PIN to match a legacy pairing flow (some older Android apps and industrial readers still expect a classic 4-digit PIN), set it before calling begin():

SerialBT.setPin("1234");

This only affects legacy PIN-based pairing; Secure Simple Pairing (SSP) on both ends will often negotiate "Just Works" regardless. If a paired device is being stubborn, forget the pairing on both sides and start clean — classic Bluetooth pairing state gets stuck more often than BLE bonding does.

Receiving Data as Raw Bytes vs a Terminal

SPP has no concept of message framing — it's a raw byte stream, exactly like a wired UART. If you're bridging structured data (say, NMEA sentences from a GPS, or AT commands to an OBD-II dongle), do your own framing on top: buffer until you see a newline or a known delimiter, same as you would reading a hardware Serial port. Treating it as a reliable, ordered byte stream (it rides over L2CAP with retransmission) rather than a packetized BLE characteristic is the right mental model and avoids a lot of confused debugging.

When to Reach for This Instead of BLE

SituationUse
New design, phone app you're writing yourself, battery-poweredBLE — lower power, modern tooling
Drop-in replacement for an existing HC-05/HC-06 in a working designClassic SPP on original ESP32
Talking to an existing app, dongle, or reader that only speaks RFCOMM/SPPClassic SPP
Board is an S3/C3/C6BLE only — no classic option on-chip

Classic Bluetooth draws noticeably more current than BLE and doesn't deep-sleep as gracefully, so it's a poor fit for a coin-cell sensor node. For a bench tool, a shop fixture that's mains- or USB-powered, or a drop-in module replacement, none of that matters, and SPP's dead-simple serial semantics save real development time over standing up a custom GATT profile just to move the same bytes.