[SOLVED] HC_05 not responding to AT commands

Hello Everyone!
I am trying to get to HC-05 to interface with each other on different Arduinos(same exact model) and none of them are not responding to any of the commands like "AT". All I am getting is "ERROR: (0)" on startup of the code and then nothing else when I type in the AT commands. Also yes I put it in AT command mode.

This is the guide I am using:
https://www.instructables.com/Arduino-Two-Way-Communication-Via-Bluetooth-HC-05/

This is my code if it has anything to do with this issue:

#include <SoftwareSerial.h>

SoftwareSerial Bluetooth(3,2); 

void setup() {
  Serial.begin(9600);
  Bluetooth.begin(38400);
}

void loop() {
   if (Bluetooth.available())
    Serial.write(Bluetooth.read());

   if (Serial.available())
    Bluetooth.write(Serial.read());  
}

Thanks for the help in advance!

Sorry it is hard to help if I do not know what I am working with. I cannot see what you have so I need more information. Post an annotated schematic, not a frizzy wiring diagram showing exactly how you have wired this. Be sure to show all connections, power sources, grounds etc and any other hardware components. Post links to technical information on each of the hardware items.

2 Likes

I can't do that but I will do my best to explain.

My arduinos are wired identically they consist of only the arduino and the HC-05 module. Then I have dupont wires from the module connecting straight to the arduino.

This is how I wired the HC-05.

VCC --> 5v
Gnd --> Gnd
Txd --> Digital 3
Rxd --> Digital 2
En --> 3.3v

Try Task-12.3 of this file:

No this is not yet the best to explain. You have to add a lot of more details.

what exact arduino?

  • Arduino Uno,
  • Arduino nano?
  • arduino micro?
  • arduino mega ?
  • ?

did you really follow all steps of your tutorial?
did you do successful pairing of your two HC-05-modules?

did you try paring a single HC-05-module with a smartphone?

does your HC-05-module have a button for switching between datamode and AT-mode?
does your HC-05-module change between datamode and at-mode through a HIGH-signal on the EN-input?

As you can see from all these detail questions. A much more detailed description of the steps you have done is required to analyse your problem

It would help a lot of you could post a picture taken with a smartphone.
On this picture the wiring should be seen in a way that it is EASY to determine just from the picture which wire is connected to what.

Use a different color for each connection

GND black or blue
Vcc red
Tx a different color (example green)
Rx a different color (example yellow)

1 Like

I have a Arduino Mega and I got stuck on step 4 when he used AT commands the code that I showed was the code the a tried to recreate the code in the picture at step 3. I did not successfully pair the modules. It does have a button for going into AT-Mode I just like to wire up the EN pin since it is easier on startup for me. I did not pair to a smart phone.

Hopefully these pictures can help clarify.
RXD --> Blue
TXD --> Brown
GND --> Orange
VCC --> Red
En --> White




I will check back later, good luck.

Hi @decentro ,

now we are coming closer to solve the problems.

If you have an Arduino Mega 2560 you can use a second hardware-UART.
As you can clearly see on the back of the HC-05-Module
image

The RXD and the TXD are 3.3V-level. Not 5V level.

Have you ever looked into the document that was mentioned by user gilshultz?
under 12.3 you can see


That there is a voltage-divider between the HC-05-module and the microcontroller.
This is to reduce the 5V down to 3.3V for the HC-05-module.

Your instructable does not use this.
Me personal I call "instructable" frustractable because a lot of "instructions" there are of low quality.

It might be that you have damaged the HC-05-modules by connecting the RXD/TXD-pins to 5V

before going on you should use the resistors like shown here

I have read that some modules do have a button but don't react on EN-input signals

other modules do not have a button and you must use the EN-input.
If your module has a button you should use the button.

If you connect the
HC-05-Rx--voltage-divider---Mega-Tx 18
HC-05-Tx-----Mega-Rx 19

you have to modify the code to use Serial1 instead of software-serial.

And you should start with a code that just checks if communication with the blue-tooth-module works at all.

I haven't read the documentation of the HC-05. It might well be that the HC-05-module sends some characters on power-up.

Or in case you have paired the HC-05 to a smartphone using a bluetooth-serial-app
You could send some characters from your smartphone and check if the arduino receives these characters.

With this test you only have to deal with a single HC-05-module
which means only half of possible bugs, faults etc. can occur

And how do I do that?

Using software serial on a Mega is pretty stupid but that doesn't mean it won't work. I believe your immediate problem is that it won't work on pins 2,3. If you simply change to pins 10,11, you might get a result.

Using a divider on Arduino Tx is clearly good practice but I have never heard of anybody actually frying Bluetooth by omitting this, so don't panic.

Note that HC 05 has two levels of AT commands. Some more obscure commands require a signal on EN even if you have a button.

You will be a lot better off reading Martyn Currey than Instructables.

Thank you for everyone's' help I really appreciate it. I found out that I needed to give the AT commands on a blank sketch in combination of the resistors.

Ola a todos.
Vou deixar a minha experiencia desafortunada aqui com esse modulo. Ele é muito chato e os comandos podem ser diferentes do que vemos por ai. Mas no meu caso, essa lista funcionou no HC-06 ( HC-05_ATCommandSet.pdf.

O que nao estava funcioando para mim era setar os parametros, como NAME e PSWD...
Entao eu "descobri" no meu modulo, a ordem de envio do \n e \r importavam.

Meu código esta o tempo todo assim:

int32_t AT_CMD(const char *s){
	int len = 0;
	len = sprint(strBuffer,"%s\n\r",s);
...
}

Depois de muito procurar nao resolvi o problema.
Ressalto que dessa forma as requisicoes funcionam todas (AT+ RESET, NAME, UART, PSWD...)
Mas se eu enviar AT+NAME:HC000, retornava ERRO:(0)

Entao resolvi alterar a ordem de \n\r para \r\n e funcionou.

int32_t AT_CMD(const char *s){
	int len = 0;
	len = sprint(strBuffer,"%s\r\n",s);
...
}

Fala serio.... kkkk
Espero que ajude alguem.

Hi @rafaelcremm ,

thanks for sharing your experience. Unfortunately not everyone understands Portuguese (unless with some help :wink: )

obrigado por partilhar a sua experiência. Infelizmente, nem toda a gente percebe português (a não ser com alguma ajuda :wink: )

Translation by deepL:

Hello everyone.
I'm going to share my unfortunate experience with this module. It's very annoying and the commands can be different from what you see out there. But in my case, this list worked on the HC-06 ( HC-05_ATCommandSet.pdf.

What wasn't working for me was setting the parameters, such as NAME and PSWD...
Then I ‘discovered’ in my module that the sending order of \n and \r mattered.

My code looks like this all the time:

int32_t AT_CMD(const char *s){
	int len = 0;
	len = sprint(strBuffer,‘%s\n\r’,s);

}

After much searching, I haven't solved the problem.
I'd like to point out that all the requests work this way (AT+ RESET, NAME, UART, PSWD...).
But if I sent AT+NAME:HC000, it returned ERROR:(0)

So I decided to change the order from \n\r to \r\n and it worked.

int32_t AT_CMD(const char *s){
	int len = 0;
	len = sprint(strBuffer,‘%s\r\n’,s);

}

Seriously.... kkkk
I hope it helps someone.

Translated with DeepL.com (free version)

1 Like

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