Bluetooth not working

when i have my board connected to my pc the bluetooth receives data fine, but on an external supply (yes the supply is stable) it gets connected but doesn't receive nor does the tx light light up, HELP :<

#include <SoftwareSerial.h>

#include <Servo.h> 
Servo myservo1, myservo2, myservo3;

int bluetoothTx = 0;
int bluetoothRx = 1;

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

void setup()
{
  myservo1.attach(9);
  myservo2.attach(10);
  myservo3.attach(11);
  //Setup usb serial connection to computer
  Serial.begin(9600);

  //Setup Bluetooth serial connection to android
  bluetooth.begin(9600);
}

void loop()
{
  //Read from bluetooth and write to usb serial
  if(bluetooth.available()>= 2 )
  {
    unsigned int servopos = bluetooth.read();
    unsigned int servopos1 = bluetooth.read();
    unsigned int realservo = (servopos1 *256) + servopos; 
    Serial.println(realservo); 
    
    if (realservo >= 1000 && realservo <1180){
    int servo1 = realservo;
    servo1 = map(servo1, 1000,1180,0,180);
    myservo1.write(servo1);
    //Serial.println("servo 1 ON");
    delay(10);

    }
    
    if (realservo >=2000 && realservo <2180){
      int servo2 = realservo;
      servo2 = map(servo2,2000,2180,0,180);
      myservo2.write(servo2);
      //Serial.println("servo 2 On");
      delay(10);
      
    }
    
    if (realservo >=3000 && realservo < 3180){
      int servo3 = realservo;
      servo3 = map(servo3, 3000, 3180,0,180);
      myservo3.write(servo3);
      //Serial.println("servo 3 On");
      delay(10);
    }
   
  }
    
 }
    
   

What Arduino board?

Which Bluetooth module?

Please post a schematic or wiring diagram.

What is the external supply? What are its specifications? How is it connected?

TX light? Software serial has no transmit light.

1 Like

board is arduino uno

HC-05

Im using a 350 watt power supplies 5V output cable, its connected using male to male connectors to the arduinos Vin and GND pins. the bluetooth is connected separately to another 5V supply

i meant the transmit light on the board. and if you bear with me, wait for a moment till i make the diagram :sweat_smile:

Vin needs at least 7V for the on board regulator to work properly. If you have regulated 5V, connect that to the 5V on the Uno.

That will only light on transmit from the hardware serial TX.

Why are you using the hardware serial pins for SoftwareSerial. That is not right. Use other pins for SoftwareSerial.

is it okay if i put the BTtx to 2 and BTrx to 3?

here (im not good at designing):

Yes, much preferred over 0 and 1.

1 Like

but the servo still doesnt seem to work tho :< pls help

You must connect the servo power ground to Uno ground.

Like wise the ground from the 5V to the HC05 power to Uno ground.

You should have a level shifter on the HV05 RX line. The HC05 inputs are not 5V tolerant.

i'll do it according to the diagram you sent, and i'll update you.

i wired like this, but still no change..

If you disconnect the 5V battery that powers the Uno (only) and connect to USB power will it work?

Please post clear photos of your project and show the wiring.

when i connect the USB power it does work as normal, but still has the same issue of it not responding (note that i tried this yesterday and it worked fine on PSU power)

and the wiring is a mess and i'm not in a very bright room

All the HC needs is 5V (and Gnd) to be seen on your mobile (for pairing etc.)

That is a confusing statement. Does it work on USB power or not?

.

it does pair and get connected, it even prints the correct values in the serial moniter, it just doesnt move the servo as i expect it too.

it does, correct values are printed on my serial moniter too

But running on the PC it does (as you expect)?

not really, values get printed but when the servo starts to move it resets the HC05 (im powering the servo from the arduino uno itself), maybe it'll work if i connect my servo to an external sup?

Yes, do try that. Arduino"5V" is insufficient for servo power - for most of them, anyway.