Problems with HC-05 module

Hello, I have been trying to conect and develop a program to work with a blutooth module, but the problem is that my cellphone is unable to detect the module (Most I've been able to do is recognize its Address, but it won't connect. I managed this by changing it's AT Class), I am currently using a Xiaomi Note 5, and I've also tried with a Motorolla Zenphone play.

Currently I am stuck as are the student's for my class, any help will be appreciated.

Thanks
Video where I display the problem

HC-05 is Bluetooth classic.
Not sure what your smartphones are BLE or not.

.

The Xiaomi is Android and HC-05 should work with it as it comes out of the box. No fartarsing about with AT commands. I guess the Motorola is Android as well. Hopefully, you didn’t change the class, you are just kidding yourself, but you might just check to ensure it is still “0”. If it isn’t you might send an AT+NAME?, which may be quite revealing.

pabloamieva:
trying to conect and develop a program to work with a blutooth module

One wonders what that is all about. HC-05 is just an SPP device that passes data wirelessly. It doesn’t actually need much programme development, and most of the issues with Bluetooth are procedural.

pabloamieva:
I’ve been able to do is recognize its Address, but it won’t connect.

If the phone will recognise Bluetooth in any way, it IS connected. That is how it gets recognised. Your problem sounds more like improper connection to Arduino - RxRx. Note particularly that Bluetooth has two communication facilities, and proper phone<>Bluetooth connection, is no guarantee of proper Bluetooth<>Arduino connection.

Posting wiring, including a comment on power supply, and code would be a good idea.

Follow every steps as outlined below and put tick mark when done.

1. Make connection between UNO and HC05 BT using soft UART Port (SUAR) as per Fog-1.
hc5-1.png
Figure-1:

2. Check that RED-LED of BT blinks at about 1 blink/sec.

3. Launch BT Terminal in your Android Phone and pair it with BT. Check that the RED-LED blinks once a while.

4. Upload the following sketch in UNO.

#include<SoftwareSerial.h>  //needed to create/operate SUART Port
SoftwareSerial SUART(2, 3);  //SRX = DPin-2, STX = DPin-3

void setup()
{
  Serial.begin(9600);
  SUART.begin(9600);  //SUART Port works well at this buad rate
}

void loop()
{
  if (Serial.available() > 0) //check if char comes from Serial Monitor
  {
    char x = Serial.read();
    SUART.println(x);
  }
  if (SUART.available() > 0) //check if char comes from Serial Monitor
  {
    char y = SUART.read();
     Serial.println(y);
  }
}

5. Open the Serial Monitor (Fig-2) at Bd = 9600. Choose 'No line ending' in the 'Line ending tab'.


Figure-2:

6. Enter A in the InputBox of Serial Monitor and click on the Send button.

7. Check that A has appeared on the BT Terminal of the Phone.

8. Enter B in the ASCII Command Field of the Phone and click on Send ASCII button.

9. Check that B has appeared in the OutputBox of Serial Monitor.

hc5-1.png

Nick_Pyner:
If the phone will recognise Bluetooth in any way, it IS connected. That is how it gets recognised. Your problem sounds more like improper connection to Arduino - RxRx. Note particularly that Bluetooth has two communication facilities, and proper phone<>Bluetooth connection, is no guarantee of proper Bluetooth<>Arduino connection.

Here is a video where I try to connect through blutooth to the device, this didn’t show at all until I changed the class from 000000 to 00001. Screenrecorder-2020-04-29-13-08-03-880.mp4 - Google Drive

I already verified through the AT command BT+ADDR? that the address shown there is indeed the address of my HC-05 and not another device that could be showing up
I have the HC-05 connected to the 5V pin of arduino, and right now TXD and RXD are connected to digital pins 10 and 11, which were made Rx and Tx by using the Softwareserial library

I am surprised that you have no reaction to the steps of my Post#3.

pabloamieva:
Here is a video where I try to connect through blutooth to the device, this didn't show at all until I changed the class from 000000 to 00001. Screenrecorder-2020-04-29-13-08-03-880.mp4 - Google Drive

I already verified through the AT command BT+ADDR? that the address shown there is indeed the address of my HC-05 and not another device that could be showing up
I have the HC-05 connected to the 5V pin of arduino, and right now TXD and RXD are connected to digital pins 10 and 11, which were made Rx and Tx by using the Softwareserial library

This is all meaningless, and there is nothing in the video that merits watching. If in fact you have actually read reply#2, and are referring to that, note that I said check what the class actually is, not send the class command. Similarly, check the name, AT+NAME**?**. The address is just a gaggle of numbers, marginally useful for you at this point, and no use at all for anybody else. Come to think of it, you can get the name when you sniff with the phone. So humour us...

By description, the wiring sounds kosher. Note the voltage divider on Arduino Tx in reply#3, which is good practice. I guess you want to keep the power supply secret.

GolamMostafa:
I am surprised that you have no reaction to the steps of my Post#3.

Well, the thing is I can’t test it out since I can’t pair the phone to the Bluetooth. So there is no way to get past step 3, sorry.

Nick_Pyner:
This is all meaningless, and there is nothing in the video that merits watching. If in fact you have actually read reply#2, and are referring to that, note that I said check what the class actually is, not send the class command. Similarly, check the name, AT+NAME**?**. The address is just a gaggle of numbers, marginally useful for you at this point, and no use at all for anybody else. Come to think of it, you can get the name when you sniff with the phone. So humour us…

By description, the wiring sounds kosher. Note the voltage divider on Arduino Tx in reply#3, which is good practice. I guess you want to keep the power supply secret.

I am sorry I forgot to mention the power supply, it is just the standard 5V pin of the arduino UNO. I’m attaching a screen capture of the name and the actual class it displays. The video just displays the issue in that I can’t seem to connect to the HC-05, it doesn’t display its name and just shows the address but no connection can be made. Should the divider matter just for the sake of connecting the device? Maybe I am wrong, but as far as I understand it would affect the data sent/recieved, but it is not pertinent to my actual problem as of now.

Also I don’t understand what you mean by the wiring being kosher, can you please elaborate?

pabloamieva:
Well, the thing is I can't test it out since I can't pair the phone to the Bluetooth. So there is no way to get past step 3, sorry.

Hopefully, you know that the pairing between BT and Phone is possible when the BT is a salve. Are you sure that your BT is a slave? Can you run the AT command and check that it is a slave?

GolamMostafa:
Hopefully, you know that the pairing between BT and Phone is possible when the BT is a salve. Are you sure that your BT is a slave? Can you run the AT command and check that it is a slave?

I just did, it is indeed working as a slave, and I know that the pairing should happen with no problems at all, that is why I’m baffled that this is happening. I am adding a screen cap as proof.

pabloamieva:
Well, the thing is I can't test it out since I can't pair the phone to the Bluetooth. So there is no way to get past step 3, sorry.

OK. There are only two reasons that I can think of for this.

  1. You have Bluetooth in AT mode while trying to connect to phone. Start over again, and keep your fingers off the button, just four wires.
  2. Your phone is BT4 but incompatible with "classic" bluetooth, which is most unlikely. Even if it is incompatible, it will probably see it but refuse to connect.

The best thing in your post is the PNG. The responses from the phone prove:

  1. your wiring is OK (OK, kosher means all according to the book)
  2. the class it is currently in, and you were just kidding yourself when you said you had changed it.
  3. It really is an HC-05 - a matter which was indeed questionable.

I am sorry I forgot to mention the power supply, it is just the standard 5V pin of the arduino UNO. I'm attaching a screen capture of the name and the actual class it displays. Should the divider matter just for the sake of connecting the device? Maybe I am wrong, but as far as I understand it would affect the data sent/recieved, but it is not pertinent to my actual problem as of now.

By power, I meant the whole thing. It was code for "please don't tell us you are using a 9v PP3 battery". Running Bluetooth off the 5v is correct but it is actually a 3.3v device. You will probably see advice to this effect on the back of the module. The divider reduces Arduinos 5v Tx signal to 3.3v . As I said, it is just good practice. The fact that you haven't fried anything suggests you can get away without it, it took me a year to find out about it and some people never do.

, it doesn't display its name and just shows the address but no connection can be made.

I have never heard of this. I am guessing but it could be that phone might know Bluetooth is in the area but cannot do anything because HC-05 is in the wrong mode, i.e. AT mode.

My only experience was with an old phone. It could get the NAME of a BT4 but it refused to connect. That particular BT4 was not backward compatible.

Understand that pairing is done in phone's Setup, connecting is done in the app.

Thanks for your help in helping me understand some of the terms. The power is being supplied by my PC through a USB cable, I am not using my Arduino on its own by using a 9v or 4AA batteries or anything.

I have checked that my HC is not in AT mode (the LED blinks roughly 2 or 3 times per second) I will try to record a video showing my setup and everything so I can show it to you in hopes that it can help to solve the problem.

Stills, or a clear diagram will suffice. These things are often just a matter of procedure. It is clear that you are not in AT mode by mistake. It may be that your problems are all at the phone end.

You might find the following background notes useful.