Problem With Robot Contorting Itself

Hello all, I am relatively new to robotics and I am having some trouble with a pet project, I am building a four legged walker however whenever I to upload the code to the micro controller to make it walk the robot contorts its limbs in a strange way. From there when I try to reset the servos back to the default position they remain that way until I unplug them from the micro controller, and reset them individually, i noticed the batteries (4 AA’s) get very hot during this as well. I have not been able to find a solution to this and hope y’all can shed some light on it. Any help is appreciated.

The micro controller (lynxmotion botboarduino)

Here is a link to a photo of what happens and of how the Controller is laid out.

drive.google.com/open?id=0ByEikbxW1YFYQmNkTEJCN1RtekE

UPDATE: it appears to only happen when five ore more servos are connected and attempting to operate.

Code for walking

#include <Servo.h>


Servo servo1;
Servo servo2;

Servo servo3;
Servo servo4;

Servo servo5;
Servo servo6;

Servo servo7;
Servo servo8;
//int check = 0;

void setup() {
servo1.attach(2);
servo2.attach(3);

servo3.attach(4);
servo4.attach(5);

servo5.attach(6);
servo6.attach(7);

servo7.attach(8);
servo8.attach(9);

}

void loop() {
move_forward(); 
delay(30000);
stand();
delay(5000);
}


void stand () {
servo1.writeMicroseconds(1500);
servo2.writeMicroseconds(1500);

servo7.writeMicroseconds(1500);
servo8.writeMicroseconds(1500);
}

//Here is the move function
void move_forward(){
  //first step setup
  servo2.writeMicroseconds(1000);
  servo8.writeMicroseconds(1000);
  delay(1000);
  servo1.writeMicroseconds(2000);
  servo7.writeMicroseconds(1000);
  delay(1000);
  servo2.writeMicroseconds(1500);
  servo8.writeMicroseconds(1500);
  delay(1000);
  
  //these servos move to center
  servo1.writeMicroseconds(1500);
  servo7.writeMicroseconds(1500);
  //these move back
  servo3.writeMicroseconds(2000);
  servo5.writeMicroseconds(1000);
  delay(1000);
  
  //Here is the next step
  servo4.writeMicroseconds(2000);
  servo6.writeMicroseconds(2000);
  delay(1000);
  servo3.writeMicroseconds(1500);
  servo5.writeMicroseconds(1500);
  delay(1000);
  servo4.writeMicroseconds(1500);
  servo6.writeMicroseconds(1500);
  delay(1000);
  //reset begins

}

Code for reset

[code]
#include <Servo.h>

Servo servo1;
Servo servo2;

Servo servo3;
Servo servo4;

Servo servo5;
Servo servo6;

Servo servo7;
Servo servo8;

void setup() {
servo1.attach(2);
servo2.attach(3);

servo3.attach(4);
servo4.attach(5);

servo5.attach(6);
servo6.attach(7);

servo7.attach(8);
servo8.attach(9);
}

void loop() {
servo1.writeMicroseconds(1500);
servo2.writeMicroseconds(1500);
servo3.writeMicroseconds(1500);
servo4.writeMicroseconds(1500);
servo5.writeMicroseconds(1500);
servo6.writeMicroseconds(1500);
servo7.writeMicroseconds(1500);
servo8.writeMicroseconds(1500);
delay(2000);

}

][/code]

Hi,

Concerning the batteries getting very hot, this may be quite dangerous as they could get damaged and even cause a fire. We strongly recommend that you figure out what is causing this issue first and fixed it before continuing.

You mention having the issue only with 5 or more servomotors connected, which may indicate that your batteries are not able to produce enough current and therefore the voltage drops low enough that is causes issues with your robot.

You may also want to change the jumper for voltage input from USB to Ext (external). See the picture below for reference:


It is possible the batteries and the USB connection are fighting each other and causing the batteries to heat up, too.

Possible options could also include using larger batteries (Cs or Ds type batteries) or a battery pack, such as RB-Sta-13 or RB-Sta-08.

Sincerely,

Thank you for the response, you’re right it was a battery issue, when I changed to one with greater mAh that fixed it right up.