Problem with HC-05 bluetooth Module

Hello there !

I just bought my HC-05 bluetooth module and I can´t be able to configured it. I already conected and when send AT to serial monitor im having no response and I should be receiving OK.
This happens with all the rest of the commands as well.

The weird thing is that I can connect my android to the HC-05 module, but it isn´t receiving or sending any data to it . Ill try with 6 different aplications.

This is my conection :

RXD = 6
TXD = 5
EN (In the tutorial i´ve seen it appears “KEY” but there is EN instead, so i think is this one.) = 3
GND = GND
VCC = 5v.

And this is my code :

#include <SoftwareSerial.h>

SoftwareSerial BTSerial(6, 5); // RX | TX

void setup()
{
pinMode(3, OUTPUT);  // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
digitalWrite(3, HIGH);
Serial.begin(9600);
Serial.println("Enter AT commands:");
BTSerial.begin(38400);  // HC-05 default speed in AT command more
}

void loop()
{

// Keep reading from HC-05 and send to Arduino Serial Monitor
if (BTSerial.available())
Serial.write(BTSerial.read());

// Keep reading from Arduino Serial Monitor and send to HC-05
if (Serial.available())
BTSerial.write(Serial.read());
}

I already tryed changing the pins to 10, 11.
Tryed disconnecting the EN pin,
Tried changing 5v to 3.3v.
I don´t know what else to try and its driving me crazy.
Please help.

Aureliano24: The weird thing is that I can connect my android to the HC-05 module, but it isn´t receiving or sending any data to it .

There is nothing weird about that. Android connects with Bluetooth without any involvement from Arduino other than providing power. Similarly, Arduino can send data to Bluetooth without any connection to Android.

I have used

http://www.martyncurrey.com/?p=1348

to configure HC-05. He has two methods. Your code is probably OK and the problem is just procedure.

Not sure if this is it, but I also have an hc05 with no pin labeled key. The en pin on mine is not wired to the right pin to put it in at mode. Mine has a small button on the breakout board. You have to hold down that button. Failing that you may need to solder a wire to the pin. (Pin 34). If you have a multimeter verify that pin 34 is connected where you think it is.

I try the thing with the button. It kind of work. It seems now that the bluetooth module is entering in at mode.
This is what im getting when I send AT to serial monitor :

ϧ†…

I already try changing the baud´s levels, and configuring it according this page :

Now, how do I solve this ?

If you don't get out figured out by then I'll have time to play with mine and your code after work tomorrow. It's sounds like we have the same type of module.

Aureliano24:
Now, how do I solve this ?

Check the baud rate of the monitor. The commands to bluetooth are 38400 but serial monitor is 9600

I ´ll tryed already changing de baud rate of serial monitor and bluetooth module. I make all the combinations that ocurred me. Still doesn´t work.

There is only one speed for config mode - 38400. The monitor speed must match your declared speed in the programme - 9600.

This suggests a possible speed problem.

This is what im getting when I send AT to serial monitor : ϧ†…

This is code. As you can see everything matches

My aplications on android worked ! But im still not able to enter in AT mode.

I copy pasted your code, hooked up the HC-05 and it's working fine for me. I would check all your connections, it's definitely not the code. and if you are getting the slow blinking light on the HC-05 it's in command mode.

Aureliano24: My aplications on android worked !

Having Android working is not entire proof! You still need the pin 34 connection and the right steps.

Hi Aureliano24, I have the same problem as you, i'm receving ϧ†… instead of OK. If you solve the problem, please share the solution. Thanks in advance.

You cannot use softwareserial at 38400 I guess.. This is what HC-05 user manual says:

AT Mode 1: After power on, it can enter the AT mode by triggering PIN34 with high level. Then the baud rate for setting AT command is equal to the baud rate in communication, for example:9600.

AT mode 2: First set the PIN34 as high level, or while on powering the module set the PIN34 to be high level, the Baud rate used here is 38400 bps. Notice: All AT commands can be operated only when the PIN34 is at high level. Only part of the AT commands can be used if PIN34 doesn’t keep the high level after entering to the AT mode. Through this kind of designing, set permissions for the module is left to the user’s external control circuit, that makes the application of HC-05 is very flexible.

