Transmission buffer with HC-05 version 4.0-20190815

I have a new HC-05 from Banggood and I have noticed what appears to be buffering behaviour when sending data.

I am using the HC-05 in a remote control for my balancing robot. The remote has the HC-05, a Nano and an analogue joystick. The code reads the joystick every 100ms and sends a single letter command over bluetooth to represent the joystick state.

#include <Wire.h>
#include <SoftwareSerial.h>

const int ledPin = 13;
const int JOYSTICK_X_PIN = 7;
const int JOYSTICK_Y_PIN = 6;

SoftwareSerial BTSerial(2, 3); // RX | TX

long previousMillis = 0;
const long TRANSMIT_INTERVAL = 100;

void setup() {
  BTSerial.begin(38400);
}

void loop() {
  long currentMillis = millis();
  if (currentMillis - previousMillis < TRANSMIT_INTERVAL) {
    return;
  }

  int xValue = analogRead(JOYSTICK_X_PIN);
  int yValue = analogRead(JOYSTICK_Y_PIN);

  if (yValue < 256) {
    BTSerial.write("F");
  } else if (yValue > 768) {
    BTSerial.write("B");
  } else if (xValue < 256) {
    BTSerial.write("L");
  } else if (xValue > 768) {
    BTSerial.write("R");
  }

  previousMillis = millis();
}

I have used the AT commands from Serial Port Bluetooth Module (Master/Slave) : HC-05 to configure the HC-05 to pair with an HC-06 on the balancing robot. I can send data successfully between the two, but I have noticed a buffering behaviour.

  • When sending bytes at intervals of < 120ms, the HC-05 seems to buffer 230 bytes then send them all at once.
  • When sending bytes at intervals of > 120ms, the HC-05 sends each byte immediately.
  • This behaviour is the same regardless of whether the HC-05 is the master or the slave. I have a second HC-05 which I configured as a slave and paired with my PC. Data from the PC to the HC-05 shows no signs of buffering, but data from the HC-05 to the PC is buffered in the same way.

Note that the HC-05 reports its version as 4.0-20190815 and the HC-06 reports its version as 3.0-20170609.

I suspect there must be some kind of AT command to control this behaviour, but I can’t find anything documented. I see that others have had issues with this version of the firmware, but there were no solutions (HC-05 VERSION:4.0-20190815 datasheet ?? and Delay with hc-05 communication).

Has anyone else noticed this, and is there a datasheet somewhere for the 4.0-20190815 firmware?

Just as a post-script, I’d like to thank this forum community. This is my first post, but I have found the answers to many of my previous questions on this forum just by reading everyone’s contributions.

Hello,

I know you posted this months ago, and I just ran into the same issue. When I hook up two of the "new" version 4 hc05 modules to two teraterm windows and type things in, the response is immediate. (what i type in one teraterm shows up in the other immediately). But when I have an arduino program blast bytes out more quickly, they buffer horribly and are unusable in my application. My application sends packets of about 13 bytes ten times per second, and I'm seeing about a 2 full second delay. This corresponds well to your experimental results, since it would take about 2 seconds to buffer up 230 bytes.

I have searched the internet, and also queried my supplier (aliexpress) and neither was helpful at all. Could not locate any spec sheet on the version 4.0-20190815 firmware.

I assume, as you do, that there is a magic AT command that can turn off this annoying behavior.

But seven months after your post, there is no clue anywhere on this version of firmware. I guess I will stick the 50 modules I bought in a box and hope that someday a spec sheet turns up and I can use them!

-Steve Pendergrast
Vorpal Robotics, LLC
vorpalrobotics.com