Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to factor in the color temperature of the white LEDs? #29

Open
JosephAntony1 opened this issue Jan 13, 2022 · 7 comments

Comments

@JosephAntony1
Copy link

I can't quite figure out how the conversion of rgb -> rgbw when using the sACN mode is done so I wanted to know if there was some way to take into account the color temperature of the white LEDs in order to produce more accurate colors. Thanks!

@jackw01
Copy link
Owner

jackw01 commented Jan 13, 2022

Right now the white value is derived by finding the minimum of the red, green, and blue values which is then subtracted from the red, green, and blue channels. The white value is the square of this minimum value. After this, the red, green, and blue channels are multiplied by the led_color_correction values passed in through command line arguments and the color temperature set on the web interface.

I think you could get pretty close by adjusting the led_color_correction value (for example, by decreasing the blue channel if the white LEDs are too cool). The best way (still not perfect) to implement this would be to have a second color correction value that represents the approximate color of the white LEDs in RGB, which is multiplied by the minimum value that gets subtracted from the RGB values.

This still doesn't address several inherent issues in getting accurate colors with SK6812 RGBW LEDs:

  • The wavelengths of the RGB LEDs are unknown
  • The exact color temperature/emission spectra of the white LEDs are unknown
  • The brightness of the LEDs responds nonlinearly, which is hard to properly characterize and compensate for without specialized measuring equipment
  • The blue LED excites the white LED's phosphor causing blue colors to appear desaturated
  • All of these things may be inconsistent between suppliers of LEDs

This could all be addressed by taking objective measurements of various SK6812 LEDs from different suppliers and using the data to come up with a better color correction method, but I think at that point it would be less work and better overall to design a custom solution using known good LEDs and well-documented constant current driver chips.

@JosephAntony1
Copy link
Author

Yeah that second method is more or less what I was envisioning, thanks for the info!

@JosephAntony1
Copy link
Author

Where in the code is the white value actually calculated?

@jackw01
Copy link
Owner

jackw01 commented Jan 13, 2022

@JosephAntony1
Copy link
Author

JosephAntony1 commented Jan 14, 2022

Might be a dumb question but changing things in the led_render.h file doesn't seem to change the output at all...Does it get compiled or something? - is that what the swig auto generated file is for?

@jackw01
Copy link
Owner

jackw01 commented Jan 14, 2022

Yes, the C bindings need to be generated and the code needs to be compiled by running swig -python ./ledcontrol/driver/ledcontrol_rpi_ws281x_driver.i && sudo python3 setup.py develop for changes to take effect.

@WillCoulterKorrus
Copy link

Is it possible to allow the user to specify the r,g,b, and w channels directly instead of trying to map the rgbw onto rgbw with "saturation" and "global color temp"?

The code is impressive, but I'm having trouble finding where everything relates to eachother. I have access to the sophisticated measuring equipment mentioned in this thread, and I'm looking to control the strips at a more low-level. I surely wouldn't want to redo so much work you've done by creating my own implementation of the rpi_ws281x library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants