Using LEDs as a coloured Light-source for photography

Hi, I’ve been playing around with FastLED and a WS2811 Neopixel ring as a coloured light source. Connected to an Arduino Nano its all working OK, and I’m getting back into some simple programming. I think I understand the HSV and RGB colour models OK, and have written a few test programs that work OK.

What I would like to do when I see a colour I like, is to go into photoshop or lightroom and look at the RGB or HSL values for that colour and then program the Nano to create that colour light via the neopixel ring.

This does not work in many cases, I’ll give you an example:

Brightness = 255
H = 95 = Green
V = 128 just as a starting point
then loop S from 0 to 255 in 5 or 10 value steps.

This starts off very bright almost white, and at S = 140 approx. I can start to see some Green creeping in, this gets better all the way up to 255.
So this is going from no saturation to full saturation at 255, and is understandable, I think!

So the 0-360 of H (in HSB) are converted to 1-255 in HSV, looking at a green example in PS, H=65° converted to 0-255 gives me 46 in HSV I think. But the S=45% and B=62% have me stumped. I have read the various conversion explanations and none seems to explain to me what is not working.
I assume it has something to do with how colours are created by the 3 RGB colours of each single LED.

Maybe someone could point me to how I ought to be going about getting the colours I want, the details and code I can find or write myself.

BTW I played around yesterday with the sketch_RGB_2_HSV_2_RGB_convert.ino, which shows that converting RGB back to HSV can often be quite a way off, not sure if that has to do with what I am seeing.

I don’t think I am any way near to looking at colour temp and correction yet.

I’d appreciate any help or tips as I’m quite new to this stuff still.

Or, should I just use RGB values instead?

Thanks in advance


Hello Brian. You might try adding a gamma correction to see what that looks like. Something like this right before you call

for (uint8_t i = 0; i < NUM_LEDS; i++) {
    leds[i].r = dim8_video(leds[i].r); // cheap gamma correction
    leds[i].g = dim8_video(leds[i].g);
    leds[i].b = dim8_video(leds[i].b);

Also this might be of interest to you.

Please come visit and share your question with the Reddit FastLED group for more discussion.

1 Like