-1

I am trying to connect ESP32 via bluetooth classic to my PC to transfer some data from a sensor.

As a first step, I am simply trying to send some random data over bluetooth serial. The code is at follows:

#include "BluetoothSerial.h"

#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif

int myData[8];
BluetoothSerial SerialBT;

void setup() {
  Serial.begin(115200);
  Serial.println("Opening Serial Connection on COM4");
  SerialBT.begin("ESP32"); //Bluetooth device name
  SerialBT.println("Opening Serial Bluetooth Connection on COM6");

}

void loop() {

  for(int i = 0; i < 8; i++)
  {
    myData[i] = random(0,500);
  }
  if(Serial.available())
    {
 
     for(int i = 0; i < 8; i++)
  {
    SerialBT.write(myData[i]);
  }
      
    }
    delay(20);
}

In Windows Bluetooth settings, I have paired the ESP32 with windows and connected it. I have set up incoming and outgoing COM ports for Bluetooth where incoming port is COM6 and outgoing port is COM5.

However, when I open the Arduino serial monitor for COM6, it is empty and no data is being printed. I am using the Arduino IDE. Furthermore, on COM4, there is nothing printed despite the Serial.println("Opening Serial Connection on COM4"); command which I think should work regardless of Bluetooth.

I have tried everything I can think of. I would be grateful if anyone can help me solve this problem as I have been stuck for days.

1 Answer 1

0

I experienced the same. Impossible to open the COM port. I use Windows 11. The transmission works well when I use my android smartphone (Serial Bluetooth Terminal APP) rather than a serial terminal in Windows 11.

I also tried with a Windows 10 PC, the COM port opens well and the transmission is perfect.

I also rolled back my Arduino ESP32 board support package (BSP) version from 3.3.3 to 1.0.4 The rest of the configuration is the same (Windows 11, Arduino IDE 2.3.6, Wemos D1 R32 board). There is no more problem: the COM port opens well and the transmission is perfect. Hence it's not a exactly Windows 11 problem but a compatibility issue between ESP32 with its latest BSP version and Windows 11.

This solves the problem, but I'm not very comfortable using such an old BSP version. So it would be great if espressif could take a look on this issue.

Other input: Win11 serial over bluetooth works well with an HC-05 for instance. Hence it looks like an ESP32-BSP V3.3.3/Win11 incompatibility.

New contributor
J.P. PETILLON is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
2

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.