0

I have started learning about arduino and just bought a bluetooth module, HC-05. From where i bought, it says it has range of approx.10 meters. I made hc-05 connection with arduino in below described ways

I am using it as a slave with default configurations, 9600 baud rate and HC-05 name with pin 1234

GND of HC05 -> GND of `arduino`
VCC of HC05 -> 5V of `arduino`
TX of HC05 -> RX of `arduino`
RX of HC05 -> TX of `arduino` via voltage divider network 2k---|---1k

Below is my arduino code

#include <SoftwareSerial.h>
SoftwareSerial BTserial(2, 3); // RX | TX
// Connect the HC-05 TX to Arduino pin 2 RX.
// Connect the HC-05 RX to Arduino pin 3 TX through a voltage divider.

int pin = 13;
char c = ' ';

void setup()
{
 Serial.begin(9600);
 Serial.println("Arduino is ready");
 pinMode(pin,OUTPUT);
 
 // HC-05 default serial speed for communication mode is 9600
 BTserial.begin(9600);
 Serial.println("BTserial started at 9600");
}

void loop()
{
  if (BTserial.available()>0){
    c = BTserial.read();
    Serial.println(c);
    switch (c){
      case '1' : 
        digitalWrite(pin,HIGH); 
        break;
      case '2' : 
        digitalWrite(pin,LOW); 
        break;
      default: break;
      
    }
  }
}

Following things happening to me:

  1. When I power the module I am able to discover it with my phone but only when I hold my phone very near to the module. If I move away from the HC05 module, for example 3-4 feet, I am not able to discover it.

2.After connecting with it (while holding phone near to the module), I am able to send data to it but again, if I move away , only a few steps, I am unable to send data and I disconnect from it automatically. Also if I change direction of the antenna even then no communication happens.

My purpose is to control my home's lights and TV with the help of this module and Relays. But HC05 is useless so far. I was hoping that I would code it and wire it and hang it on a wall and interact it with and andoird app.

Is it suppose to happen like this? or there's something wrong with my module's antenna

thank you.

usmandroid
  • 11
  • 4
  • What else is around the module? Perhaps something is interfering with it. – lurker Apr 04 '21 at 17:33
  • If you move your Arduino setup with HC-05 to another location, does it behave the same way? Have you tried connecting to it with any other client, like a laptop? – lurker Apr 04 '21 at 18:56
  • Why is Rx through a voltage divider? – lurker Apr 04 '21 at 23:31
  • because HC05 RX is a Logic 3.3V. – usmandroid Apr 05 '21 at 03:13
  • I have tried it everywhere, in the center of room where, holding it higher. Only thing left is to take outside in the playground. – usmandroid Apr 05 '21 at 03:14
  • It doesn't shows up in available devices list unless i bring the phone very next to hc05. i try this without connecting Rx and Tx since i just need power to turn it on – usmandroid Apr 05 '21 at 03:15
  • I can't tell from your ASCII diagram which end your 1k is from your 2k for the connection. HC-05 actually accepts 3.3V to 6V according to [their website](http://www.dsdtech-global.com/search/label/HC-05%20Bluetooth%20Serial%20Pass-through%20Module). Your description seems to indicate you have your voltage divider in the HC-05 Rx line, which would be wrong. – lurker Apr 05 '21 at 11:59

0 Answers0