# How to produce a perfect color wheel using an RGB LED?

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.

– vir
Dec 30, 2022 at 20:51
• You're never going to get a perfect color wheel with 3 colors of LED. Dec 30, 2022 at 20:56
• 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? Dec 30, 2022 at 21:00
• You’ll need to do gamma correction as well: en.m.wikipedia.org/wiki/Gamma_correction Dec 30, 2022 at 21:09
• 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. Dec 30, 2022 at 21:22

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.

The program produces this:

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.

• 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. Jan 1, 2023 at 15:44