Inconsistent Transmission to Android Phone using HC-05 Bluetooth + Arduino

I have written code to collect i2c data from an accelerometer using an arduino (tested on Uno, Lilypad, and Nano) and transmit the data using an HC-05 bluetooth module. The data is read on an android phone using the common 'Serial Bluetooth Terminal' app. The issue that I am having, even with other terminal apps, is that many times while connected and paired there is not any transmission of data. Sometimes unplugging and replugging the USB power or reuploading the code will fix the issue. There is no issue with sending data to the HC-05 from the android phone to power an LED or control a motor. I am also using the SoftwareSerial library but the problem persists even if I send the data directly over the serial pins. The connections and code are the following:

HC-05
Baud rate: 9600 (makes no difference if I change it)
Config: slave
TX - pin 10
RX - pin 9
GND - GND
VCC - 5v/3.3v (no difference with the issue, but with 5v I do use a voltage divider for the RX pin)

The following code usually works fine and is included to show my initialization of the bluetooth module

#include <SoftwareSerial.h>
#define rx 10
#define tx 9

SoftwareSerial BT(rx,tx);

void setup() {
BT.begin(9600);

}

void loop() {
  
  if (BT.available()){
    BT.println("hi");}
    
    delay(200);

}

Using the same format as the above code, I send the following data:

if(BT.available()){
  BT.print("Acc (g)");
  BT.print("  x=");
  BT.print(gForceX);
  BT.print("  y=");
  BT.print(gForceY);
  BT.print("  z=");
  BT.print(gForceZ);
  BT.print("  Rot (°)");
  BT.print("  x=");
  BT.print(rotX);
  BT.print("  y=");
  BT.print(rotY);
  BT.print("  z=");
  BT.print(rotZ);
  BT.print("  EMG_1=");
  BT.print(EMG_1);
  BT.print("  EMG_2=");
  BT.print(EMG_2);
  BT.print("\n");
  
}

The Definitions:

#include <SoftwareSerial.h>
#include <Wire.h>
long accX, accY, accZ;
float gForceX, gForceY, gForceZ;
long gyroX, gyroY, gyroZ;
float rotX, rotY, rotZ;
int EMG_1, EMG_2;
#define rx 10
#define tx 9
#define emg1 A2
#define emg2 A3

As you can see, I am sending a concatenation of strings, floats, and ints. When the code works, it runs great, regardless of whether I include delays or not in the loop function. I have also tried multiple HC-05 modules and the inconsistency problem persists. I hope to include my project in a wearable design with a lithium ion battery as an external supply so I can't keep reuploading the code and unplugging the power source to fix this issue. Any help is greatly appreciated.

I don't think this is a bluetooth problem but, if you are using a standard bluetooth module, powering it off 3.3v is not a good idea. With a Uno at least, it is not a good idea even if you are using a bare 3.3v module.

The condition
if (BT.available()){
is redundant.

If you use hardware serial, and you don't have good reason not to, you can test if bluetooth is innocent by sending the data to the serial monitor - with no change in code.

"Unplugging and replugging" doesn't sound like a fix, but at least by doing so so you are resetting Arduino. This points to a code problem, which appears to be incomplete

Hi thanks for the quick reply, using the serial monitor the results display perfectly fine. Using a lithium ion battery supply also does not improve the inconsistency. It's nearly completely random whether I get values transmitted or not, not even a function of distance.

OK, it seems that you have proven that Bluetooth is innocent, the wiring is correct, and the code is kosher.
This rather points to inadequate power, as perhaps you already suspect.
The failure of lithium battery to "improve the inconsistency" implies it is a substitute for another battery, please don't tell us that that was a 9v PP3, but still isn't big enough. I don't know anything about Lilypad, but both Uno and HC-05 are quite power hungry.