diyhue / Lights

DIY lights with support for diyHue
https://diyhue.org/
172 stars 97 forks source link

ESP8266 Power Save GPIO pin for switch off power for WS2812 #119

Closed StefanM60 closed 2 years ago

StefanM60 commented 2 years ago

the power consumption of the WS2812 is quite high with many LED's in standby. It would be great to have a GPIO pin that switches on the LED's as soon as they are on and switches off when the LED's are off for a certain time. With this a relay or FET could switch off the power supply of the WS2812.

Best regards Stefan

mariusmotea commented 2 years ago

i think this can be done, not sure if the strip require an initialization process once the power is applied back.

https://github.com/diyhue/Lights/blob/master/Arduino/Generic_WS2812_Strip/Generic_WS2812_Strip.ino#L391

you can choose a free GPIO, set it as OUTPUT in setup phase and you can add additional condition here: https://github.com/diyhue/Lights/blob/master/Arduino/Generic_WS2812_Strip/Generic_WS2812_Strip.ino#L391

inTransition must be false (no animation is taking place) and lights[light].lightState must be false that show the logic power level.

GitHub
Lights/Generic_WS2812_Strip.ino at master · diyhue/Lights
DIY lights with support for diyHue. Contribute to diyhue/Lights development by creating an account on GitHub.
mariusmotea commented 2 years ago

Hi

I found this feature more important since it may save lot of energy for long strips so i implement this feature. Is tested by me and currently it set a GPIO HIGH when the strip must be on. This is because i did not have a P-CHannel mosfet that can be fully controlled by the ESP, so i used an additional NPN transistor.

This is the commit:

https://github.com/diyhue/Lights/commit/1eea8658c09b4cfcc565c6130576285753f91d9f