# TLC5940 and servos

I am a little lost setting this up according to the diagrams from arduino playground link to the tlc5940 led driver. http://www.arduino.cc/playground/Learning/TLC5940 I am trying to drive servos with the library written for it. A couple of servos seem to shudder, I’m pretty sure I connected everything according to the diagram. I ran the example which would light leds in sequence, each servo makes a short twich one by one, so I seem to be getting something.

if I’m not using dot correction should VPRG be connected to ground or not at all?
and secondly I’m not sure what to set these to

/** Determines how long each PWM period should be, in clocks.
\f$\displaystyle f_{PWM} = \frac{f_{osc}}{2 * TLC\_PWM\_PERIOD} Hz \f$
\f$\displaystyle TLC\_PWM\_PERIOD = \frac{f_{osc}}{2 * f_{PWM}} \f$
This is related to TLC_GSCLK_PERIOD:
\f$\displaystyle TLC\_PWM\_PERIOD = \frac{(TLC\_GSCLK\_PERIOD + 1) * 4096}{2} \f$
\note The default of 8192 means the PWM frequency is 976.5625Hz */
#define TLC_PWM_PERIOD    8192

/** Determines how long each period GSCLK is.
This is related to TLC_PWM_PERIOD:
\f$\displaystyle TLC\_GSCLK\_PERIOD = \frac{2 * TLC\_PWM\_PERIOD}{4096} - 1 \f$
\note Default is 3 */
#define TLC_GSCLK_PERIOD    3


is pwm period in relation to the period the servo needs to receive? I am using among others hitec HS-300A, Is this supposed to equate to the pulse ms length?

would Appreciate any help,

Ryan

R/C servos are controlled by PPM not PWM.
Typical pulse repetition rate is 50Hz, with a pulse width of around 1 to 2mS.

uh oh, can a tlc5940 not be used to drive servos? there is a library written for it, but i'm a little new to this, do I need some other components between the tlc outputs & servos? I needed to run about 9 servos and duemilnove controls 2 (at least hardware control), so trying to use a separate IC for that.

 I needed to run  about 9 servos and duemilnove controls 2


The Duemilanova will control up to 12 servos using the MegaServo library.

Thanks for that I have probably been going about it the hard way.

any disadvantages to doing it this way? the playground section mentioned pins 9 & 10 provide precise control of servos, does this apply to the megaServo library, do you get any loss in precision?

Ryan

The current Arduino servo library and MegaServo run the timer with the same precision. MegaServo can use any digital pin and all pins have the same precision. With MegaServo, each servo is run in sequence and individually timed so there is no loss of precision depending on how many servos you use.

The Arduino team is planning to replace the current Servo library with MegaServo in the next official release of Aduino software.

R/C servos are not all that precise, but I've had no problems with the megaServo library. I think that there have been some observations that you should set the number of servos to the maximum possible (12 for the Duemilenova) even if you don't attach all of them. Go to the playground and put MegaServo in the search box.

Don't forget you need a separate supply for the servos.

I think that there have been some observations that you should set the number of servos to the maximum possible (12 for the Duemilenova) even if you don’t attach all of them.

The code was changed a while ago so that is no longer necesary.

as a side question , I've hooked up 2 signal wires from 2 servos (both same model) they work simultaneously to provide more torque for a robot arm bicep joint (they will be together on the same hinge). are there any problems with this setup working from 1 channel, that I should be aware of?

I haven't heard about this technique before but I would guess it would work ok if the servos really are identical. A problem could exist that tolerances in production resulted in the physical position of the two servos being slightly different for a given pulse width so they would fight each other as one tried to correct the other. If this happens at all it would be most likely with two really cheap servos. You should be able to detect if this is happening as the servos would probably buzz with a constant pulse width.

Have you considered using one better servo instead of two. Why not pay the same amount for a better one with twice the torque.