Go Down

Topic: HC-05 bluetooth sending, but not receiving android terminal data (Read 73 times) previous topic - next topic

rooshio

Hey all, my goal is to pair an android phone with a bluetooth module in order to exchange data with the arduino (for reading sensors/writing servos etc.). For my purposes here, I'm happy to simply see them communicate simple data and am using both an LED and the serial terminal to test this.

Problem: the HC-05 does not appear to be receiving bluetooth serial commands from my android... or at the very least, is not relaying that data to the HC-05's Tx pin for reception at the arduino's Rx pin.

I can, however, send serial data the other way: from the HC-05 to my android overbluetooth... for instance, the line "Serial signal from arduino" from the code shows up on my phone's terminal window.  So I know the pairing is okay.

In addition, I've eliminated the Nano's Rx pin as the problem by connecting Nano's TX and RX pins, in essence causing it to receive it's own serial data. And it reads Serial data from itself just fine.

I had it working at one point. When it did, any text I sent through the terminal input on my phone to the HC-05 would be confirmed back and would also show up in the Arduino IDE serial window. But now it's completely unresponsive, suggesting the HC-05 isn't receiving any data from my phone, despite sending it just fine.

My research is showing other people struggling with these modules as well. Any suggestions before I give up and just replace the hardware?


Code: [Select]
void setup() {
  Serial.begin(9600);
  pinMode(7, OUTPUT);
}

void loop() {


  char data;
  if (Serial.available() > 0)
  {
    data = Serial.read();
    switch (data)
    {
      case '1': digitalWrite(7, HIGH);
        break;
      case '0': digitalWrite(7, LOW);
        break;
      default :
        break;
    }
    Serial.println(data);
    Serial.println("Serial signal from arduino");
  }
  delay(50);
}

Go Up