HC-05 bluetooth transmission data cannot be interpreted by serial terminal

I'm new to arduino and I'm trying to transmit data over Bluetooth between 2 hc-05s (on arduino nanos). I have linked them successfully and they seem to be able to communicate, except the serial terminal only shows the special character symbol �. I have made sure the baud rate is the same ("AT+UART?" returns "+UART:9600,0,0" on both device). My code is very basic as I am just testing:

#include <SoftwareSerial.h>

SoftwareSerial Bluetooth(3, 2);

void setup() {
  Serial.begin(9600);
  Bluetooth.begin(38400);
  Serial.println("Started. ");
}

void loop() {
  if (Bluetooth.available())
    Serial.write(Bluetooth.read());
    
  if (Serial.available())
    Bluetooth.write(Serial.read());
}

Could you please suggest the problem? Thank you in advance.

Hi! Welcome to the Forum!

Two guesses:

  1. Check if the Baud Rate is correctly set to 9600 on the Serial Monitor.

The default Normal Mode (NOT AT Command Mode) data communication Bd for Bluetooth is 9600. Therefore, you should include the following line in your sketch:

Bluetooth.begin(9600);

Thanks for the reply - that worked. I'm also a bit confused about hc-05 in general, as different sources on the internet seem to contradict:

  • can the hc 05 be powered directly with the arduino 5v pin (connect 5v to VCC)? Some websites say hc-05 is 3.3v but I mean on the back it is printed "Power:3.6V - 6V"
  • can I trigger the AT mode programmatically? e.g. can I code a sketch so that it automatically changes the device it is connected to?
  • what do the different blinking modes of the LED suggest? I figured that in AT mode the LED turns on and off slowly.

I've tried looking for some datasheets but they only provide a list of AT commands. If it helps my firmware version is 2.0-20100601 and I think I only have a red LED.
Many thanks.

P.S. With triggering the AT mode thing, I guess a transistor solution is possible but is there a better way?

The following is the tested connection between HC-5 and UNO, which I use. Voltage divider is needed; because, RX-pin of HC05 is not 5V tolerant.
hc05-UNO

1 Like
  1. HC-05 is indeed 3.3v . The "Power:3.6V - 6V" is not written on the back of HC-05, it is on the back of the breakout board (commonly labelled zs-040 these days) This board includes a 3.3v regulator. Don't ask why they don't provide a regulator at the Rx pin.

  2. Yes, you can trigger AT mode. Your project also needs to be able to control HC-05 5v power supply. You also need to supply 3.3v to the EN pins, which absolves you from having to push the button.

  3. Fast flash means "power on, ready to connect" nothing else, no guarantees.
    Slow flash means AT mode, i.e. merely successfully engaged the procedure, no other guarantees.
    Anything else means "communicating via Bluetooth" depending on the breakout board. Sometimes it's a blink, sometimes a double blink, sometimes just solid. I don't know if this is user-programmable. It does not mean your signal wiring or code are kosher,

1 Like

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