Bluetooth Module HC-05 Not responding to AT commands and blinks fast

Im working on a robot that will be controlled with a bluetooth connection. I just started the project and I had never used bluetooth modules before. I researched online and found some tutorials… I proceded to connect the module and write the code, and then when I upload it the BT Module blinks really fast (3 times per second approximately) and in the serial monitor (in NL & CR) when I write AT or any command I don’t get any response…

I tried changing the speed both on the serial monitor and on the code itself but I still wasn’t getting any responses from the module, just in some special cases I got corrupted responses with symbols, Xes, and �.

This is the code:

#include <SoftwareSerial.h>

SoftwareSerial serial2(3,4);

void setup(){
Serial.begin(9600);
serial2.begin(38400);

pinMode(2,OUTPUT);
digitalWrite(2,HIGH);

Serial.print(“AT Commands”);

}

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

if(serial2.available())
Serial.write(serial2.read());
delay(200);
}

First post btw.

What worked for me was http://tronixlabs.com.au/news/tutorial-using-hc06-bluetooth-to-serial-wireless-uart-adaptors-with-arduino/

Ignore that it refers to HC-06. It worked for the HC-05 modules I purchased on eBay.

You make no mention of putting the HC-05 into AT mode, which you must do before you can send it AT commands, and indeed the "really fast" blink confirms that you have not done this. When in AT mode, the LED blinks at about one flash every two seconds.

I believe your code is kosher, and your problem may simply be wiring. It looks like you may just need to connect Arduino pin 2 to the KEY pin on bluetooth

There are several ways of configuring the HC-05, and they depend on the breakout board the the module is on. Some have a button, some don't. The hairy-chested guru on this stuff is Martyn Currey, who blesses us with the way he spells his name and is easy to Google.

But you might do that after you have seriously considered that you really need to configure the HC-05 at all. "Controlled with a bluetooth connection" doesn't explain much and may mean you don't.

Be aware that, if you do, the HC-05 and HC-06 have different configuration procedures, and the only way the abovementioned tronixlab link will work is if you don't have an HC-05, but actually an HC-06.

Also note that, no matter what rate you are using in comms mode, the HC-05 only uses 38400 in AT mode, so don't fiddle with it. The corrupted responses you refer to are almost certainly caused by changing the serial speed in the code but neglecting to match that in the monitor. There is no need to fiddle with that either.

Reply to Nick_Pyner

Nick_Pyner: I believe your code is kosher, and your problem may simply be wiring. It looks like you may just need to connect Arduino pin 2 to the KEY pin on bluetooth

I have double checked the wiring and I have everything connected like Im supposed to... Key -> Pin 2 Vcc -> 5v (My module supports from 3.6v to 6v) Gnd -> Arduino Gnd Txd -> Pin 3 Rxd -> Pin 4 State -> Nothing cause im not using it.

I have no idea what is making the module to give any responses back and I dont really like the idea of re-configuring it.

As I said, the configuration procedure depends somewhat on the breakout board you are using, about which you say nothing, and I have given you a reference to a site that deals with the variations, which I guess you haven't bothered to look at.

Liking the idea of reconfiguring it is up to you. Since you don't know what you are doing, it seems rather likely that you have never reconfigured it in the first place, and my question was about whether you need to reconfigure it at all.

It is not likely to have a bearing on your problem, but it is good practice to have a 1k/2k voltage divider on the bluetooth Rx.

I found the reason my module wasnt receiving any AT commands…

You have to make sure the Key pin is connected to Vcc when sending some AT Commands. I simply had to hold the button down that my module has while pressing ENTER in the terminal and sending a command.
Apperently the button allows vcc to connect to the Key pin. To enable AT mode you also have to hold the button while uploading the code to the arduino.