The PCA9685 is an I2C-bus controlled 16-channel LED controller optimized for Red/Green/Blue/Amber (RGBA) color backlighting applications. Each LED output has its own 12-bit resolution (4096 steps) fixed frequency individual PWM controller that operates at a programmable frequency from a typical of 24 Hz to 1526 Hz with a duty cycle that is adjustable from 0% to 100 % to allow the LED to be set to a specific brightness value. All outputs are set to the same PWM frequency.

PCA9685. Typical configuration
Fig. 1. PCA9685. Typical configuration

The configuration above is for 8 channels on a controller connected to P15 (SDA) and P13 (SCL) pins.

Address – it is the I2C address. The default value is 0x70 (hex) or 112 (dec).

Inversed – if this option is enabled and the PWM channel is off, the output will have the HIGH level. Otherwise, the output will change the LOW level.

Frequency – PWM frequency. The firmware uses a value from the first defined channel (in this example, Output 1).

Channel – PWM channel number from 0 to 15.

Type – the PWM output type (fig. 2).

PWM output type
Fig. 2. PWM output type

Zigbee2MQTT commands

on/off – Look for commands and examples for GPIO outputs.
write – sets the PWM duty cycle.
Topic: z2m/[friedly_name]/[channel]/set/brightness
Channel: l1, l2, l3 … l8
Payload: value
Topic: z2m/[friedly_name]/set/[channel]
Channel: l1, l2, l3 … l8
Payload: {“brightness”: value, “transition”: 3}
value – 0 .. 254.
transition – (optional) the transition time in seconds between states.
read – reads the current value
Topic: z2m/[friedly_name]/[channel]/get/brightness
Payload: none
Returns: {“brightness_[channel]”: value}


There are no comments.

Leave a Reply