0

I'm trying to connect an ESP32 (as Bluetooth master) to an Arduino Uno that has an HC-05 Bluetooth module attached. My goal is to send serial data between the ESP32 and the Uno.

Setup:

  • Arduino Uno connected to HC-05 using SoftwareSerial (pins 13 = RX, 12 = TX).
  • HC-05 is in slave mode (AT+ROLE=0).
  • Baud rate reported by AT+UART? is 9600.
    `

Arduino Uno code:

#include <SoftwareSerial.h>

SoftwareSerial BTSerial(13, 12); // RX, TX

void setup() {
  Serial.begin(9600);
  BTSerial.begin(9600);
  Serial.println("Arduino ready");
}

void loop() {
  if (BTSerial.available()) {
    char data = BTSerial.read();
    Serial.print("Received from ESP32: ");
    Serial.println(data);
  }

  if (Serial.available()) {
    char data = Serial.read();
    BTSerial.print(data);
  }
}

I used the example sketches from the BluetoothSerial library, "SerialToSerialBTM (ESP32 acting as master)".

I also tried the discover/connect example.

Both examples can see the HC-05 in the scan, but:

When I try to connect, the connection either fails immediately or disconnects after 1–2 seconds.

I never get stable communication, and no data shows up in the Serial Monitor.

What I tried:

  • Confirmed HC-05 is in slave mode (AT+ROLE=0).
  • Verified baud rate with AT+UART? → 9600 and used this in Uno + ESP32 code.
  • Tested multiple baud rates (9600, 38400).
  • Used both SerialBT.connect("98:D3:xx:xx:xx:xx") with the HC-05 MAC address and device name.

Sometimes the HC-05 LED shows a brief connection, but it never stays stable.

Question:

Why can't the ESP32 maintain a stable Bluetooth connection with the HC-05?

Do I need to change the HC-05 role or baud rate to make this work?

Is there a recommended example or configuration for reliable serial communication between ESP32 (master) and HC-05 (slave)?

1
  • SerialBT.connect("98:D3:xx:xx:xx:xx") Isn’t an AT command, even you use that at the ESP32 side, the HC-05 won’t understand it. HC-05 uses address which you can find out with AT+ADDR? (It will return something like “1234:56:abcdef“ from the Arduino side, and esp32 has to send AT+BIND=1234,56,abcdef to address to the Hc-05 based on the address you find from HC-05. Other than set AT+ROLE on both sides, you also need to set AT+MODE on both sides. There are At command manual for HC-05 you can read or there are plenty of tutorials online Commented Sep 15 at 10:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.