pololu / pololu-led-strip-arduino

Arduino library for addressable RGB LED strips from Pololu
http://www.pololu.com/catalog/product/2540
MIT License
163 stars 85 forks source link

Brightness Control and Max Current Control ? #20

Closed Speedy-VI closed 1 week ago

Speedy-VI commented 2 weeks ago

Not an expert so I hope this request is not silly..

I tried your example files driving a WS2812B 8x8 LED Matrix with an Arduino Uno R3. They work fine but other than LedStripColorTester, they are very bright. Is there a way to set or limit the overall brightness of the LEDs? The FastLED library has:

define BRIGHTNESS [value]

define Volts 5

define Max_Amps [value]

Then in void setup: FastLED.setMaxPowerInVoltsAndMilliamps(Volts,Max_Amps); FastLED.setBrightness(BRIGHTNESS);

These provide an easy way to control overall Brightness and max current draw which I need to do when powering the the LEDs from the board, in my case an Arduino Uno R3 or Nano.

Thanks!

zackees commented 2 weeks ago

Yes there is a set brightness function in fastled. See the examples directory for how to do this.

kevin-pololu commented 1 week ago

Hi, @Speedy-VI. Unfortunately, this library does not support limiting power/current or scaling the brightness of the LEDs separately from the RGB values.

Speedy-VI commented 1 week ago

Hi, @Speedy-VI. Unfortunately, this library does not support limiting power/current or scaling the brightness of the LEDs separately from the RGB values.

Thank you for confirming this. I was able to adjust the overall brightness by adding a scaling factor and applying it to each of the RGB values. In the LedStripRainbow example I scaled the "v" value down in the HSV to RGB conversion. Now I can play with the examples without being blinded!

zackees commented 1 week ago

I don't understand. WS2812 only has RGB values that can be modified. What other way are you expecting?

Speedy-VI commented 1 week ago

I don't understand. WS2812 only has RGB values that can be modified. What other way are you expecting?

I understand that WS2812 only accepts RGB values. I was wondering if their was a convenience function like FastLED.setBrightness that takes care of the RGB scaling and/or a function that provides an easy way to limit the amount of current the LEDs can consume like FastLED.setMaxPowerInVoltsAndMilliamps.

When I am testing code I downloaded or wrote on a few dozen LEDs, I power them directly from the controller (UNO R3 in this case). When I do this I always include FastLED.setBrightness and FastLED.setMaxPowerInVoltsAndMilliamps to keep the LEDs at a comfortable brightness level and ensure that I don't damage the controller or the USB port that powers it. I rarely, if ever want WS2812B LEDs running at 100% brightness, so these FastLED abstractions are quite handy. When I ran the Pololu examples, the LEDs were very bright and the first thing I wanted to do was turn them down.