pigpio Daemon PWM LED


The rpi_gpio_pwm platform allows to control multiple lights using pulse-width modulation, for example LED strips. It supports one-color, RGB and RGBW LEDs driven by GPIOs of a Raspberry Pi (same host or remote) or a PCA9685 controller.

For controlling the GPIOs, the platform connects to the pigpio-daemon, which must be running. On Raspbian Jessie 2016-05-10 or newer the pigpio library is already included. On other operating systems it needs to be installed first (see installation instructions).

Configuration

To enable this platform, add the following lines to your configuration.yaml:

# Example configuration.yaml entry
light:
  - platform: rpi_gpio_pwm
    leds:
      - name: Lightstrip Cupboard
        driver: gpio
        pins: [17]
        type: simple

Configuration Variables

leds list Required

Can contain multiple LEDs.

name string Required

The name of the LED.

driver string Required

The driver which controls the LED. Choose either gpio or pca9685.

pins list | integer Required

The pins connected to the LED as a list. The order of pins is determined by the specified type.

type string Required

The type of LED. Choose either rgb, rgbw or simple.

frequency integer (Optional, default: 200)

The PWM frequency.

address string (Optional, default: 64)

The address of the PCA9685 driver.

host string (Optional)

The remote host address for the GPIO driver.

Examples

In this section you find some real-life examples of how to use this sensor.

RGB LED connected to PCA9685 controller

This example uses a PCA9685 controller to control a RGB LED.

# Example configuration.yaml entry
light:
  - platform: rpi_gpio_pwm
    leds:
      - name: TV Backlight
        driver: pca9685
        pins: [0, 1, 2] # [R, G, B]
        type: rgb

RGBW LED connected to PCA9685 controller

This example uses a PCA9685 controller to interact with a RGBW LED.

# Example configuration.yaml entry
light:
  - platform: rpi_gpio_pwm
    leds:
      - name: Lightstrip Desk
        driver: pca9685
        pins: [3, 4, 5, 6] # [R, G, B, W]
        type: rgbw

RGB LED connected to the GPIO pins of an remote Raspberry Pi.

On the Raspberry Pi the pigpio daemon is running on the default port 6666.

# Example configuration.yaml entry
light:
  - platform: rpi_gpio_pwm
    leds:
      - name: Lightstrip Sideboard
        driver: gpio
        host: 192.168.0.66