HC05 bluetooth module doesn't connect to smartphone

Hi.I want to connect to the mobile phone with bluetooth. But when I upload the program, the LED light of the Bluetooth module does not turn on and the phone does not recognize the module. Please advise. I use ESP8266 and HC05.
This is my code:

#include <SoftwareSerial.h>
#include <Servo.h>

SoftwareSerial BT(13,12);  //RX , TX pins

char state=0;

int servoPin = 0;
Servo servo;

void setup() {
Serial.begin(9600);
BT.begin(9600);
servo.attach(servoPin);
//servo.write(90);
}

void loop() {
  if (BT.available() >0) {
    state = BT.read();
    Serial.print(state);
    if(state == '1'){
      servo.write(50);
  }
    else if(state == '0'){
      servo.write(0);
  }
  }
}

This is wiring:

It should be noted that I used to connect under the same conditions, but now I can't.

This is the first thing to correct.

Is the module being powered by 5V?

When the module is powered, but not connected to the phone, what is the blink pattern you see?

When you go into the phone settings>connections>bluetooth do you see any available devices? What phone are you using?

If you see the HC05 as an available device, can you pair with it?

yes I paired it but I cant find bluetooth in the my android app. my smartphone is samsung galaxy a31. I power the module by 5v. and there is no blink

I moved your topic to an appropriate forum category @alija22 .

In the future, please take some time to pick the forum category that best suits the subject of your topic. There is an "About the _____ category" topic at the top of each category that explains its purpose.

This is an important part of responsible forum usage, as explained in the "How to get the best out of this forum" guide. The guide contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

No blink means no power.
Also, have you really nominated the correct pins for software serial on a Node MCU??

The 3 flash patterns of HC05 (ZS-040) modules are:

  1. rapid on, off flash (2 Hz ish) = communication mode, not connected.
  2. rapid flashes (on, off, on, off, takes ≈ 1 second) then a pause (off) of ≈ 2 seconds >> communication mode, connected.
  3. slow flash, ≈2 seconds on, ≈2 seconds off = AT mode

If you are not seeing any flash when not connected the I would suspect power to the module is not correct, or the module is defective.

For testing purposes, I would use Kai Morich's app Serial Bluetooth Terminal. It is very reliable.

Does this app see the paired device and connect with it?

However, if you are not seeing any flash pattern from the unconnected module then All bets are off.

1 Like

yes. the problem is that it sometimes blinks and sometimes doesn't blink

after I upload the code it has rapid flashes but when I connect the app to Bluetooth the flashes become slow, 2second on , 6 seconds off. and I can't move the servos.

It sounds rather like Bluetooth is doing its job properly, i.e. it is responding to the app, and you are blaming the wrong thing.. It doesn't mean your code is kosher, nor does it mean the wiring is correct.

when I connect the app to Bluetooth

Are you now indeed saying that the module connects to the smartphone, but the code does not perform as you expect?

I would forget about the Servos to begin with and remove them from the circuit and the code. Confirm that the bluetooth communications between the Kai Morich app on the phone and the hc05/Arduino are working correctly. Use the Serial monitor to debug.

What are you doing differently now that you fixed in this thread... beginning post 30

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