1
\$\begingroup\$

I am trying to produce a perfect color wheel using a bunch of WS2812 RGB LEDs.
My current attempt is to convert HSL (H = angle in color wheel, S = 100%, L = 50%) to RGB and send the RGB to the LEDs.
This does not produce a pretty color wheel. For instance, the red color looks much smaller than the rest.

I understand it is a problem related to color spaces, but I could not find a solution to it.

I am not looking to precisely calibrate it using a sensor, I am looking for a solution that works for the average RGB LED or WS2812 specifically.

\$\endgroup\$
11
  • 1
    \$\begingroup\$ Please show us a schematic of your setup. \$\endgroup\$
    – vir
    Dec 30, 2022 at 20:51
  • 4
    \$\begingroup\$ You're never going to get a perfect color wheel with 3 colors of LED. \$\endgroup\$
    – Simon B
    Dec 30, 2022 at 20:56
  • 3
    \$\begingroup\$ Not sure how a schematic would be at all helpful. A more relevant question would be, how are you doing your HSL to RGB conversion? Is it something like this? Also, have you taken into account the relative brightness of your actual LEDs? \$\endgroup\$
    – Dave Tweed
    Dec 30, 2022 at 21:00
  • 1
    \$\begingroup\$ You’ll need to do gamma correction as well: en.m.wikipedia.org/wiki/Gamma_correction \$\endgroup\$
    – Bryan
    Dec 30, 2022 at 21:09
  • 2
    \$\begingroup\$ If you don't want to measure the light output, you could try guessing values until you get something that looks close. You said red is dimmer, probably this means that if you'd measured it you'd find that the green and blue diodes are too bright. Try iteratively attenuating them until it looks right by eye. You won't get it perfect, but maybe you can get it good enough. And yes make sure you're doing the HSV to RGB calculation correctly. \$\endgroup\$ Dec 30, 2022 at 21:22

2 Answers 2

1
\$\begingroup\$

Have a look at Dan Bruton's work which shows how to synthesise a spectrum from RGB. You'll see there are points of pure B, G, R at 440, 510, 645 nm which you can adjust with values from your own datasheets; you might well want a normalising multiplier for each LED as well.

See the code at http://www.physics.sfasu.edu/astro/color/spectra.html for how to calculate the values.

enter image description here

The program produces this:
enter image description here

\$\endgroup\$
0
\$\begingroup\$

Looking at the datasheet of the LEDs:
The red and blue colors have luminosity of 700-1000mcd.
The green color has a luminosity of 1500-2200mcd.
I have scaled the green color signal linearly using this information and it produces better colors.
I still suspect there is an issue because the perception of brightness is different at different colors.

\$\endgroup\$
1
  • \$\begingroup\$ MCD is a unit of luminous intensity, not luminosity, so those numbers are already corrected for perception. Note however that datasheet isn't for the LEDs you're using, so probably the values aren't accurate for your lights. \$\endgroup\$ Jan 1, 2023 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.