HC-05 Module AT command mode won't respond

Thread Starter

Shawn Poile

Joined Mar 26, 2020
15
I've been trying to connect two HC-05 bluetooth modules together as master and slave devices. I know that to do this i need to establish one as a slave device and one as a master using the AT command mode. I am using an arduino nano with each of the modules and the circuit i have used is shown:
Vcc -----> 5V
GND ----> GND
Rx ------> Rx
Tx ------> Tx
I followed various online tutorials and have used this code:
#include <SoftwareSerial.h>

SoftwareSerial BTSerial(0, 1); // RX | TX

void setup()
{
Serial.begin(9600);
BTSerial.begin(9600); // HC-05 default speed in AT command more
Serial.println("Enter AT commands:");
}

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());
}
}
Using the button on the module or by setting the EN pin high, i am able to put the module into AT mode as displayed by the LED blinking every 2 seconds. However, i receive no response after sending commands to the module using the serial monitor when i should receive a confirmation of my command.
Any ideas where i'm going wrong?
Thanks in advance
 

ericgibbs

Joined Jan 29, 2010
10,735
hi Shawn,
Have you tried compiling and loading a blank sketch into the Arduino.?
When you do this you can control the Arduino as a USB to Serial converter and directly Write/Read the HC05.
You may have a problem when using a Nano clone or old version, do you have a Uno on the bench.
E
 

Thread Starter

Shawn Poile

Joined Mar 26, 2020
15
hi Shawn,
Have you tried compiling and loading a blank sketch into the Arduino.?
When you do this you can control the Arduino as a USB to Serial converter and directly Write/Read the HC05.
You may have a problem when using a Nano clone or old version, do you have a Uno on the bench.
E
hi Eric,
I have tried this and still got no response. I assumed that code would be needed to interpret the output of the HC05 and that was why it wasn't working but i don't know. I am using a nano clone so that may be the problem, i also don't have an Uno. I am willing to buy one but i wanted to try to solve the problem without that if possible.
Thanks
 

Thread Starter

Shawn Poile

Joined Mar 26, 2020
15
hi S,
When using above method, UNO pin #0 connects RXIn of the HC05 and pin #1 to the TXout of the HC05.
Note the 38400Baud, try both.
See my example below.
E
hi E,
This didn't seem to work either, still no response regardless of baud rate. This is assuming that on a nano pin#0 is RX0 and pin#1 is TX1. I feel like it's probably a hardware issue so i may buy an Uno for this.
Thanks
 

ericgibbs

Joined Jan 29, 2010
10,735
hi Shawn,
With that method, no sketch code is required.
I had a problem last week with a Nano clone last week on a HC05 project, it would not respond as a simple converter.

I tried various web site drivers that were supposed to suit the Nano. CH340 IC

Check the Nano PCB, do you see an onboard converter CH340 IC.??, it may be on the underside of the PCB.

Note:
I did have the Nano as a Master using a sketch I had written, it worked OK when talking to a Uno Slave.
But when I tried it as a USB to UART it would not respond.

Post your lastest Arduino code and will try it with a Nano and HC05..OK.?
E
 

Thread Starter

Shawn Poile

Joined Mar 26, 2020
15
hi Shawn,
With that method, no sketch code is required.
I had a problem last week with a Nano clone last week on a HC05 project, it would not respond as a simple converter.

I tried various web site drivers that were supposed to suit the Nano. CH340 IC

Check the Nano PCB, do you see an onboard converter CH340 IC.??, it may be on the underside of the PCB.

Note:
I did have the Nano as a Master using a sketch I had written, it worked OK when talking to a Uno Slave.
But when I tried it as a USB to UART it would not respond.

Post your lastest Arduino code and will try it with a Nano and HC05..OK.?
E
hi E,
i am testing out a blank sketch but the code i was using is the same as the one i posted previously. I checked up on the product description and found that it does have a CH340 converter on board. I also used the device manager to check my drivers and i have the correct drivers installed.
I'm intending to have it be a master to another slave nano so i need to be able to set each of them.
Thanks
 

Thread Starter

Shawn Poile

Joined Mar 26, 2020
15
I have mine working fine on a nano and micro clones... there are two baud rates in this situation easy to get one incorrect
hi Wolf,
which baud rates would you recommend? I have tried changing both to 38400 or one or the other to 38400 with the same result.
Thanks
 

Wolframore

Joined Jan 21, 2019
1,770
I think the problem is here

SoftwareSerial BTSerial(0, 1); // RX | TX

