Demand Peripherals     Robotics and Automation Made Easy

SERVO4: Quad PWM Servo Controller

SERVO4 controls four hobby servos with 50 nanosecond resolution per servo.

 

Hardware:

The Quad Servo Controller provides four outputs that can each control one PWM servo motor. The servo pulse widths are accurate to 50 nanoseconds. The cycle time on each of the four signals is 20 milliseconds.

Normal servo motors expect a pulse width in the range of 1000000 to 2000000 nanoseconds. A 50 nanoseconds resolution gives 20000 different valid values or over 14 bits of accuracy.

The servos are numbered from 1 to 4 with servo 1 on the lowest numbered pin on the interface card. You can wire your own interface but SERVO4 is most often paired with the GPIO card. More information about the GPIO card can be found here: GPIO card.

 

Resources:

servogroup : pulse widths in nanoseconds.
Servogroup has four space-separated pulse widths in nanoseconds and terminated by a newline. A pulse width of -1 keeps the current position for that servo. A pcget on the servogroup resource returns the current positions of all four servos.

servo1 - servo4 : pulse width in nanoseconds.
A pcget on the servoX resource returns the current position of servo X.

 

Examples:

Move all pulse widths to center, then move just servo 1 and 3 but not 2 and 4. Set servo 2 to full counterclockwise.

   pcset servo4 positions 1500000, 1500000, 1500000, 1500000
   pcset servo4 positions 1400000 -1 1600000 -1
   pcset servo4 servo2 1000000

If running from the Bash command line the minus sign of a -1 will be interpreted as the start of a command line option. Use '--' to tell Bash there are no more dash options on the line.

   pcset servo4 positions -- 1400000 -1 1600000 -1