2

I am working on assembling the ROFI robot from Project Biped (http://www.projectbiped.com/prototypes/rofi) and I have not been able to run any arduino program as they will not function correctly.

To be more specific, when I attempt to run 12 servos on a single Arduino Mega, the servos twitch uncontrollably and do not move to the positions which are set in the program. At the same time the power light on the arduino mega blinks and does not turn solid (as opposed to if I use less than 11 servos when the pwr light is solid). I predict it might be the power source but after checking the batteries with the multimeter they check out to be fine (7.6 V). The circuit is pretty simple, I am using a servo shield connected to a 6V regulator connected in parallel to two 7.2 V 1350 mah LiPo batteries. The arduino is connected through the dc power jack to the same circuit in parallel.

Here is the code...

   #include <Servo.h>

// 0 Right Ankle (roll)
// 1 Right Lower Leg 
// 2 Right Knee 
// 3 Right Middle Leg 
// 4 Right Upper Leg 
// 5 Right Hip (roll)
//LEFT LEG JOINTS
// 6 Left Ankle (roll)
// 7 Left Lower Leg 
// 8 Left Knee 
// 9 Left Middle Leg 
// 10 Left Upper Leg 
// 11 Left Hip (roll)

int c=0;

Servo rightAnkle;
Servo lowerLeg;
Servo rightKnee; 
Servo rightMiddleLeg; 
Servo rightUpperLeg; 
Servo rightHip;
Servo leftAnkle;
Servo leftLowerLeg; 
Servo leftKnee; 
Servo leftMiddleLeg; 
Servo leftUpperLeg; 
Servo leftHip;

void setup(){
  rightAnkle.attach(0);
  lowerLeg.attach(1);
  rightKnee.attach(2); 
  rightMiddleLeg.attach(3);
  rightUpperLeg.attach(4);
  rightHip.attach(5);
  leftAnkle.attach(6);
  leftLowerLeg.attach(7);
  //leftKnee.attach(8); 
  //leftMiddleLeg.attach(9); 
  leftUpperLeg.attach(10); 
  leftHip.attach(11);
}

void loop(){
  rightAnkle.write(90);
  lowerLeg.write(90);
  rightKnee.write(90);
  rightMiddleLeg.write(90);
  rightUpperLeg.write(90);
  rightHip.write(100);
  leftAnkle.write(90);
  leftLowerLeg.write(90); 
  leftKnee.write(90); 
  leftMiddleLeg.write(90); 
  leftUpperLeg.write(90); 
  leftHip.write(90);
}
1
  • What are the specs of the 6 volt regulator? Commented Sep 14, 2014 at 21:32

2 Answers 2

1

It sounds to me like you're exceeding the current limits of your power supply. Add up the current drawn by your servos (and their controller(s), and also the current drawn by your Arduino and any other circuits you have. I bet you'll find that at 12 servos, you go over the current limit of your regulator. You might need a higher current regulator or a second one.

0

Servo library unable to control more than 11 servos

because the library isn't written to control more.

this approach (https://dannyelectronics.wordpress.com/2017/02/18/driving-multiple-servos-off-a-pic-timer2-ranged-extended/) can drive arbitrary number of servos over multiple ports / pins.

it is written for a pic but it has links to AVR implementation as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.