Go Down

Topic: Dimming PWM RGB Lights (Read 5373 times) previous topic - next topic


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. :)


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

If you ask for help and write 'u' instead of 'you' because you think it's convenient, I will write 'no' instead of 'yes'. For same reasons.


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..
Please Check the internet before posting!!!
#Learn how to use the FORUM - https://forum.arduino.cc/index.php?topic=148850.0


Sep 11, 2020, 05:12 pm Last Edit: Sep 11, 2020, 05:14 pm by Grumpy_Mike
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.

Go Up