How to Use ESP32 Classic Bluetooth

In this blog, we’ll walk through how to set up ESP32 Classic Bluetooth Serial and communicate with your phone or computer using a Bluetooth terminal app. Bluetooth is one of the standout features of the ESP32 — and while BLE (Bluetooth Low Energy) gets a lot of attention, sometimes you just want good old Classic Bluetooth for simple serial-style communication.


What You’ll Need


Load the ESP32 Classic Bluetooth Serial Example

Here’s a basic sketch to enable Classic Bluetooth Serial

//ESP32 Classic Bluetooth example
#include "BluetoothSerial.h"

// Create a BluetoothSerial object
BluetoothSerial SerialBT;

void setup() {
  Serial.begin(115200);         // USB Serial for debug
  SerialBT.begin("ESP32BT");   // Name it "ESP32_BT"
  Serial.println("Bluetooth started. Now you can pair it.");
}

void loop() {
  if (SerialBT.available()) {
    char c = SerialBT.read();
    Serial.write(c);            // Echo to USB serial
    SerialBT.write(c);          // Echo back to BT client
  }

  if (Serial.available()) {
    SerialBT.write(Serial.read());  // Forward USB to Bluetooth
  }
}

What this code does:

  • Sets up Classic Bluetooth named ESP32_BT
  • You can pair with it like a Bluetooth speaker
  • Anything you send from the Bluetooth terminal will be echoed back

Pair with the ESP32

  1. Power up the ESP32 (upload the sketch first)
  2. On your phone or PC, open Bluetooth settings
  3. Look for a device named ESP32_BT
  4. Pair with it (some devices may ask for a pairing code — try 1234 or 0000 if prompted)

Use a Bluetooth Terminal App

Download the following app:

Serial Bluetooth Terminal by Kai Morich (highly recommended)

Serial Bluetooth terminal APP

Turn on your android bluetooth, Open the bluetooth settings. You can find the device named ESP32BT. Click on it to pair it (some devices may ask for a pairing code — try 1234 or 0000 if prompted)

ESP32 BT is showing in available devices

Once paired, you can find the ESP32BT device in your paired devices list:

ESP32 BT is paired now

Open the app, Connect to the ESP32_BT device.

Click on upper left corner
Click on ESP32BT Device to connect to it

Type something — it should appear in your Arduino Serial Monitor and be echoed back.

Android APP Window:

ESP32 Classic Bluetooth DEMO

Serial Monitor:

Serial Monitor Output


Debug Tips

  • Make sure Bluetooth is enabled on your phone/PC
  • If you’re not seeing the device, try resetting the ESP32
  • If you get errors about BluetoothSerial, Make sure you’ve selected ESP32 board.

Bonus: Custom Bluetooth Name

SerialBT.begin("MyAwesomeESP32");

You can name it anything you want. Just make sure it’s unique!


Cleanup Tip

If you’re done testing and want to disable Bluetooth:

SerialBT.end();

This will stop the Bluetooth service.


Conclusion

ESP32 Classic Bluetooth is super easy using the built-in BluetoothSerial library. It’s ideal for:

  • Sending debug info wirelessly
  • Remote control apps
  • Simple wireless serial communication

No need to dive into BLE complexity if you just need a basic Bluetooth link!


IF you are interested in how EXTERNAL bluetooth MODULE works with ARDUINO UNO, MUST VISIT:

Arduino MP3 Player With Voice Control Using HC-05 Bluetooth Module And DFplayer Mini – ArduinoYard

Leave a Comment