Esp32 bluetooth com port

I have a program on my Win10 PC that normally connects to a com port that I select, to receive serial data from an Arduino by usb cable. Can I somehow have an esp32 bluetooth connect to the PC as a com port that I can select in the PC program so it can receive serial data from bluetooth instead of by usb cable? Could you tell me the steps I would need to take to achieve this?

if you are using Bluetooth Classic try Examples>BluetoothSerial>SerialToSerialBT

when run is should create a Bluetooth device called ESP32test
add the device on the PC and it should create a couple of COM ports

use a terminal emulator (such as teraterm) to test interaction with the ports

you can implement code using Visual Studio (C#, VB.net), java , Python, etc to communicate with the COM port

if using BLE try Tools>BLE>UART

If your ESP32 supports Bluetooth Classic then use the BluetoothSerial library.
Try installing Bluetooth Serial Terminal app here. Link is on Microsoft store.
Anyways, the library supports the same functions as Serial however the begin function is different from Serial library. Its used as the name of bluetooth device such as begin(/* String */ "ESP-BT-1234");. This sets the name of the ESP32 device.

I also have Win10 so this app might look like (the red pencil is my sketches.):


The code I'm showing you is not including all functions such as get mac - look for: file > examples > BluetoothSerial, click on bluetoothserial then select any project. ---------------------------------------------------------------------------------------------------------------------
example code:

#include "BluetoothSerial.h"

BluetoothSerial SerialBT;

void setup() {
    Serial.begin(115200);
    SerialBT.begin("ESP32_BT"); // Set Bluetooth device name
    Serial.println("Bluetooth Serial Started! Ready to connect...");
}

void loop() {
    if (Serial.available()) {
        char data = Serial.read();
        SerialBT.write(data); // Send data via Bluetooth
    }
    if (SerialBT.available()) {
        char received = SerialBT.read();
        Serial.print("Received: ");
        Serial.println(received);
    }
    delay(20); // Prevent excessive loop iteration
}

I'm new to forums - so sorry for some things...
If you have any errors please let me know.

Be aware that only some of the esp32 variants support Bluetooth classic. Bluetooth 5.0 does not.
https://docs.espressif.com/projects/esp-idf/en/v5.0.9/esp32s3/hw-reference/chip-series-comparison.html

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.