Couldnt use AT commands

Hi!

Im in trouble with serial communication. I got two bluetooth modules, HC05 and HC06. And both of my modules doesn’t respond to my AT commands.

First I tried HC05. I push the button when I power up my module, and LED starts blinking in every 2 seconds. Seems fine so far. And my connections:

VCC → Arduino 5V
GND → Arduino GND
RX → D11
TX → D10

And here is my code:

#include <SoftwareSerial.h>
SoftwareSerial BTserial(10,11); 

 
 
void setup() 
{
    Serial.begin(9600);
    Serial.println("Enter AT commands:");
 
    BTserial.begin(9600);  
}
 
void loop()
{
 
    // Keep reading from HC-06 and send to Arduino Serial Monitor
    if (BTserial.available())
    {  
        Serial.write(BTserial.read());
    }
 
    // Keep reading from Arduino Serial Monitor and send to HC-06
    if (Serial.available())
    {
        BTserial.write(Serial.read());
    }
}

I can get the values with this code, whatever I send my phone is displayed on the serial monitor. So I’m sure about the baud rate speed.

I also tried this with HC06 (without pushing button since there is no button) and with different Arduinos. But when I send AT commands, they don’t respond. Whats wrong with me? Im going bananas.

I also just had a problem with DS3231 time module, I couldn’t get time on serial monitor. So Im in trouble with that serial communication :confused:

Possibly wiring RxRx.

You might find the following background notes useful.

http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf
http://homepages.ihug.com.au/~npyner/Arduino/BT_2_WAY.ino

also bildr Do You Have The Time? DS1307 RT Clock + Arduino - bildr works with DS3231

Nick_Pyner:
Possibly wiring RxRx.

You might find the following background notes useful.

http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf
http://homepages.ihug.com.au/~npyner/Arduino/BT_2_WAY.ino

also bildr Do You Have The Time? DS1307 RT Clock + Arduino - bildr works with DS3231

No sorry, that’s not the problem. I have tried to change this, and also I can see what I send from my phone in serial monitor.

Thanks for documents!

Serial monitor?

So the Bluetooth modules are paired with your smartphone?

change the B.rate to 115200..

AT commands are serial.print, not serial.write. For AT mode, HC-06 baud rate is 9600 but HC05 is 38400, and you should rigorously ignore reply #4 above.

If you can see data from phone in serial monitor then, clearly, there is not much wrong with your wiring, power, or code for that purpose, but you still need to prove transmission, even though you have already proven the hard part kosher.

Your problem may still be slack-arsed Tx wiring!