homebridge-gpio-wpi2 icon indicating copy to clipboard operation
homebridge-gpio-wpi2 copied to clipboard

Feature Request: SoftPWM Support for Dimmable LEDs

Open rsg98 opened this issue 8 years ago • 3 comments

@mv1993 request - add a Brightness characteristic that's hooked into SoftPWM - enable dimming of LEDs

rsg98 avatar Feb 06 '17 20:02 rsg98

Looks like softPWM requires one of the root WiringPi setup modes - which would go against trying to run homebridge as a non-root user.

We could look at using the built in hardware PWM on the Pi (but that only gives you two channels and kills the audio) - http://www.jumpnowtek.com/rpi/Using-the-Raspberry-Pi-Hardware-PWM-timers.html

...or using I2C to speak to a multi-channel hardware PWM board like the AdaFruit one (https://www.adafruit.com/product/815).

...or find a library other than WiringPi that offers a SoftPWM accessible to non-root

I think my preference would be one of the hardware PWM options, as we can then use the same sysfs interface to get non-root access (albeit, not via WiringPi)

rsg98 avatar Feb 06 '17 21:02 rsg98

For me two outputs are enough, but other users may need more. I also think its easier and safer to handle the request with the hardware PWM. I searched a bit on the web but I didn't find any library that supports softPWM, except wiringPi.

mv1993 avatar Feb 07 '17 07:02 mv1993

pigpio supports PWM on any of GPIO0 through GPIO31 but requires root privileges.

fivdi avatar Feb 25 '17 01:02 fivdi