Dimming PWM RGB Lights

Hi all,
This is my first post and reading Google has gotten me this far however, I am struggling with something I thought would be simple.

I have colors i like that i can set in arduino using pwm for rgb. The arduino plugs into a Picobuck led driver from sparkfun which just takes 3 pwm signals. The leds work fine with all the colours.

The problem is I would like to dim the lights while keeping the same colors. This seems to be way more complex than i assumed. My understanding is i need to use hsv and convert that to rgb. I have tried a few different approaches here and cant get it working. Fastled lib seemed like the best in theory but i struggled to find information on how to use its analog mode.

My question is, is there a library that will do this all for me (dim pwm rgb leds) or is there an easier way to do this. I have also seen hsv sometimes isnt accurate also.

Thank you all and any help is appreciated. :slight_smile:

Can't get it working? You need to tell more about that particular thing. You've told nothing.

Does the RGB LED have a common ground? At least show a picture so that we can understand what the object you are describing is..

When you dim a colour you have to keep the proportion of the colour components red, green and blue the same while reducing the overall size of the numbers.

If you don’t keep the proportion the same then the colour will shift as it fades.

It helps to use floating point variables for thes components and convert to int to set the colours.

I have tried a few different approaches here and cant get it working.

Post your best one and we can see how far off you are.

Hi Guys,
Im sorry for the late update, last year was a bit crazy...... I ended up putting this project on pause.
What i have figured out is i need to use HSV to set the color and brightness then convert to RGB and I found a nice little C code that should work on arduino. The reason is, if you dim the colors equally in RGB by halving the values the color is off as each color gets perceived different by our eyes and it is more of a logarithmic change that needs to happen. There are some lookup tables i managed to find but way to cumbersome and arduino memory is small. I will update of I get it working for anyone else needing something like this to work.

For context im currently using the picobuck from sparkfun with some generic rgb led star lights. The leds have 3 separate anode and cathodes (one for each color) so no common. The tiny pico is controlled off of pwm.

Thank you for the replies!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.