mariusmotea / diyHue

Philips Hue emulator that is able to control multiple types of lights
Other
627 stars 107 forks source link

ESP8266 with WS2812B LEDs oversaturated and white #53

Closed cad435 closed 6 years ago

cad435 commented 6 years ago

Hello,

I setup a diyHue and a Lightstrip, wich is simply one WS2812B connected to a ESP8266-01. Works flawless, except the LED is way to bright and if I chose for example 'green' on the color-palette its more like a greenish white type of thing.

I made a picture really close to the lit LED, so as you can see the setting "green" actually lights up the green subpixel, but also the red subpixel is really bright, wich gives a type of yellow/green/white light.

--> Pic: http://fs5.directupload.net/images/170921/zqa5e9bm.jpg

In general most of the colors are very white and washed out.

Any help would be appreciated and since the discussion on Hackaday.io was moved to github i guess this is the right place to adress it.

cad435

mariusmotea commented 6 years ago

Hi,

Most of these problems are related to official Hue application that i believe is optimised for Philips Hue lights. If you will use another Hue application like Hue Switcher you will see the colour reproduction is much closer to reality. The xy CIE conversion formula to RGB is copied from Philips Hue SDK.

cad435 commented 6 years ago

Hello again,

Its indeed the Phillips-App, Hue Switcher works very well.

what i noticed after playing around a bit, the official app, seems to stop at a cerain point of saturation, i attached a pic below: if i try to change the color in the area i marked, in fact it always goes back to a certain color code. Im not sure if this color code is stored in the bridge application or in the app.

http://fs5.directupload.net/images/170921/th738cmm.png

cad435

mariusmotea commented 6 years ago

I believe the Philips Hue app is not sending the correct x,y coordinates with your colour selection. This can be verified if you start HueEmulator.py script manually because you can see the x, y values that hue app is sending to bridge and then compare with the colour from this diagram. I expect to not be a perfect match.You can send your own xy values to the leds strip to verify the colour reproduction accuracy of the strip with request like this http://{light ip}/set?light=1&y=0.532&y=0.343. Also from my experience every led has its own parameters, same light firmware applied to different bulbs have differences in colour reproduction. I guess Philips chose to fix this difference from mobile application, instead to tune better the bulbs. Please look at this video what happened when the leds are replaced in a Philips bulb with a regular strip

cad435 commented 6 years ago

ah, yes you are absolutely right... Phillips stuck witch xy: 0.408, 0.517 at some point and wont send any other color data... wich is quite sad because i actually like the layout they did in their app...

cad435

mariusmotea commented 6 years ago

Hi again!

Somebody discovered the conversion formula from Wikipedia is better that the one provided by Philips. My tests show better colors. Can you test by replacing

  float r =  X * 1.656492f - Y * 0.354851f - Z * 0.255038f;
  float g = -X * 0.707196f + Y * 1.655397f + Z * 0.036152f;
  float b =  X * 0.051713f - Y * 0.121364f + Z * 1.011530f;

with

  float r =  X * 3.2406f - Y * 1.5372f - Z * 0.4986f;
  float g = -X * 0.9689f + Y * 1.8758f + Z * 0.0415f;
  float b =  X * 0.0557f - Y * 0.2040f + Z * 1.0570f;

On my lights i have random results, but i believe overall this is better.

Marius.

cad435 commented 6 years ago

Hi!

I flashed one Light with the new conversion formula and left the other one...

And, to be honest, I can't even see a slight difference, the colors appear to be completely the same...

If you tell me wich situations I should try I'll be happy to test them, but right now I guess theres no noticeable difference.

cad435

kurniawan77 commented 6 years ago

I mentioned it somewhere... I can't seem to get blue right with this update.

cad435 commented 6 years ago

Hey! I just tried blue and didn't see any difference between the two versions...

cad435

kurniawan77 commented 6 years ago

I do see lots of difference between the two versions. Guess it's because I have sk6812. Blue is saturated and not blue but purple. With Hue Switcher app I can get blue. Think I will revert.

mariusmotea commented 6 years ago

i will try to mix them, maybe if i keep the blue line from old formula it will not be saturated. Overall red and green are better with new formula just the blue is saturated.

sneak-thief commented 6 years ago

I'm using SK6812 RGBW strips and still can't get pure blue or pure green using the Philips Hue app.

mariusmotea commented 6 years ago

Not sure is even possible to obtain pure blue or pure green with original Philips Hue application no matter what kind of light you are using. With other applications this is not such a big issue, try Hue Switcher. I guess every bulb/strip require different formula to obtain the most appropriate color from CIE chart, and this is because every led type has different properties.

Marius.

sneak-thief commented 6 years ago

I suppose I expected the white LEDs to turn off or at least become much dimmer. Any suggestions of which values to modify?

mariusmotea commented 6 years ago

Something is not right if you switch to hue mode and white led is still on. On SK6812 the white led is turned on only only when you set Color Temperature mode and depending if you choose could white of warm white the color leds change this. On Hue mode (xy CIE values) white leds must be all the time completely off.

sneak-thief commented 6 years ago

Let me verify this again tonight. Otherwise it's all working great on an ESP-01.

cad435 commented 6 years ago

Hey, I accidentaly discovered the difference between the two conversion formulas: Its ONLY noticeable if you use the original Hue-App. With the new formula you can achieve much more saturated colors with the original app (you won't be able to make PURE green and blue, but its OK-ish). With Hue-Switcher etc it makes no difference :)

wich is... actually very cool, I do like the original Hue-App! :+1:

cad435