try different pins, I believe you are interfering with your hardware serial. Try 2/3 or 8/9...

from Arduino.cc
E9908A13-3719-4E4E-B7D7-72A2A3D89F76.jpeg
 
Last edited:

ericgibbs

Joined Jan 29, 2010
10,735
hi Shawn,
Just retried that Nano clone, it requires the 'old bootloader' option in order to program it, but it will not perform as a stand alone USB to UART converter ,between the PC and the HC05.
I can easily program and run the HC05 via the Nano, but it will not respond to 'AT' commands.

Thats why I swapped over to the UNO as a Master [ to set up the HC05 AT commands, as Master and Slave the HC05's] and made the Nano a Slave, works fine.

Unplug the Uart/Serial wires from the Arduino while loading a program.

E
 

djsfantasi

Joined Apr 11, 2010
6,781
Eric... he’ll need to do more than unplug those wires. As it is, he’s using pins 0&1 for the HC-05 AND for input/output to the serial console. Won’t work that way.
 

ericgibbs

Joined Jan 29, 2010
10,735
hi dj,
The way I use for the Arduino Uno when setting up a HC05 module is as follows.
With Uno pins 0 and 1 not connected I compile and load a blank new sketch.
When that blank sketch is loaded to the Uno, reconnect pins 0 and 1 to the HC05. [ the HC05 should have been powered in the Command Mode ie: HC05 led blink about 2 seconds]

I can use the Serial Monitor in the IDE to send AT commands to the HC05 and get the HC05 responses on the monitor.

It works every time with the Uno, but the problem is when using a Nano clone, ie: same problem as the TS.

The web is awash with users trying different fixes for this problem, I have tried a few with no success,

Eric


BTW: the Nano insists I use the 'old boot loader' the latest loader hangs up.
 

Wolframore

Joined Jan 21, 2019
1,770
Just change your software serial to anything but 0,1 and you don’t need to unplug anything, I believe I use 8,9 in my projects. @ericgibbs I see what you’re doing and why you don’t need coding to get yours to work, but when coding final project using other than hardware pins is recommended.
 

ericgibbs

Joined Jan 29, 2010
10,735
hi W,
Of course when I actually load a full function program to the Uno I do follow the recommended method.
The blank sketch is a quick and easy way to set the HC05 mode settings for the intended Master and Slave HC05 commands.

E
 

Thread Starter

Shawn Poile

Joined Mar 26, 2020
15
Just change your software serial to anything but 0,1 and you don’t need to unplug anything, I believe I use 8,9 in my projects. @ericgibbs I see what you’re doing and why you don’t need coding to get yours to work, but when coding final project using other than hardware pins is recommended.
hi wolf,
i tried using various different combinations of pins with the same result. I thought u may have mean the analog pins so i tested them and they did not work either
Thanks
 

Thread Starter

Shawn Poile

Joined Mar 26, 2020
15
hi dj,
The way I use for the Arduino Uno when setting up a HC05 module is as follows.
With Uno pins 0 and 1 not connected I compile and load a blank new sketch.
When that blank sketch is loaded to the Uno, reconnect pins 0 and 1 to the HC05. [ the HC05 should have been powered in the Command Mode ie: HC05 led blink about 2 seconds]

I can use the Serial Monitor in the IDE to send AT commands to the HC05 and get the HC05 responses on the monitor.

It works every time with the Uno, but the problem is when using a Nano clone, ie: same problem as the TS.

The web is awash with users trying different fixes for this problem, I have tried a few with no success,

Eric


BTW: the Nano insists I use the 'old boot loader' the latest loader hangs up.
hi e,
I also use this method of disconnecting rx and tx pins before uploading and it works for me. As for the AT command mode, i've tried many different methods including changing the pins and changing the baud rates etc with no success. I feel like the most likely solution is to buy an Uno and set the modules like you have done. Is it possible to set the modules with the Uno but then plug them back into the circuit with the nano, will it still work the same as slave and master?
Thanks
 

Wolframore

Joined Jan 21, 2019
1,770
did you change the code when you changed the pons?

Vcc -----> 5V
GND ----> GND
Rx ------> 3
Tx ------> 2

#include <SoftwareSerial.h>

SoftwareSerial BTSerial(2, 3); // RX | TX

void setup()
{
Serial.begin(9600);
BTSerial.begin(9600); // HC-05 default speed in AT command more
Serial.println("Enter AT commands:");
}

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());
}
}
 
Last edited:
Top