Mega 2560 and Bluetooth Module HC-05 (Voltage Divider????)

Hi, I am currently new to using the bluetooth module.

Is voltage divider necessary in using bluetooth module for mega 2560?

I just followed the connection on the attachment below. (Not mine)

Just found it here http://www.carobot.cc/how-to/hc-05-guide/

I tried using it in an android app sometimes it runs and sometimes not.

During working times an error of 516 "Broken Pipe" appears and losses all control.

Any solution for broken pipe or not running properly?

Here are the codes in Arduino.

char command;

//Motor A
const int motorPin1 = 10;
const int motorPin2 = 11;
//Motor B
const int motorPin3 = 12;
const int motorPin4 = 13;

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(motorPin1, OUTPUT);
pinMode(motorPin2, OUTPUT);
pinMode(motorPin3, OUTPUT);
pinMode(motorPin4, OUTPUT);

}

void loop() {
if (Serial.available() > 0) {

command = Serial.read();
switch (command) {

//==============================================================================

case 'L':
digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);
break;

//==============================================================================

case 'R':
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);

break;
//==============================================================================

case 'F':
digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);
break;
//==============================================================================

case 'B':
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);

break;
//==============================================================================

case 'S':
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, LOW);
break;
//==============================================================================

}
}

Using a divider is surely recommended. Some people don't bother, but 20c is good insurance. Intermittent operation is probably down to wiring, but it may be down to timing, or the nature of the signal received. Since you use proper hardware serial, you can painlessly test the system using the serial monitor in place of bluetooth.

Hi, thanks for your reply. I will be trying to buy the components.
Just wondering what do you meant by 20c?

Does it mean that broken pipe really falls down to loose wiring connection?

I mean the resistors will cost about twenty cents, and therefore not a bad bit of insurance. I have never heard of broken pipes, but I don't think it has anything to do with Arduino, or Bluetooth. Perhaps it's time to call a plumber.

Nick_Pyner:
I have never heard of broken pipes, but I don't think it has anything to do with Arduino, or Bluetooth. Perhaps it's time to call a plumber.

I think that is on the Android app side.
That's another whole kettle of worms.