probonopd / ESP8266HueEmulator

Emulate a Philips Hue bridge running on an ESP8266 using the Arduino IDE.
MIT License
411 stars 93 forks source link

Using sk6812 RGBW Strip #57

Closed janus-reith closed 7 years ago

janus-reith commented 7 years ago

The sk6812 is a digital light strip which works similar to the ws2812, but is also available with additional white leds. Adafruit also sells them as Neopixels RGBW. I guess this is a better choice, as I want to use this project for my main room light.

As Philips also sells the Hue Light Strip Plus with separated white now, I wonder if it will be easy to modify this code to act as the light strip plus.

probonopd commented 7 years ago

Yes I would be very interested in using the SK6812 but don't have the hardware (yet). We are using the NeoPixelBus library which claims support for it in the latest version:

A library to control one wire protocol RGB and RGBW leds like SK6812, WS2811, and WS2812 that are commonly refered to as NeoPixels and two wire protocol RGB like APA102 commonly refered to as DotStars.

I haven't investigated yet what it would take but probably we would have to add a configuration option to use the RGBW interface instead of the RGB interface.

Contributions welcome!

janus-reith commented 7 years ago

Yeah, I also read that Makuna's NeoPixelBus supports this, and I think as soon as I recieve my lightstrip it won't be hard to implement that side of it. Im just curious how hard it would be to make the bridge emulate the lightstrip plus?

Also, while the RGBW strips have a fixed temperature for the white leds, the philips strip allows to adjust this, I wonder if the white leds actually change color, or if it is achieved by "mixing" with the color leds.

probonopd commented 7 years ago

Mixing...

probonopd commented 7 years ago

I think there currently are

I am not sure if there is

strips available for purchase in Asia.

janus-reith commented 7 years ago

I also found these 3 versions in the datasheet at shenzhen led.

The Philips Lightstrip+ has 6 lines, so it could be RGB + CW + WW. The hue app shows a grid above the rgb grid to control the white temperature.

Maybe we could achieve a similar effect with a dimmed cold white + rgb. I didnt look up yet if the strip supports using rgb and white at the same time.

janus-reith commented 7 years ago

Just tried the sk6812 with the default configuration, the strip stays mostly white. I dont quite get how the values are connected:

NUM_PIXELS_PER_LIGHT is set to 10, MAX_LIGHT_HANDLERS in LightService.h is set to 6. This means a total of 60 leds? How is pixelCount= 30 connected to that?

I have a sk6812 RGBW with 60 "pixels", with this configuration each of the 6 bulbs equals 8 leds, and the last 12 leds stay empty - Changed MAX_LIGHT_HANDLERS to 1 and NUM_PIXELS_PER_LIGHT to 60, same thing. If I increase the value i can control all LEDS, but I dont quite get how it all matches up.

Or does led actually mean led, and not the whole rgbw element?

Also have to find out how to use rgbw colors, the hslColor and hsbColor part is confusing me.

janus-reith commented 7 years ago

Changing the NeoPixelBus feature to NeoGrbwFeature leads to issues with conersion from rgbw to hsl, e.g in HslColor originalColor = strip.GetPixelColor(lightNumber);

Also I'm not sure if I can just forward the colors to the strip, or if I will have to create specific cases when to use rgb and when to use the white leds...

janus-reith commented 7 years ago

Wow, everything working now with this (hacky) solution: Replaced line 14 with NeoPixelBus<NeoGrbwFeature, NeoEsp8266Uart800KbpsMethod> and line 33 with: RgbwColor rgbwVal = strip.GetPixelColor(lightNumber); RgbColor rgbVal = (rgbwVal.R, rgbwVal.G, rgbwVal.B); HslColor originalColor = rgbVal;

Variable names could be better, and I could probably put it into one line instead of three, but it works, the pixel amount is correct with 60 now, and even white is automatically mixed with blue/yellow components.

janus-reith commented 7 years ago

Ok some colors are off, probably have to switch R and G somewhere.