Using the HC06 bluetooth module - Confusion

I'm trying to send messages between my PC and HC06 bluetooth device (using terra term terminal emulator).

  • The HC06 is connected to my arduino uno , 5V to VCC and GND to GND

  • Apparently I can't connect the Rx and Tx pins of the HC06 directly to pins 1 and 0 because it is used for seial communication with the computer, I've noticed I can't upload when they're connected.

  • Therefore, I created a SoftwareSerial object using the SoftwareSerial library and used pins 10 and 11 as Rx and Tx respectively using a voltage divider to connect the arduino Tx to HC06 Rx.

#include <SoftwareSerial.h>
#define Rx 10
#define Tx 11

SoftwareSerial BTserial(Rx, Tx);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  BTserial.begin(9600);

}

void loop() {
  // put your main code here, to run repeatedly:
  if(BTserial.isListening())
  {
    BTserial.print("Success");
  }

}

  • After uploading this sketch, I connected my pc to the HC06 and connected to terra term using the appropriate COM port.

  • Apparently, I should be able to run some command from terra term or serial monitor when the module is on AT mode however I'm not able to run any commands, Also the module has been blinking non stop, while connected or unconnected to either the PC or terra term when apparently it should be a constant red after connecting.

  • Regarding terra term, it runs extremely slowly and pressing the enter key moves the cursor to the beginning of the text that was just entered, no changes or anything. Is this meant to happen. Its running on a windows 10 pc.

  • Any help regarding what to do from here to be able to send messages between devices would be appreciated

it's not isListening() that you want to call

the typical test code would be something like this

#include <SoftwareSerial.h>
#define Rx 10
#define Tx 11

SoftwareSerial BTserial(Rx, Tx);

void setup() {
  Serial.begin(115200); // no reason to go slow...
  BTserial.begin(9600);
  Serial.println(F("READY!!"));
}

void loop() {
  while (BTserial.available()) Serial.write(BTserial.read()); 
  while (Serial.available()) BTserial.write(Serial.read()); 
}

whatever is typed on the PC would be printed on the Serial Monitor and whatever you type within the Serial monitor would be sent to the PC via BT

make sure the Serial monitor is configured at 115200 bauds.

Nothing changes after using the test code, No response.
I've tried to send between terra term and the serial monitor.

This suggests it is not connected, you just think it is.

SOLUTION

  • I had to restart my PC everything works fine now.
  • After uploading your code to the arduino, open terraterm and make sure to connect to appropriate COM port. In order to see the text you input to terra term: setup > terminal > enable local echo.

  • I ran @J-M-L code for testing but maintained the baud at 9600

Additional YT video (not what I did but also works):

That's good, and it suggests your problem was at the PC end. I have long thought that it is easier to get started using a phone.

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