Hc-05+arduino, connects to the device, but can not send AT-commands

hc-05 was connected to the arduino UNO. Power for hc-05 external - 4V. RX/TX up to 5 and 6 respectively. With the hc-05 power supply, I can connect to the device via my phone and send messages via the Serial Bluetooth Terminal. The next sketch does not send AT-messages. Because mySerial.available() = 0. Why?

#include <SoftwareSerial.h>

const int rx = 5;
const int tx = 6;
SoftwareSerial mySerial(rx, tx);

void setup()  {
  pinMode(rx,INPUT);
  pinMode(tx,OUTPUT);
  Serial.begin(9600);
  mySerial.begin(38400);
  Serial.println("finish setup");
}

void loop() {
  if (mySerial.available()) {
    const char c = mySerial.read();
    Serial.print(c);
  }
  if (Serial.available()) {
    const char c = Serial.read();
    mySerial.write(c);
  }
}

Are you trying to send AT commands to the HC05 from the phone via Bluetooth?

My tutorial on putting the HC05 into AT mode may be of interest.

I am trying to send from the console Arduino IDE Com4.

I used your test, and I’m not getting a response from hc-05.

12:05:42.084 -> Sketch:   E:\projects\arduino\hc-05\hc-05.ino
12:05:42.084 -> Uploaded: Jun 25 2023
12:05:42.131 ->  
12:05:42.131 -> BTserial started at 38400
12:05:42.131 ->  
12:08:04.803 -> >AT

Can you post photos that clearly shows the wiring, please?



I changed the power control: +5V take from the arduino, through the voltage divider (2k Om and 1 k Om) to Tx.
Now I have another problem. I send "AT" but get out:

20:03:49.315 -> �5>AT
20:03:49.805 -> �5

P.S. Baud is 38400

Incorrect.

image

How sure are you that what you have is a HC05? That does not look like a HC05 module.

An HM-10 ?

image

1 Like

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