Problems with controlling 4 servos on Protrinket 5V

I'm currently trying to test out 4 servos with a Protrinket 5v (on breadboard currently).

I coded my first 2 servos (Servos 1 and 2) to rotate the way I wanted to rotate (which they both rotate opposite directions with 1 switch, which is good!)

So I coded the other 2 servos (Servos 3 and 4) to rotate how I wanted and turned out perfectly as well!

I later then put Servos 3 and 4 along with Servos 1 and 2 together to see if they'll function with the code altogether, Servos 1, 3 and 4 work fine! But I'm having an issue with Servo 2 rotating at all... Seems like it doesn't want to operate when all 4 are pinned altogether.

I'm planning on rigging this along to a powerboost 500c along with Protrinket 5v controlled with 1 switch, and 2 motions. (I'll post code afterwards).
I pinned:
Switch = Pin 5
Servo 1 = Pin 3
Servo 2 = Pin 4
Servo 3 = Pin 9
Servo 4 = Pin 10

Again this is on a breadboard, so what I'm asking is what's causing Servo 2 not to operate properly? Is it the switch? Cause when I was toggling the switch connection (Im using a push button dpdt switch) Servo 2 will move when im touching the switch pin (which I know I shouldn't) causing Servo 2 to move the way it's supposed to and Servo 1 to retract and not operate the way it's coded... thats not what I wanted.. Is this a connection issue? Switch? Coding? Protrinket not able to power 4 servos? Our my pin connections wrong? (I'm a noob at coding and this is practically my first project with microcontrollers) I really want all 4 servos to rotate properly with 1 switch :frowning:

Code for this project

#include <Servo.h> 

int buttonPin = 5;  
int servoPin1 = 3;
int servoPin2 = 4;
int servoPin3 = 9;
int servoPin4 = 10;

Servo servo1; 
Servo servo2;
Servo servo3; 
Servo servo4;
 
void setup() 
{ 
  servo1.attach(servoPin1);  
  servo2.attach(servoPin2);
   servo3.attach(servoPin3);  
  servo4.attach(servoPin4);  
  pinMode (buttonPin, INPUT_PULLUP);
} 
 
void loop() 
{ 
  bool button = digitalRead(buttonPin);
  if (button == HIGH){
    servo1.write(180);
     servo2.write(160);
      servo3.write(110);
       servo4.write(100);
  }
  else{
    servo1.write(140);
     servo2.write(30);
      servo3.write(40);
       servo4.write(170);
  }
}

Can you post a wiring diagram? Pencil, paper and a camera are good enough if you include proper detail.
A common problem with servos is power. How are yours powered?

vinceherman:
Can you post a wiring diagram? Pencil, paper and a camera are good enough if you include proper detail.
A common problem with servos is power. How are yours powered?

Mines is powered through a 3.7v Lipo battery, since its on a breadboard, I'll post a picture later on (everythings on breadboard)

I'm getting responses saying its mostly battery not meeting up to powering 4 servos properly.

I wanted to add in the powerboost 500c during my final wiring up to convert it to 5.2v. But Im not sure if that'll be enough... My battery is pinned to the power rails. And Im currently using 4 HS-65MG servos that individually power 4.8 V - 6 V.

Those are fairly power hungry servos. If you have them wired up via a breadboard that is likely to be the problem. Breadboards are not intended to carry high currents. Try wiring the servo +/- power connections directly to the battery and also connect the ground to the Arduino.

Also what is the specification of your Lipo, not just 3.7V but mAh and C-rating? Running at only 3.7V is already asking a lot of those servos but if it is a weedy little battery too...

Steve