How to configure LEDs on the PD-LED (P-ROC/P3-ROC)¶
|Related Config File Sections|
This guide explains how to configure MPF to use LEDs attached to a Multimorphic PD-LED board with either a P-ROC or P3-ROC.
Note that if you’re using a P-ROC/P3-ROC and you want to use serial-controlled LEDs (NeoPixels, etc.), then you can do that with a P-ROC/P3-ROC by using a FadeCandy instead of a PD-LED. You can also mix-and-match PD-LEDs and FadeCandy LEDs. If you are using a PD-8x8 or a local matrix on the P-Roc see the instructions about Matrix lights for P/P3-Roc.
Understanding the PD-LED board¶
The PD-LED controls up to 84 individual LED elements, which can be used to control individual single color LEDs, or (more likely), combined into groups to control RGB LEDs.
The PD-LED uses a “direct” connection method for LEDs, where each LED has connections for each color element running back to the PD-LED. This is a different architecture than the serial-controlled “Neo Pixel” type LEDs that other hardware uses.
Since the PD-LED board directly drives single color LED outputs, when you use it with RGB LEDs, you combine three outputs into a single RGB LED. The PD-LED supports both common cathode (common ground) and common anode (common 3.3v) LEDs, so each LED you buy has four pins (red, green, blue, and common). When you configure the hardware number for a PD-LED RGB LED, you specify four parts, separated by dashes:
- The address of the PD-LED board on the serial chain (as configured via the DIP switches on the PD-LED.
- The output number of the red element.
- The output number of the green element.
- The output number of the blue element.
You separate those with dashes, so an example PD-LED configuration might look like this:
lights: l_led0: number: 8-0-1-2 subtype: led
The example above configures “l_led0” as the LED connected to PD-LED board at address 8, using outputs 0, 1, and 2 as its red, green, and blue connections.
subtype: led is only needed on the P-Roc since
subtype defaults to
on the P3-Roc defaults. The P-Roc defaults to
You might connect different color channels to your PD-LED. For instance you might have only a red channel:
lights: my_red_only_insert: channels: red: - number: 8-0 # board 8 and first channel
Alternatively, you can use the same syntax as for l_led0 above:
lights: l_led0: channels: red: - number: 8-0 green: - number: 8-1 blue: - number: 8-2
Or you can configure a white LED:
lights: my_white_light: channels: white: - number: 8-4
You can also configure two red channel, green plus white or any other combination. See LEDs for more details about how to configure channels for different types of LEDs.
The PD-LED allows you to use either common anode or common cathode LEDs. (See the PD-LED documentation for details. The type of LED would dictate whether you hook it up between the PD-LED’s output and ground, or between the output and 3.3v.) You can then use the config file to specify which type of LED you have, such as:
lights: l_shoot_again: number: 8-60-61-62 platform_settings: polarity: True
True = common cathode (or common ground), False = common anode (or common 3.3V)
Note that DIP Switch 6 on the PD-LED board controls whether the “default” state of the LEDs after a reset is high or low. Basically it’s whether all the LEDs turn on or turn off when the board is reset. Which position does what is dependent on whether you’re controlling the anode or the cathode with your outputs, so basically if you turn on your PD-LED and all your LEDs turn on, then flip DIP switch 6 on the PD-LED to the opposite position and power cycle the board. Note: If servos are connected to a PD-LED board, DIP switch 6 also effects servo signal on power up. See Servos on a PD-LED (P-ROC/P3-ROC) for additional information.
If you are using RGB LEDs, they might not be perfectly white when you turn them on. They might be pinkish or blueish instead depending on the brand of the LED. To a certain extend this is normal/expected and you can compensate for it by configuring color_correction profiles in light_settings.
Serial LEDs on the PD-LED¶
Starting with PD-LED v2 you can use the PD-LED to drive serial LEDs.
To enable a serial LEDs you need to configure your PD-LED board in your
Assuming your PD-LED has the ID 4 you can use the following config to enable
all serial LEDs and and define a few:
p_roc: pd_led_boards: 4: use_lpd880x_0: True use_lpd880x_1: True use_lpd880x_2: True use_ws281x_0: True use_ws281x_1: True use_ws281x_2: True lights: l_serial_chain_0_first: number: 8-100-101-102 subtype: led l_serial_chain_0_second: number: 8-103-104-105 subtype: led l_serial_chain_1_first: number: 8-250-251-252 subtype: led l_serial_chain_2_first: number: 8-400-401-402 subtype: led
By default MPF maps the first chain (of both LPD880x and WS281x) to LEDs 100 to 249. The second chain to 250 to 399 and the third to 400 to 599. You can change those settings in the pd_led_boards: section.
Amplifying PD-LED channels with FETs¶
PD-LED drives LEDs with a current of 22mA. However, it cannot exceed its operating voltage and can only drive very few LEDs at once. If you want to drive more than a few LEDs on one channel (e.g. GIs or long strips) you can connect a FET (as stated in the manual). This is an example of such a circuit:
Please make sure to connect your PD-LED and the FET to the same common ground or your FET will smoke when connecting power.