For overcoming torque issues, I have attached 2 identical servos on a certain part of my robot arm and because I saw someone do the same.

Now, while writing code I realize:

#include <Servo.h>
shoulder1.write(map(analogRead(p1), 0, 1023, 0, 179));
shoulder2.write(map(analogRead(p1), 0, 1023, 0, 179));

will turn shoulder1 by 20* and then shoulder2 by another 20*, ie. an overall turn of 40*; that too with too much load on servos, as the other servo would be inactive at the time first is active.

I want to achieve 20* fully-sync.ed turn on both servos, how do I accomplish this? Any arduino libraries or walkthrough?

Can I possibly move them both at the same time - something like multithreading on arduino? Here's what I tried:

void rotateTwoServoInSync(int angle) {
    for(int i = 0; i<angle; i++) {

Will it work? Is this approach recommendable?

  • you do know that all of that code executes WAAAAY faster than the response time of the servos, and they will, for the most part, operate at the same time?
    – KyranF
    May 11, 2015 at 4:44
  • if you write both outputs at the same time (two lines of code sequentially) it is enough for them to operate in sync.
    – KyranF
    May 11, 2015 at 4:46

4 Answers 4


If you have two RC servos that are always required to move together you can simply connect both control inputs to a single output.

  • So do I need a NPN transistor to amplify the signal?
    – RinkyPinku
    May 25, 2015 at 2:35
  • Nope. Just connect and drive them together. May 25, 2015 at 4:33

Spehro's answer is the most obvious. But note that there is no such thing as identical servos. You may stress them if you connect them through a stiff connection.

If you want to have two mechanical parts make the same movement the proper solution is to connect them mechanically, rather than have two servos doing the same action.


analogRead() and map() are slow; only perform them once.

unsigned char rot = map(analogRead(p1), 0, 1023, 0, 179);
  • I will implement your advice - but still if rot is 150* then wouldn't shoulder1's 150* movement w.r.t. shoulder2's stationary position break/burn the setup?
    – RinkyPinku
    May 11, 2015 at 4:10
  • Only if your setup is made of diamond. Otherwise it will have plenty of flexibility to handle the few hundreds of nanoseconds of difference. May 11, 2015 at 4:12
  • I don't know if I agree to that - but torque issue is still unsolved.
    – RinkyPinku
    May 11, 2015 at 4:15
  • Then your servos aren't identical. May 11, 2015 at 4:21

To operate two or more servos at the same time you need to interpolate their movements, first moving one servo a little, then moving the next one, back and forth until all servos arrive at their destination point. I haven't seen a library yet that accomplishes this for you so you probably need to write your own routine. Here is a project where I interpolated three servos and includes the code: https://www.instructables.com/id/MonkeyBot-3-Servo-Climbing-Robot/

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.