Calibrating RGB LED color

I recently got some cheap RGB leds that I'm trying to control. I want to gradually vary the color displayed. I originally did this by continuously changing the hue of an HSV color, then converting that to RGB outputs. However, the transitions between colors don't look very smooth, especially when one of the diodes is switching on or off.

  1. Is there a better way to interpolate colors than HSV? I know that color purists disdain HSV because it doesn't preserve lightness very well. I don't need to perfectly reproduce Renaissance art here, but maybe there is some transformation I can put on top of HSV that will keep the overall intensity more uniform?

  2. Anyone know an easy way to calibrate the intensity of the 3 diodes? The red diode is quite a bit brighter than the green and blue (only 2V drop vs 3.4V, so it uses almost twice the current). I've been trying to account for this by running it at twice the PWM frequency, but maybe there's a more sophisticated way of calibrating them? Maybe some non-linear gamma correction? The spec sheet didn't have any luminance curves, so I'm stuck comparing brightnesses by eye.

The best way to calibrate the LEDs is to use a diffrent resistor in each colour so you get your white when all three are full on.

Using HSV colour space is only one way, I find much better results using RGB colour space as there is less rounding errors with the limited brightness resolution.
However you don't get very good results with LEDs anyway.

I was planning on using the LEDs for a charlieplexed cube. I was hoping I could balance in software, since integrating resistors into the cube itself is going to be rather ugly. But now that I think about it, combining a software calibration with the time-division multiplexing wouldn't work well either.

Thanks for the suggestion about RGB space. I hadn't fully appreciated that changing the HSV hue is equivalent to linearly interpolating between the 6 primary RGB colors. I'm definitely seeing some rounding errors, so hopefully that will help.

With any sort of LED cube you need resistors to limit the current. I know there are designes that don't have resistors in but these are rubbish designes that damage your arduino.

Certainly some resistors are needed to limit the current. The problem is when the different diodes need different resistors. I think I've worked out a way to do this for my project, but it's a lot uglier than the circuit with just one type of resistor and some PWM calibration. I can post the circuit later if anyone is interested, but I don't have access to Eagle just now.

+1 on using RGB color space and on using current-limiting resistors. If you're really worried about matching colors, you're likely to get very frustrated with cheap LEDs - there's simply too much variability in the low-performance bin parts. And yes, buying more expensive tested and sorted LEDs will get you better matching.

You can go through a "calibration" process to get one RGB LED to behave reasonably well, but doing a whole cube would require you to calibrate each and every LED - a huge effort.

For individual RGB LEDs, I got good results using tight tolerance resistors and a colorimeter (like the type used to calibrate computer monitors) to develop correction factors (multipliers) for each color in software.

but it's a lot uglier than the circuit with just one type of resistor and some PWM calibration

Not sure why you think it is ugly using three different values of resistors?