HC-05 not appearing in scan results

Hi,

I have a problem with my HC-05 not appearing in scan results.

(I'm using an Arduino UNO R3 + motor shield + 2 DC Motors + 9V Battery + HC-05)

I've been trying to make my Robot move using the Serial monitor using Bluetooth terminal app over Bluetooth using the HC-05 Module, So I've tried every single code, solution there is and the best i got was Ok when i send AT in AT mode on the IDE on PC, but with other commands like AT+NAME, nothing comes up even when i changed the baud rate and even tried multiple codes from different sources.

It doesn't appear on scan no matter what i do (I'm using an Android phone and i also tried scanning with pc) but still nothing appears.

This is the code of the robot I'm trying to control using the module:

#include <AFMotor.h>

//creates two objects to control two terminals on the motor shield 
AF_DCMotor motor1(2); 
AF_DCMotor motor2(1); 

char command; 

void setup() 
{       
  Serial.begin(9600);  //Set the baud rate to your Bluetooth module.
}

void loop(){
  if(Serial.available() > 0){ 
    command = Serial.read(); 
    Stop(); //initialize with motors stopped
    //Change pin mode only if new command is different from previous.   
    //Serial.println(command);
    switch(command){
    case 'F':  
      forward();
      break;
    case 'B':  
       back();
      break;
    case 'L':  
      left();
      break;
    case 'R':
      right();
      break;
     default:
      Stop();
      break;
    }
  } 
}

void forward()
{
  motor1.setSpeed(220); //Define maximum velocity
  motor1.run(BACKWARD); //rotate the motor clockwise
  motor2.setSpeed(220); //Define maximum velocity
  motor2.run(FORWARD); //rotate the motor clockwise
}

void back()
{
  motor1.setSpeed(220); 
  motor1.run(FORWARD); //rotate the motor counterclockwise
  motor2.setSpeed(220); 
  motor2.run(BACKWARD); //rotate the motor counterclockwise
}

void left()
{
  motor1.setSpeed(220); //Define maximum velocity
  motor1.run(FORWARD); //rotate the motor clockwise
  motor2.setSpeed(100);
  motor2.run(FORWARD); //turn motor2 off
}

void right()
{
  motor1.setSpeed(100);
  motor1.run(FORWARD); //turn motor1 off
  motor2.setSpeed(220); //Define maximum velocity
  motor2.run(FORWARD); //rotate the motor clockwise
}

void Stop()
{
  motor1.setSpeed(0);
  motor2.run(RELEASE); //turn motor1 off
  motor2.setSpeed(0);
  motor2.run(RELEASE); //turn motor2 off
}

Perhaps it's Faulty or maybe i fried the piece because i'm not using a voltage divider.

Thanks, in advance!.

Or, perhaps your 9 volt battery belongs in your smoke alarm and try a real power supply for your robot.

I'm aware of that, thank you. The main problem is that the HC-05 isn't working as it should be, i tried multiple codes. but as i said i can't find it when scanning.

it's connected as follows :
Vcc -- 5v
tx -- pin10
rx -- pin11
en -- Pin 9
gnd -- gnd

any suggestions?

Is the HC05 set as a master or a slave. A master will not be seen by other Bluetooth devices.

Do not put 5 volts on the EN pin nor the RX pin. Even though the HC05 is powered by 5V the inputs are not 5V tolerant. It may work in the short term, but you are risking failure.

I suggest using a software serial port for the HC05 at least while developing. Then you can use the hardware Serial port for upload (without disconnecting), debugging and watching program execution and variable values.


RX and TX to suit.

1 Like

Your code `

`is for using hardware serial, pins 0,1, which is quite OK, but you have connected to pins 10, 11, and you will never get a result that way. Make sure you upload the code with Bluetooth disconnected. The connection to EN is redundant.
Also read reply #2 twice. Your code problem is not relevant to your scan problem, it is merely a guarantee that it will never work. You are not the first to fail scanning because you insist on using a 9v PP3. I understand the HC-05 LED will still flash with a 9v, but it no longer necessarily means "ready to connect ".
It is also possible that you are putting Bluetooth into AT mode, in which case it will never connect with anything, and it is probably unscannable as we'll.

1 Like

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