HC-05 is in AT mode but not responding to any command

good evening,

like i said in the title, i'm not getting any response from my hc-05 module when in AT mode.
pairing with my phone is working. the led on my module is indicating all states correctly (AT mode, paired, discovery).

i followed a tutorial and also used the code provided there. wiring is correct according to said tutorial.

tutorial:
http://www.instructables.com/id/Modify-The-HC-05-Bluetooth-Module-Defaults-Using-A/all/

wiring:

code:

/*

AUTHOR: Hazim Bitar (techbitar)
DATE: Aug 29, 2013
LICENSE: Public domain (use at your own risk)
CONTACT: techbitar at gmail dot com (techbitar.com)

*/


#include <SoftwareSerial.h>

SoftwareSerial BTSerial(10, 11); // RX | TX

void setup()
{
  pinMode(9, OUTPUT);  // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
  digitalWrite(9, 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());
}

baudrate in serial monitor is set correctly and new line is set to \r\n

after i see "Enter AT commands:" in serial monitor i type AT, send it and nothing happens.

i tried to use bluetooth in a different project and failed to configure my module programatically, so i discovered that the source of evil is my module not responding to AT commands and now i'm trying to figure out why.

thanks in advance for any help

second module i tried didn't response aswell

I think you have the same problem as i do.
i just found a solution : I need help with HC-05 module - Networking, Protocols, and Devices - Arduino Forum

Also the slow flashing when successfully pairing the module apparently wasn't AT Command as i thought too.

Did you find a solution npag?

I am having the same problem. I know my module is in AT mode but I can't get it to respond to anything through the serial monitor. I've tried connecting through ftdi adapter and uno but still nothing.

Could you please post a photo of your cabled hardware?

Even i am facing the same problem...moreover my HC-05 module is not discoverable by my android....

Kaustav_Sarkar:
my HC-05 module is not discoverable by my android....

It might be time to start from scratch. Is the LED on HC-05 flashing about 2Hz?

  1. Connect EN,5V of Bluetooth module pin together at arduino 5v pin and ground pin to arduino ground pin.

  2. Upload empty sketch.

  3. connect RX and TX pin from Bluetooth module to arduino RX and Tx pin.

  4. Remove arduino usb cable from laptop and you will notice one push button at Bluetooth module.

  5. Press that Bluetooth module and don't let go, at that same time connect usb cable to laptop. Let go the push button and you will notice led at Bluetooth module will blink slowly which mean at AT-COMMAND.

  6. Open IDE and click Serial Monitor. Change from no-line ending to Both NL & CR.

  7. Set Baud Rate to 38400 baud.

  8. Enter AT command.

3 Likes

Hello, i have a problem with AT mode,
I check so many times my connections and its true i swear god.
My code is same with yours, but i type AT to console it response like "xxxx⸮" all other commands is the same start with AT+... .
Also i changed no line ending to both NL & CR.

How can i fix this is any one help me ?

same problems here, anyone able to find a solution (I just ordered 2 more HC-05 Modules off of Amazon so hopefully one of those will work.

reallyfastlearner:
I just ordered 2 more HC-05 Modules off of Amazon so hopefully one of those will work.

Don't throw the old ones away. When you get the new ones to work, re-install the old ones. They don't have a reputation for duds, and they might just work.

I was having the same problem from the original topic by npag and I JUST SOLVED IT.

Using the exact same code he presented, I solved the problem just by adding the proper {} signs to the if statements in the loop() function.

The code finally looks like this:

/*

AUTHOR: Hazim Bitar (techbitar)
DATE: Aug 29, 2013
LICENSE: Public domain (use at your own risk)
CONTACT: techbitar at gmail dot com (techbitar.com)

*/

#include <SoftwareSerial.h>

SoftwareSerial BTSerial(10, 11); // RX | TX

void setup()
{
pinMode(9, OUTPUT); // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
digitalWrite(9, 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());
}
}

The "proper {}" signs are not strictly necessary on the "if"s (though everyone should agree they are a Good Idea TM), so I'm not sure what you've solved.

Please remember to use code tags when posting code.

It's RX/TX connection problem. They must be crossed to the HC05. Furthermore, the AT+NAME is only working when the button on the HC05 is clipped. Here is my LinkedIn article about this problem: Add Arduino IDE to Visual Studio Community 2017 with a New Project: Change Name & Password of Bluetooth Module HC05

// Visual Micro is in vMicro>General>Tutorial Mode
//
/*at
Name: HC05_change_name_n_pass.ino
Created: 9/8/2018 4:07:51 PM
Author: homan-mobile\Homan Huang
*/

// Define User Types below here or use a .h file
//
#include <SoftwareSerial.h>

//set ports
// state pin
#define rx 10 // => HC05: tx
#define tx 11 // => HC05: rx
// GND pin
// 5V pin
#define cmd 8 //EN pin

SoftwareSerial BTserial(rx, tx); // RX | TX of Arduino

char reading = ' ';

// BTconnected will = false when not connected and true when connected
boolean BTconnected = false;

// The setup() function runs once each time the micro-controller starts
void setup()
{
// start serial communication with the serial monitor on the host computer

// set input through EN pin
pinMode(cmd, OUTPUT);
digitalWrite(cmd, HIGH);

//Serial turns on in 1 second
delay(1000);

// wait until the HC-05 has made a connection
while (!BTconnected)
{
if (digitalRead(cmd) == HIGH) { BTconnected = true; };
}

Serial.begin(9600);
Serial.println("HC-05 is now connected");
Serial.println("");

// Start serial communication with the bluetooth module
// HC-05 default serial speed for communication mode is 9600 but can be different
Serial.println("Enter AT commands:");

BTserial.begin(38400); // HC-05 default speed in AT command mode
}

void loop()
{
// Keep reading from HC-05 and send to Arduino Serial Monitor
if (BTserial.available())
{
reading = BTserial.read();
Serial.write(reading);
}

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

1 Like