I2C Servo Controllers

Related Config File Sections
hardware:
servo_controllers:
servos:

MPF currently supports PCA9685/PCA9635 based servo controllers via I2C. One example for such a controller is the Adafruit 16-Channel 12-bit PWM/Servo Driver. You can use any I2C platform supported by MPF (see I2C Platforms in MPF).

Overview video about servos:

1. Installing I2C Servo Controllers

Connect the controller to the I2C port and add the following config section:

hardware:
  servo_controllers: i2c_servo_controller
This example is tested to be valid MPF config. However, it is not integration tested.
hardware:
  servo_controllers: i2c_servo_controller

0x40 is actually the default I2C address for this chip but it might be different for some chips.

2. Add your servos

Add your servos to config:

servos:
  servo1:
    number: 0  # first servo on controller
This example is tested to be valid MPF config. However, it is not integration tested.
servos:
  servo1:
    number: 0  # first servo on controller

All these config options are explained in-depth in the servos: section of the config file reference.

You can also provide an I2C address per servo:

servos:
  servo_on_controller_63_0:
    number: 63-0  # first servo on board with ID 0x3F / 63
  servo_on_controller_63_1:
    number: 63-1  # second servo on board with ID 0x3F / 63
This example is tested to be valid MPF config. However, it is not integration tested.
servos:
  servo_on_controller_63_0:
    number: 63-0  # first servo on board with ID 0x3F / 63
  servo_on_controller_63_1:
    number: 63-1  # second servo on board with ID 0x3F / 63

What if it did not work?

Have a look at our hardware troubleshooting guide.