Bluetooth module not responding

Hello everyone !

I am trying to connect a bluetooth module to my phone to send commands.
It is possible to pair the module (we enter the PIN code and it works) but then impossible to connect to the module, tested on 2 phones and a computer.
I tried with 2 HC-06 modules and an HC-05 and the result is the same.
I tried different code, it doesn't change anything either.

Here is the only wiring I tested for the HC-05, I tested without resistors with the HC-06s.


The resistors are 1k and 2k (I put 2x1k).

When I try to use AT commands, the module doesn't even respond. I used this tutorial: Arduino and Bluetooth module HC-05 • AranaCorp
I really don't understand where the problem comes from.

Especially since two years ago, I had followed a video to control a led with an android app and it worked without problems with the HC-06, same wiring, same program.

Could the problem come from the Arduino UNO? Elsewhere ?

Successful pairing only proves your power connection is kosher. Check that the comms wiring is correct Tx>Rx and Rx>Tx.

Do not connect the EN (KEY) pin to 5V. Connect to 3.3V only.

To put the HC05 in AT mode, connect as shown then power up the Uno. The Led should flash on for about 2-3 seconds an off 2-3 seconds if in AT mode.

Load the following (tested and working on my setup)

#include <SoftwareSerial.h>
SoftwareSerial BTserial(2, 3); // RX | TX

const long baudRate = 38400;
char c = ' ';
boolean NL = true;

void setup()
{
   Serial.begin(9600);
   Serial.print("Sketch:   ");   Serial.println(__FILE__);
   Serial.print("Uploaded: ");   Serial.println(__DATE__);
   Serial.println(" ");

   BTserial.begin(baudRate);
   Serial.print("BTserial started at "); 
   Serial.println(baudRate);
   //BTserial.print("BTserial started at "); 
   //BTserial.println(baudRate);
   Serial.println(" ");
}

void loop()
{
   // Read from the Bluetooth module and send to the Arduino Serial Monitor
   if (BTserial.available())
   {
      c = BTserial.read();
      Serial.write(c);
   }

   // Read from the Serial Monitor and send to the Bluetooth module
   if (Serial.available())
   {
      c = Serial.read();
      BTserial.write(c);

      // Echo the user input to the main window. The ">" character indicates the user entered text.
      if (NL)
      {
         Serial.print(">");
         NL = false;
      }
      Serial.write(c);
      if (c == 10)
      {
         NL = true;
      }
   }
}

You should be able to enter AT commands and see the responses from the HC05. Sometimes the first time, after a reset, that you send "AT" you will get "error" for a response. Try again and usually you will get "OK".

See also this page by Martyn Currie.

What app on the phone are you using to connect with the previously paired module?
I would suggest Kai Morich's Serial Bluetooth Terminal

No code is needed. Just give 5v power to the HC05. The app should find the module and you can connect.

The flashing light on the HC05 should change from a rapid flash (about 5 times a second which indicates unconnected) to double quick flash every 2 seconds (indicates connected to another device).

1 Like

I guess that I am confused. Is the problem that it will not connect to a Bluetooth app on a phone, PC or tablet? Or is it a problem with entering and using AT mode with the Uno? The 2 things are completely different.

+1 for the serial Bluetooth terminal app.

Good evening and thank you for your answers.

I followed the wiring as @groundFungus showed. I set the EN pin to 3.3v.
AT mode seems to be activated: led ~3s off then ~4s on

Unfortunately, the module does not respond when I send AT (tried several times). I do not understand why.

I tried AT commands, just to see if the module at least worked with that. But I only intend to use the module with an application on an android smartphone.

The bluetooth serial terminal application shows that I am connected even if it does not appear in the bluetooth settings of my phone.
How to make it work with another app?
I would like to use app from: https://howtomechatronics.com/tutorials/arduino/diy-arduino-robot-arm-with-smartphone-control/

I have heard of some HC05 modules that use 9600 baud for AT mode, though I have not seen any. It is worth a try, i suppose.

Install the app on your phone, load the code which responds to it on your Arduino, and have a go. The HC05 is just a bridge between the app and the Arduino.

Not better at 9600 baud. :slightly_frowning_face:

When I use the application it wants to connect but when I perform a command (at), I have: Error 516: Unable to write: Broken pipe.

The connected application is in Data mode with the HC05 and the HC05 won't respond to AT commands.

I did 2 different tests and therefore codes: one to test AT commands and the other to receive commands from the application.

So, in an attempt to avoid any confusion, what was the result of each test?

Excuse me, I expressed myself badly.

When I set 9600 bauds, when I send the "AT" command, the module does not respond, it does not return "OK". (several attempts).
When I upload the code made to go with the application and therefore, ready to receive commands from an app, I can very well connect the module (led which flashes differently) but the module seems not to understand the commands sent.

I followed another tutorial to control an on/off led.
When I send 1 or 0, the serial monitor does not display anything despite the module being connected.
https://create.arduino.cc/projecthub/brillianttechnoz/controlling-led-using-hc-05-bluetooth-module-8d73b6

---------------

When I try with the Bluetooth Terminal app, it displays a lot of @^@^@ which is bugging my phone.

Nor should it. Use 38400 when sending AT commands.

It is not Bluetooth's job to understand anything. It merely receives information and passes it on. The understanding is done by Arduino.

This suggests Bluetooth is working, and whatever problems you have lie elsewhere. It could be simply the wrong baud rate. Since you are incapable of using AT mode, make sure the rate is the default 9600 in your Arduino programme.

You might find the following background notes useful.

I was told to try with 9600 baud but I had already done with 38400 baud and the result is the same.

It seems to work better when I use pins 0 and 1 of my arduino. The problem is solved but I don't understand why we can't connect directly in the phone's bluetooth settings.

What problem? You appeared to have two different issues. One with AT mode, and one with Data mode

I don't understand why we can't connect directly in the phone's bluetooth settings.

Connection is done by an app. The phones bluetooth settings are to pair the device so that the app can make the connection.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.