During the process of communication, the module can enter to AT mode by setting PIN34 to be high level. By releasing PIN34, the module can go back to communication mode in which user can inquire some information dynamically. For example, to inquire the pairing is finished or not.

pito:
You cannot use softwareserial at 38400 I guess…

Aha! That’s interesting. Time to beg, borrow, or steal a Mega?

nmfontes: Hi Aureliano24, I have the same problem as you, i'm receving ϧ†… instead of OK. If you solve the problem, please share the solution. Thanks in advance.

I led you know.

pito: You cannot use softwareserial at 38400 I guess.. This is what HC-05 user manual says:

is there any way I can use softwareserial at 38400 ?

DallasMatSci: I copy pasted your code, hooked up the HC-05 and it's working fine for me. I would check all your connections, it's definitely not the code. and if you are getting the slow blinking light on the HC-05 it's in command mode.

I connected and disconect the damn thing like a lot of times. Soo. . . I don´t think is this, maybe you have a different model of HC-05 ?

If you want to use the Arduino IDE to send the AT order, you should connect RX to RX0, and TX to TX0... So does the ESP8266

I know this is a really old thread but just in case anyone else has run into these problems I will post my solution,…
After a day of seriously frustrating trial and error, I can now reliably use the BT module in AT mode.

So, some boards have the EN pin (instead of KEY) which is not connected to PIN34 (PI011) and needs a jumper wire soldered to this pin (the upper-most pin on the right of the HC-05, or the 5th pin from the bottom on the HC-06). Other boards have a WAKEUP pin which I assume is equivalent to the EN pin. Anyway, my BT module did not have a button, but some do which needs to be depressed before and during power-up to put the module into “half” AT mode, in which not all AT commands will work. To put it into “full” AT mode, the jumper wire on PIN34 needs to be held HIGH at 3.3V.
It is easier to simply connect the jumper wire to 3.3V before power up, and this is necessary anyway if the module does not have a button. Now, the LED on the module should be blinking slowly (on 2s, off 2s).

Ok, so this will set the module into AT mode, but at a set baud rate of 38400. When using this baud rate, I had a similar problem to others in this thread: the module was returning weird characters like ϧ†… instead of "OK". It would seem that the SoftwareSerial library can’t work on 38400 baud as suggested earlier in this thread and produces errors if it is on 38400. Either that, or it is a problem with the IDE version I have.

Update: I read on this instructable - http://www.instructables.com/id/Modify-The-HC-05-Bluetooth-Module-Defaults-Using-A/ - that there is a problem with IDE versions below 1.6.1 in linux that doesn’t work with 38400 baud. To use the module’s 38400 baud rate, upgrade your IDE to 1.6.1 and it should not be displaying strange characters.

The solution: The module can be set to a user-defined rate, which by default is 9600 baud, known to work with SoftwareSerial previous IDE versions. This is done by pulling PIN34 HIGH after power-up of the module. Unlike with the first AT method, this method does not make the led blink slowly; it continues blinking quickly as it would if it was trying to pair with another device. Although there is no indication that it’s mode has changed, the module should now be in AT mode at 9600 baud.

Once in “full” AT mode, the baud rate can be configured with the AT+UART=<baudrate>,<numberofstopbits>,<paritybit> command.

Here is my code, which I have tested with an Arduino UNO, IDE version 1.0.3 on Linux. I also used a buffer to store the AT commands before sending/receiving them.

#include <SoftwareSerial.h>

int buf[64]; //buffer to store AT commands
int len = 0; //stores the length of the commands

SoftwareSerial mySerial(10,11); //RX, TX

void setup()
{
  Serial.begin(9600);
  Serial.println("Enter AT commands:");
  mySerial.begin(9600);
}

void loop()
{
  if(Serial.available())
  {
    delay(100); //wait for serial data to arrive
    len = Serial.available(); //store number of bytes to read
    for(int i = 0; i<len; i++) //store all bytes into the buffer
    {
      buf[i] = Serial.read();
    }
    for(int i = 0; i<len; i++)
    {
      mySerial.write(buf[i]);
    }
  }
  
  if(mySerial.available())
  {
    delay(100); //wait for serial data to arrive
    len = mySerial.available();
    for(int i = 0; i<len; i++)
    {
      buf[i] = mySerial.read();
    }
    for(int i = 0; i<len; i++)
    {
      Serial.write(buf[i]);
    }
  }
  
}