Warning

This is the documentation the latest work-in-progress version of MPF!

This is the documentation for MPF 0.56, which is the “dev” (next) release of MPF that is a work-in-progress. This is probably ok, and means you’ll be on the latest, cutting-edge version of MPF.

However, if you want a more stable version, select the v:stable version from the lower-left corner of this page, which is the most recent version that is not getting new updates.

If you are new to MPF, we have recently rewritten the installation process which only applies to this “latest” 0.56, so you probably want to stay here because the prior installation process doesn’t work on the latest OS and Python versions.

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.