The firmware supports two PWM types: software and hardware.

Software, configurable 1 kHz, 2 kHz, 3 kHz, 5 kHz – the firmware can generate the PWM signal on any pin. The higher frequency requires more CPU resources. The frequency may slightly float. You may configure up to two PWM outputs in the configuration.

Hardware, configurable 1 kHz, 2 kHz, 4 kHz, 8 kHz, 16 kHz, 32 kHz – the firmware uses the hardware PWM generator on the chip. The PWM duty cycle has 256 states (8 bits). It is precise and does not use CPU resources, but it can work on the following pins only:

PWM #1 pins: P13, P14, P16, P17 (one of these pins)
PWM #2 pins: P10, P11, P20, P23 (one of these pins)

If the frequency of all PWM is identical, you may create up to four hardware PWM.

PWM #1 pins: P13 or P16
PWM #2 pins: P10 or P20
PWM #3 pins: P14 or P17
PWM #4 pins: P11 or P23

If a PWM output is linked to a corresponding input (e.g. Input 2 – Output 2), the input can control the PWM value (12 steps, cyclic, 0 – 20 – 40 .. 240 – 255 0).

Zigbee cluster: ZCL_CLUSTER_ID_GEN_LEVEL_CONTROL
Zigbee attributes: ATTRID_LEVEL_CURRENT_LEVEL (uint8)
Zigbee commands: read, write, moveToLevel, moveToLevelWithOff

Zigbee cluster: ZCL_CLUSTER_ID_GEN_ANALOG_INPUT_BASIC
Zigbee attributes: ATTRID_IOV_BASIC_PRESENT_VALUE (float, range: 0-255)
Zigbee commands: read, write

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