Help on project with many servos!

Hi all, I'm currently facing a servo software problem and I have no idea if there's even a way around it. Anyone who can help me, Karma++

I have 108 servos. They're set up in lines and I'm telling them to make a wave or ripple motion from one end to the other with this:

void setup()
{
myMatrix.begin();
}

void loop()
{

for(i=0;i<64;i++) {
PosArray* = 200;*

  • }*

  • myMatrix.changeServoBoard(0, PosArray);*

  • delay(1000);*

  • for(i=0;i<64;i++) {*
    _ PosArray* = 200;_
    _
    }*_

* myMatrix.changeServoBoard(0, PosArray);*
* delay(1000);*
}
The i++ is the ripple motion. The problem I'm facing is that I have several of these lines of servos next to each other and they all need to carry the wave with overlapping start times. As of now the program executes the for loops one after the other, which makes a wave in each line one after another (and does not work for what I'm trying to do). I hope that all makes sense. If you've worked on a similar project or know someone who can help, please let me know! Thanks.
Sam

Also, I'm only able to send one ripple at a time (the first servo in line cannot start a second wave until the last servo in line has completed the first). If you know of a way around this, please help. I'm a little bit desperate!
Thank you.

@samuelP
I understand your issue, however I have no clue how you have wired the motors and what is going on inside myMatrix.

Servos are generally not so happy when they see no PWM pulses, but they might stay in their current position when the gear box produces enough friction. So you most likely do some multiplexing of the PWM signals, which however is not best practice.

But maybe you use some dozen low cost PWM controllers?

Please give some more details!

Your code snippet does not define what myMatrix is.

This loop:

  for(i=0;i<64;i++) {
    PosArray[i] = 200;
  }

is putting the same value in the first 64 positions of an array whose size or type we are not told.

This loop:

  for(i=0;i<64;i++) {
    PosArray[i] = 200;
  }

is doing exactly the same thing.

What is

myMatrix.changeServoBoard(0, PosArray);

doing with or to PosArray?

@deSilva: servos are at their happiest when they can't see PWM pulses - thye much prefer PPM.
As has been noted here many times before, feeding them (Arduino) PWM results in excessive power consumption and can cause them to overheat.

Alas, a lot of misunderstandings on your side:

Of course does a servo accept PWM. The characteristics are pulses between 0.5 and 2.5 ms in a 20ms timehframe. Tne semantics is not in the duty cycle but in the absolute pulse length, so the frame time is not too critical.

This has of course nothing to do with analogWrite. The Servo library e.g. software generates such pulses.

PPM refers to the way RC equipment interleaves 8 of such channels in one frame. In fact, the frame length has been choosen so that 8 channels will just fit (8*2,5 =20).

However, this is not the issue of this thread....

Yes, both you and I know that you can generate RC PPM pulses using sufficient resolution PWM, but using the term here makes other noobs think they can use analogWrite to drive RC servos, and then get confused and upset when they (the servos) whine and overheat.
So, please, don't mention PWM in a thread about servos. (spot the intentional irony)

@Groove
I welcome your care for noobs, but aren't there so many more topics that will deeply confuse them?.... Should we really avoid all of them?

No, really this is one of the commonest confusions for users of servos.
You'll find this out when you've been around here a bit longer.