Control RGBW LED by HSB(Hue, Saturation, Brightness)

In photoshop, there is a method to select a color using HSB. Hue is the color, saturation is the amount of the color, and brightness is like a dimmer.

  • I want a light panel consisting of only 3 RGBW LEDs controlled individually(one at a time) by adjusting HSB values.
  • I would like to use 3 potentiometers(for H, S, and B)
  • And a switch to select which LED the pots will color adjust.

This is my first project so I don't even know which arduino would work best, but I want the smallest option possible.


Basically you need to convert the HSB value of your control into RGB values because that is what you send to the hardware. Lots of examples on line like this one

Nice project idea, but for a first project, you should look for a project that is less complex. Make sure the processor selected supports enough PWM pins for your project (only two different colored RGB LEDs are supported on UNO board). You need to consider Gamma correction values too, because LED colors are not perceived by the human eye evenly with RGB values.

For my Ambient Lighting project, I had searched the internet for an Arduino RGB Library. I found several, but not one that could go both ways (RGB ->HSB & HSB_-> RGB). So I had to code my own in C++. So, if I wanted to adjust brightness but keep the same color, I'd need the new RGB values computed from HSV.

Be careful of the pseudocode on web sites. There are minor errors in the calculation formulas on several sites, including the english language HSL/HSV wikipedia.

Fortunately, I was only able to find the correct formulas on the german version wiki.

Good luck with the project.


Would saturation control be the same as increasing the brightness of white proportional to the reduction of brightness from whatever RGB combo?

Best to read the HSL/HSV Wiki. This web page's color picker provides sliders to show the affects of changes to each of the parameters.

and this page adds some perspective..

You could use “neopixel” type leds such as ws2812b or apa106, and the fastLED library, which supports HSV colour control. This will overcome the pwm pin limitations and having to find an HSV to RGB conversion method.

Any basic Arduino will be suitable if using the above LEDs. Nano might be easiest for a beginner.

s-l400 (2).jpg

It's frustrating as it appears most people didn't read your question was to convert from HSI to RGBW (note the "W"!!).

FastLED doesn't support RGBW (at the time I wrote this), and NeoPixel does support HSV to RGB, but not HSV to RGBW. I.e., you'll have to roll your own.

I know that this posting was posted a while ago, but since I stumbled upon it, I know others will too.

I had the same problem. So far something like this may be the answer:

I hope you found your answer!