Powering Two Continuous Servos

Hello all,

I am posting today because I am new to Arduino and am seeking help on powering two continuous rotation servo motors (from botbrain.com) that are dependent on two momentary switches. The coding and wiring are very simple (check attached), but I can't seem to understand why only one of my servos work. I believe it is a powering problem but I can't seem to fix the problem.

As you can probably tell from my code, the idea of this sample project is to rotate a motor at a certain speed for a second and a half by pushing the respective button. I am using an external 12V:1A power supply as the supply for the motors. My grounds are connected, as far as I can tell all of my hardware and wiring is correct.

Here is my code:

 #include <Servo.h>
  Servo servoleft;
  Servo servoright;
  const int leftButton = 9;
  const int rightButton = 11;
  int selection1SwitchState = LOW;
  int selection2SwitchState = LOW;
  
  void setup() {
    
   pinMode( leftButton, INPUT );
   pinMode( rightButton, INPUT );
   servoleft.attach (3);
   servoleft.write (90);
   servoright.attach (5);
   servoright.write (90);
   
  }
  
  void loop() {
    
    selection1SwitchState = digitalRead ( leftButton );
    selection2SwitchState = digitalRead ( rightButton );
    
    if (selection1SwitchState == HIGH && selection2SwitchState == LOW) {
      
      servoleft.write (110);
      delay(1500);
      servoleft.write (90);
      selection1SwitchState = LOW;
      
    }
    
    if (selection2SwitchState == HIGH && selection1SwitchState == LOW) {
  
      servoright.write (110);
      delay(1500);
      servoright.write (90);
      selection2SwitchState = LOW;
      
    }
    
  }

So I uploaded my code to the uno, and when I press button 1, motor 1 does exactly what it should. Where I encounter problems is when I press the second button, nothing happens. I can't seem to understand why its like the second motor is not even there. There is no subtle movements in the motor or even buzzing (as the motors attempt to work.)

Does anyone know what the problem could be? Im stuck, and I've tried everything that I could think of.

One last question is,is there another way to code these motors? Ive seen a way online using pulses and such but I really don't understand that to well.

Thanks in advance and your help is greatly appreciated,

Ro

Servos are typically 5-6V max input. 12V might have fried one.

There should be a connection between the external power supply (12V, in this case) GND and the Arduino GND. When you have multiple power supplies (USB for the Arduino, I assume, and this 12V for the servos) then there needs to be a connection between their GNDs.

C1 and C2 are unnecessary and should be removed.

You have some redundant code:

    if (selection1SwitchState == HIGH && selection2SwitchState == LOW) {
      
      servoleft.write (110);
      delay(1500);
      servoleft.write (90);
      selection1SwitchState = LOW;    //// DOES NOTHING
    }
    
    if (selection2SwitchState == HIGH && selection1SwitchState == LOW) {
  
      servoright.write (110);
      delay(1500);
      servoright.write (90);
      selection2SwitchState = LOW;   ///// does NOTHING
      
    }
    
  }

C1 and C2 reduce RFI, leave them in...

You need more than 1A supply I suspect - datasheet for the servos please...

Oh yes, important detail, add some 2k2 resistors in series with the control lines to the servos
so that is a servo fails it can't blow up the Arduino. They run at 12V and 12V is instant death
to 5V logic without current-limiting resistor or other protection.

Hello, Thanks for the replies.

Chagrin:
Servos are typically 5-6V max input. 12V might have fried one.

There should be a connection between the external power supply (12V, in this case) GND and the Arduino GND. When you have multiple power supplies (USB for the Arduino, I assume, and this 12V for the servos) then there needs to be a connection between their GNDs.

C1 and C2 are unnecessary and should be removed.

A couple things to this. My original external power supply was a 9V:650mA supply. Unfortunately the same thing happened where one of them just didn't go. I also mentioned in my original post that i did bridge the grounds.

I tested your theory of one being fried and I disproved it by just switching the physical servos. So leftServo became rightServo and vis-a-versa. Both of the individual servos work with the first switch. and both don't work with the second.

I also wrote a sample code to see if the servos would work simultaneously.

 #include <Servo.h>
  Servo servoleft;
  Servo servoright;
  
  void setup() {
   
   servoleft.attach (3);
   servoleft.write (100);
   servoright.attach (5);
   servoright.write (100);
   
  }
  
  void loop() {
     
  }

So, I did this to see test the motors independently of the momentary switches. My first run of this code was using a 9V:650mA external power supply to feed the motors and it turned out that they both spun, except one just spun slower than the other. This led me to think that there was a power shortage. This is when I disconnected the 9V and inserted the 12V:1A. and with this run both motors spun, with equal speed but that speed seemed to be waaaaay faster than the 100 I set it to. This led me to think that there is a current overload now. So I guess my next step is finding the data sheet for the motors.

MarkT:
You need more than 1A supply I suspect - datasheet for the servos please...

But regardless of dialing in the right amount of current, that doesn't answer my original question of why does one motor not even turn at all when its using the original code and dependent on the momentary switches? This is the main problem I need help on.

Attached is a breadboard diagram of my setup. This is just to give a simpler way of looking at it.

Thanks again for the help,
Ro

NOTE: I just realized I forgot to add the external power supply in that last diagram. There is a positive and negative of the external supply hooked up on the power rails on the side that the servos are attached to. Sorry for the mistake.

No one has any idea huh?

Several people have suggested that the power supply is a problem (and it is -- you need at least one ampere per servo at the proper voltage), and at least one forum member has asked for the servo data sheet.

What have you done to correct the power supply problem, and where is the data sheet?