Bluetooth(HC05) is disconnecting

Hello,

I working in the project where I control servo via bluetooth. Everything is working when power is supplied via usb cable. However, when I use power adapter (12V,1A) bluetooth disconnects, usually after first couple of commands. My code is given below. Do you know why it happens ? And how I can resolve this issue. I need power supply for my project (automated roller blinds).

/*
Software serial multple serial test

Receives from the hardware serial, sends to software serial.
Receives from software serial, sends to hardware serial.

The circuit:

  • RX is digital pin 10 (connect to TX of other device)
  • TX is digital pin 11 (connect to RX of other device)

Note:
Not all pins on the Mega and Mega 2560 support change interrupts,
so only the following can be used for RX:
10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69

Not all pins on the Leonardo and Micro support change interrupts,
so only the following can be used for RX:
8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).

created back in the mists of time
modified 25 May 2012
by Tom Igoe
based on Mikal Hart's example

This example code is in the public domain.

*/
// servo can be controlled via bluetooth and serial
#include <SoftwareSerial.h>
#include <Servo.h>
Servo servo;
int angle;

SoftwareSerial mySerial(10, 11); // RX, TX

void setup() {
servo.attach(8); // servo pin
angle=79;// initial angle position
servo.write(angle);

Serial.begin(9600);// serial communication
mySerial.begin(9600);// in our case bluetooth communication

}
void loop() { // run over and over
if (mySerial.available()) {
angle=mySerial.parseInt();//set serial monitor to **noline ending othervise it will recognise \n as 0
}

else if (Serial.available()) {
angle=Serial.parseInt();//set serial monitor to noline ending othervise it will recognise \n as 0

}
// important to keep positioning outside "if" statements otherwise will write again
servo.write(angle);//rotation
//Serial.println(angle);
//mySerial.print(angle);
delay(15);// for working properly
}

The arduino comunity is helpful as always :frowning:

Did you figure it out?
I also have a bluetooth that keeps disconnecting after a short while.

tiboine:
The arduino comunity is helpful as always :frowning:

Not this time...
It was pretty clear that something silly was going on. There was nothing to suggest that anything was wrong with the code, there was no point in even reading it, and changing from USB to a 1A wall wart should not be a problem.
If you are curious about an old thread like this, you can click on the posters name and and what wenton later - if anything. You might find he took up tennis instead.