Bluetooth xm-15b & Ln298

Hello,

I have a problem while connecting arduino UNO with the bluetooth module Xm-15b and the driver LN298.
I am making a 2 wheels robot controlled by bluetooth.
The problem is that when i am connected to the computer port ("COM4"), it works; but if i use the 9v battery instead of the computer, although everything turn on, the connection with my cellphone (using BluetoothSerialController.apk) doesnt work when i reconnect it to the module.

the code is the following:

int in1 = 7;
int in2 = 6;
int in3 = 5;
int in4 = 4;
void setup()
{
** Serial.begin(9600);**
** pinMode (in1,OUTPUT);**
** pinMode (in2,OUTPUT);**
** pinMode (in3,OUTPUT);**
** pinMode (in4,OUTPUT);**
}
void loop()
{
** if (Serial.available()>0)**
** {**
** char nodato = Serial.read();**
** char dato = char (nodato);**
** if (dato == '0')**
** {**
** digitalWrite (in1,LOW);**
** digitalWrite (in2,HIGH);**
** digitalWrite (in3,HIGH);**
** digitalWrite (in1,LOW);**
** }**
** if (dato == '1')**
** {**
** digitalWrite (in1,HIGH);**
** digitalWrite (in2,LOW);**
** digitalWrite (in3,HIGH);**
** digitalWrite (in1,LOW);**
** }**
** if (dato == '2')**
** {**
** digitalWrite (in1,HIGH);**
** digitalWrite (in2,LOW);**
** digitalWrite (in3,HIGH);**
** digitalWrite (in1,LOW);**
** }**
** if (dato == '3')**
** {**
** digitalWrite (in1,HIGH);**
** digitalWrite (in2,LOW);**
** digitalWrite (in3,LOW);**
** digitalWrite (in1,HIGH);**
** }**
** if (dato == '4')**
** {**
** digitalWrite (in1,LOW);**
** digitalWrite (in2,LOW);**
** digitalWrite (in3,LOW);**
** digitalWrite (in1,LOW);**
** }**
** }**
}

the connections are these:

xm-15b:

The common 9 V battery can't supply enough current for a robot. You'll need to use a better power source. A decent quality/capacity (the cheap ones often lie outrageously about their capacity) USB power pack might be an easy solution, perhaps you already have one on hand.

sebi6576 provided a bit more information in their cross post:

sebi6576:
the connections are like these:

XM-15B:
5v -> 5v arduino (using protoboard)
gnd -> gnd arduino ("" "")
rx -> tx arduino
tx -> rx arduino

Ln298:
+12v -> 5v arduino (using protoboard) //I use 12v, because the wheels dont move if i use +5v
gnd - > gnd arduino (using protoboard)
in1 -> pin 4 arduino
in2 -> pin 5 arduino
in3 -> pin 6 arduino
in4 -> pin 7 arduino

#wheels are connected in each side of the ln298 driver, using 2 wires for wheel.